Skip to content

Conversation

@rwest
Copy link
Member

@rwest rwest commented May 19, 2023

This is a subset of what was in #2443 but I'm breaking it off into a smaller PR that can be merged first.

Motivation or Problem

  • We have an old and customized version of pyjulia on the rmg conda channel that we fail to maintain.
  • Debugging things with pyjulia involved can be a bit tricky.

Description of Changes

  • switches to the conda-forge version of pyjulia, instead of the customized (and old) rmg channel one, so we are more standardized and have less to maintain.
  • fixes our CI workflow so that we can use the new pyjulia (remove the symbolic linking step that made python-jl masquerade as python).
  • adds developer instructions for how to debug (in VSCode)

Testing

  • Runs on my intel Mac, following instructions with a fresh anaconda environment and no system-wide Julia.
  • Runs on the CI test suite.

Reviewer Tips

Most of this has already been reviewed by @JacksonBurns when it was #2443 so should be a quick review, but I'd like @mjohnson541 's input.

Possible concern.

The readme for pyrms says "to work with conda python efficiently currently requires relinking the python executable to the python-jl executable"
so perhaps @mjohnson541 will tell us that skipping this step (as proposed here) is a bad idea?
I can't see anything in the commit messages when those instructions were added to explain the details.
I would note that

  1. our developer instructions do not recommend making the symlink (commit 5d20826 almost added it? but didn't)
  2. our Docker container does currently make the symlink (probably that should be removed in this PR, if this change is approved)

Environment alert ⚠️

This updates the conda environment file again.
So to be consistent, you'll need

  1. a fresh conda environment (using pyjulia from conda-forge instead of from the rmg channel)
  2. you might need to re-do the whole step of installing julia in python and python in julia etc. (following the instructions)
  3. if you have symlinked python to point to python-jl, ether in your normal environment or in some other workflows, revert this.

Copy link
Contributor

@JacksonBurns JacksonBurns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM but I have a question that may impact changes (thus "Request changes") - do we now have to use "python-jl rmg.py ..." without a system image and then "python rmg.py ..." otherwise? The docs should clarify this, unless I am just misunderstanding. We should also replace #2310 with this PR, I think.

@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Merging #2444 (83a6de3) into main (955c8f1) will not change coverage.
The diff coverage is n/a.

❗ Current head 83a6de3 differs from pull request most recent head 9aa3998. Consider uploading reports for the commit 9aa3998 to get more accurate results

@@           Coverage Diff           @@
##             main    #2444   +/-   ##
=======================================
  Coverage   48.13%   48.13%           
=======================================
  Files         110      110           
  Lines       30626    30626           
  Branches     7988     7988           
=======================================
  Hits        14743    14743           
  Misses      14353    14353           
  Partials     1530     1530           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rwest
Copy link
Member Author

rwest commented May 19, 2023

After this, we should always use python-jl to launch rmg.py. Thanks for reminding me that the "running" instructions may be out of date. (nb. the previous instructions wouldn't have worked for folks installing via the "source code for developers" install instructions).
I've now

@rwest
Copy link
Member Author

rwest commented May 19, 2023

do we now have to use "python-jl rmg.py ..." without a system image and then "python rmg.py ..." otherwise?

Dealing with system images is happening on #2443 and instructions for what to do when you have one will be added there. (FWIW, I currently can't get it it work).

@rwest rwest marked this pull request as draft May 19, 2023 19:17
@rwest rwest marked this pull request as ready for review May 19, 2023 19:18
@mjohnson541
Copy link
Contributor

Relinking is mostly a convenience thing. All it does is makes it so when you use python you're using python-jl if you use python-jl when needed there's no reason to do the relinking operation.

@rwest
Copy link
Member Author

rwest commented May 23, 2023

Great. Thanks for the confirmation @mjohnson541. Do you think this PR is Ok then?

@mjohnson541
Copy link
Contributor

LGTM!

rwest and others added 7 commits May 24, 2023 00:15
We used to force a symlink of python-jl to where python used to be,
so that when you ask for python you get python-jl.
This would work if the python-jl itself called to python3, (which is 
what our hacked version of it did). But the conda-forge version of 
python-jl calls python, and if python points to python-jl, then
you get an infinite loop of calling python-jl.

That's my hunch. This will test the theory, and see what happens.
Maybe we'll have to explicitly call python-jl in a few places we
used to be lazy and called python. But it seems to work and makes
us compatible with a standard python-jl.
Also, "explicit is better than implicit!"
The rmg conda recipe just changes 'python-jl' to point to a python3
instead of python binary. Maybe this can be avoided.
Would be nice to not maintain a non-standard package.
Also merged Calvin's commit that did the same and forced it to >=0.6

Co-authored-by: Richard West <r.west@northeastern.edu>
Co-authored-by: Calvin Pieters <calvinpieters@gmail.com>
These could be helpful.
It seems some of the code changes on this branch were trying
to get things to work in a debugger, so I thought I'd share how
I got it to work (in VSCode)
(Annoyingly, this builds all the julia stuff and takes for ever. Grrr)
If we remove the symlink from python to python-jl, so that people
are more aware that they are in fact running python-jl, we need to update
the running instructions.
Now that we're using the conda-forge::pyjulia in the environment,
we need to not do this symlink step in the Docker image.
 
We want the environment for our docker users to match everyone else,
so we have one set of instructions.
@rwest rwest dismissed JacksonBurns’s stale review May 24, 2023 04:21

Good review - I've addressed the concern by updating the documentation in a subsequent commit.

@rwest rwest enabled auto-merge May 24, 2023 04:29
@rwest rwest merged commit 54b478d into ReactionMechanismGenerator:main May 24, 2023
@rwest rwest deleted the pyjuliafix branch May 24, 2023 14:03
@rwest
Copy link
Member Author

rwest commented May 24, 2023

The build-documentation job ran on the CI test (or this wouldn't have auto-merged) but when I try on my mac I get an error culminating in ERROR: LoadError: Failed to precompile SteadyStateDiffEq [9672c7b4-1e72-59bd-8a11-6ac3964bc41f] to /opt/miniconda3/envs/rmg_env5/share/julia/compiled/v1.8/SteadyStateDiffEq/jl_HZAEMz. .

I need to run sphinx through python-jl, like so:

The make documentation would essentially do::

cd documentation
sphinx-build -b html -d build/doctrees   source build/html

instead I do::

cd documentation
python-jl $(which sphinx-build) -b html -d build/doctrees   source build/html

Not sure if this is true for others?
If so maybe we fix the makefile and instructions to do this? (until python-julia integration is less painful)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants