Following the instructions on the PyCall.jl readme, I am tying to use a pipenv python when using PyCall for my julia project (in it's own environment).
In a terminal, I have activated the python environment using pipenv shell
, and then located the pathfile of the pipenv version of python. PyCall has already been added to the manifest in my julia environment. In the source-activated terminal, I started Julia and entered: ENV["PYCALL_JL_RUNTIME_PYTHON"] = pipenv python environment
and then proceeded to run Pkg.build("PyCall")
, which installs conda. When importing PyCall - using PyCall
- I get the following error.
ERROR: InitError: Incompatible `libpython` detected.
`libpython` for C:\Users\me\.virtualenvs\iap\Scripts\python.exe is:
C:\Users\me\.virtualenvs\iap\Scripts\python37.dll
`libpython` for C:\Users\me\.julia\conda\3\python.exe is:
C:\Users\me\.julia\conda\3\python36.dll
PyCall.jl only supports loading Python environment using the same `libpython`
I've tried re-installing PyCall, but the python environment libpython always throws this error. How can I override or otherwise work around the conda requirement for base julia?
I have a feeling that the Conda dependency of PyCall is causing some libpython
issue, and that the ENV["PYCALL_JL_RUNTIME_PYTHON"]
call doesn't override the libpython variable properly.
According to the documentation PyCall
supports venv
and virtualenv
environments, but you are using pipenv
. I recommend you try with either of the supported alternatives, if you want to use the PYCALL_JL_RUNTIME_PYTHON
variable.
If you want to use continue using the pipenv
environment instead, you probably have to specify the PYTHON
variable instead in your startup.jl
configuration file, like this:
ENV["PYTHON"] = "C:\\path\\to\\your\\pipenv\\python.exe"
Then run:
julia> using Pkg; Pkg.build("PyCall"); using PyCall
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With