-
Notifications
You must be signed in to change notification settings - Fork 297
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
Run cell does not use virtualenv #3800
Comments
I'm also getting this behavior. |
This is happening because the kernel specs returned by Jupyter can't be matched against the virtual environment. We need to figure out some other way to match them up. When I tried this the kernel spec returned this for the virtualenv:
We can possibly better match on the major version here, but we don't have the path to the python being used. |
You can do this to see what version of python is being used: import sys |
Suggestion: compare the paths. The first argument is the path to the executable. Look for kernels that have the same path as the currently selected one. |
No in this case the first argument is not the full path. It's just "python". Otherwise it would have worked. |
Agreed, that's cuz this kennel is using the default Python environment. And you can get that using |
I'm fixing this by generating a new kernel spec for any environment that we don't have one for. |
Environment data
Actual behavior
IPython kernels spawned on running cells does not use virtualenv, causing imports to fail.
Expected behavior
IPython from virtualenv should be used
Steps to reproduce:
import matplotlib
#%%
and run cellLogs
Running
get_ipython().run_line_magic("matplotlib", "inline")
reveals that the wrong IPython is used:Output from
Console
under theDeveloper Tools
panel.The text was updated successfully, but these errors were encountered: