-
Notifications
You must be signed in to change notification settings - Fork 75
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
virtualenv site-packages not automatically included in sys.path #184
Comments
Output from PYCALL_DEBUG_FIND_LIBPYTHON=1:
virtualenv is linking to /opt/homebrew python:
|
Further investigation:
I have noticed that "editable" package installations (site-packages/*.pth files) are also not registered into the path from pycall.rb. This is consistent with I wonder: is there a way to set sys.executable to the local python bin? This would make site.py function as expected. |
Here's a "semi proper" workaround that anyone else facing this can do:
This will properly setup your venv's site-packages, including registering .pth files (editable installs) etc. |
I'm trying to use a virtualenv with pycall. Python is loaded correctly, but sys.path does not include the site-packages from the virtualenv. Instead site-packages from the underlying python interpreter (in /opt/homebrew) is used.
For example, lets say I have a new version of
urllib3
in my virtualenv:If I manually set PYTHONPATH, it will load from the virtualenv:
The problem with setting PYTHONPATH manually, is now I cannot invoke 3rd party python-using tools like
aws
cli from my process, because the manual PYTHONPATH will point them at my virtualenv.The text was updated successfully, but these errors were encountered: