-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird interaction with Jupyter notebooks resulting in "forgetting" the Julia dependencies #497
Comments
I wonder if it could also be something about the way the package gets installed? Like perhaps it is dropping the Edit: Maybe I should just use |
Update: Seems like I was able to fix this by using the Python interface of Edit: although... I'm not sure why, the Jupyter notebook now seems to try to re-install every time it starts? |
Can you be more explicit in how to reproduce? I.e. give a sequence of commands specifying exactly how you set up the environment and are invoking python/jupyter. My immediate thought is just that you're not in the venv you think you are. I don't understand your juliapkg.json comments - you never mentioned interacting with that directly in the OP. |
This was my first thought too, but it’s actually writing the Project.toml to the correct path. (And is able to import the correct Python libraries)
Sorry. PySR has shipped a manually-edited juliapkg.json so far in its releases. But perhaps I should have been using the
It’s difficult to do this because the way an environment/kernel is selected in VSCode/Jupyter, which is all GUI based. However, here’s what I do. To set up the environment, I just do python -m virtualenv .venv
source activate .venv/bin/activate
pip install pysr jupyter ipython ipykernel
python -c "import pysr"
jupyter notebook Then, inside a new notebook, I select this environment for the kernel and run |
I cannot reproduce your issue by following those steps. Can you compare |
@MilesCranmer Not sure but could be related: The side effect of the non-standard way was that depending on whether |
It's now released. |
Affects: JuliaCall
Describe the bug
Just flagging this in case others have seen it. I will:
pip
.python -c 'import pysr'
to set up the Julia environment.Sometimes I do this, and it seems to... "forget" what Julia packages are in my environment. In other words, when I do
It will start re-installing the environment, with only PythonCall.jl. It seems like the first time it hits a
from juliacall import Main
, it just "resets" the Julia project and forgets thejuliapkg.json
previously used.I wonder if this might be because the ipykernel itself is installed via a different python virtualenv? However it still seems to import the Python packages correctly; it just ends up uninstalling the Julia dependencies...
Reproducing. You can try to reproduce this as follows (not positive what seems to cause this; it might work or might not work for you):
/path/to/my/.venv
and install pysr, ipython, ipykernel, and jupyter with pip./path/to/my/.venv
. Now, in Jupyter, import pysr.You might see that it will start re-installing the Julia project, but this time, only with PythonCall.jl, and no other dependencies. It will fail halfway through
Any idea @cjdoris? How are
juliapkg.json
used at import time to generate the right installation commands? Maybe I can provide more debugging info in some way.Maybe I just have weird ipykernel settings and nobody can reproduce this?? Or perhaps the juliapkg.json isn't getting packaged correctly in the wheel?
Your system
Please provide detailed information about your system:
Additional context
IPython always seems safe. Never had an issue. It's exclusively Jupyter notebooks (both in VSCode, and in regular Jupyter notebooks in the browser) where the juliapkg "forgetfulness" happens.
The text was updated successfully, but these errors were encountered: