-
Notifications
You must be signed in to change notification settings - Fork 189
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
PyCall does not use virtualenv #706
Comments
Which Python is PyCall configured to use? i.e. what is |
What was the solution to this issue? |
Hi, The executable is set right:
but Python’s
since there are only the site-packages of the main Python installation. I have Win10 too. |
Sorry for the delay. I eventually changed to using WSL after not being able to figure this out. |
So on Linux, this virtualenv thing works fine, right? I guess it’s because PyCall is not using Conda.jl. I wonder how to bypass Conda on Windows too. |
You need to set |
Thanks. Actually I used julia> ENV["PYTHON"] = Sys.which("python")
"C:\\<full path here>\\.env\\Scripts\\python.exe" inside the virtualenv which does give the absolute path. It still did not work as expected. |
A work-around solution for me is to add the site-packages dir of the virtualenv to environment variable PYTHONPATH:
|
I’m guessing this behaviour is because ‘PyCall does not use the python program per se: it links directly to the libpython library’ (from README). In the case of a virtualenv, the libpython library still is at the main Python install directory, and that’s why only the site-packages of that install are in As the README says that virtualenvs are supported, I’d assume that includes the site-packages too (which is probably the biggest reason to use virtualenvs). Could the |
Seem that using virtualenv instead of Python standard library venv, resolves this. I did:
Note the site-packages dir of the virtual environment |
@ererkka |
I also tried but a virtual environment created using venv didn't work on Windows, even if I specified
This happens only on Windows. It doesn't reproduce on my Linux environment. |
I'm running Python 3.7.3 and Julia 1.1.1 (2019-05-16). I have a virtual environment set up for python and PyCall is unable to import the packages installed there. In addition, when I run
I get the site packages folder of my main install and not the environment one. I can also import packages if they are installed on my system's Python.
When adding PyCall I have my environment activated. I have also tried setting the ENV["PYTHON"] and running
Pkg.build("PyCall")
as well with no change.I am on Windows 10.
The text was updated successfully, but these errors were encountered: