-
Notifications
You must be signed in to change notification settings - Fork 293
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
can not load system-site-packages when using a venv ipykernel #9979
Comments
Thanks for the bug. Can you print out the sys.path in a notebook and the sys.path in a python terminal and show the difference here? We should be picking up the pyvenv.cfg settings so I'd like to see what the difference is. |
@rchiodo we don't load system wide global packages in non global python paths. this is by design. |
@DonJayamanne are you saying we remove them? I just thought we didn't add them to the list. But we don't change them, do we? |
We do remove them.
Thats correct, this is made possible by removing them from the list. |
Why do we remove them? This was because conda environments were picking up the wrong stuff? |
Sorry for not explaining that, yes thats correct. We found that it completely messes up things. And decided not to add it. I'd suggest just adding this back only for virtual environments (venv, virtualenv, virtualenvwrapper, etc). |
@DonJayamanne @rchiodo Thanks for your replies. When using VScode 1.66.2 with jupyter 2022.2, I had noticed that a venv ipykernel can not be started if any dependent packages are inherited from the global python path. But then a global package can still be used in a virtual enviroment. |
We think we can honor adding this request by reading the pyvenv.cfg file and if the system site packages is set to true, we append site package path. |
@ruiy326 did you mean to close this? We plan on fixing this soon. |
Resolving as dupe of #9995 |
Environment data
Expected behaviour
fail to import a module installed in %userprofile% in *.ipynb files but it works in *.py files.
I have set 'include-system-site-packages = true' in pyvenv.cfg.
Actual behaviour
failed with ModuleNotFoundError
Steps to reproduce:
Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)The text was updated successfully, but these errors were encountered: