Closed
Description
Affects: PythonCall
Describe the bug
After setting up a local Python version using pyenv
, creating a virtual environment, and setting up PythonCall to use that venv instead of Conda, PythonCall can't be loaded:
julia> using PythonCall
┌ Warning: Python library "/Users/rdoake/.pyenv/versions/3.9.13/lib/python3.9/config-3.9-darwin/libpython3.9.a" could not be opened.
└ @ PythonCall.C ~/.julia/packages/PythonCall/1f5yE/src/cpython/context.jl:118
┌ Warning: Python library "/Users/rdoake/.pyenv/versions/3.9.13/lib/libpython3.9.a" could not be opened.
└ @ PythonCall.C ~/.julia/packages/PythonCall/1f5yE/src/cpython/context.jl:118
ERROR: InitError: ArgumentError: NULL library handle
The files referenced in the error message do exist.
Steps to reproduce
- Create a directory & shell into it
pyenv local x.x
# I used 3.9 to disambiguate from my default system Python, which is 3.10- create a venv at
.venv
using the tool of your choice (I tested with Poetry and venv) - launch Julia
] activate .
> ENV["JULIA_CONDAPKG_BACKEND"]="Null"
# don't use Conda> ENV["JULIA_PYTHONCALL_EXE"]=".venv/bin/python3"
# point PythonCall to the venv python] add PythonCall
> using PythonCall
My system
- MacOS 13.4
- Julia 1.9.0
- PythonCall 0.9.13
Additional context
If I instead use poetry
to specify a Python version for the virtual environment, and then do the above steps without using pyenv
, then PythonCall works as expected.