I have a Python virtual environment and I’d like to install PyCall to point to the environment’s Python, but I get an error when I try to execute “using PyCall” (error message below). I’m on Linux and I first activate the environment and then attempt to get rid of any existing conflicts by deleting the existing Julia install folder and the Julia cache (~/.julia). Then I unzip Julia, run it, and execute “]add PyCall”. It installs with no problem, then I run “using PyCall” and get the following error:
ERROR: InitError: PyError ($(Expr(:escape, :(ccall(#= /home/wdk24/.julia/packages/PyCall/BD546/src/pydates.jl:68 =# @pysym(:PyCapsule_Import), Ptr{PyDateTime_CAPI}, (Ptr{UInt8}, Cint), "datetime.datetime_CAPI", 0))))) <class 'ImportError'>
ImportError('PyCapsule_Import could not import module "datetime"')
Stacktrace:
[1] pyerr_check
@ ~/.julia/packages/PyCall/BD546/src/exception.jl:62 [inlined]
[2] pyerr_check
@ ~/.julia/packages/PyCall/BD546/src/exception.jl:66 [inlined]
[3] _handle_error(msg::String)
@ PyCall ~/.julia/packages/PyCall/BD546/src/exception.jl:83
[4] macro expansion
@ ~/.julia/packages/PyCall/BD546/src/exception.jl:97 [inlined]
[5] init_datetime
@ ~/.julia/packages/PyCall/BD546/src/pydates.jl:68 [inlined]
[6] __init__()
@ PyCall ~/.julia/packages/PyCall/BD546/src/pyinit.jl:226
[7] _include_from_serialized(path::String, depmods::Vector{Any})
@ Base ./loading.jl:696
[8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
@ Base ./loading.jl:782
[9] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1020
[10] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:936
[11] require(into::Module, mod::Symbol)
@ Base ./loading.jl:923
during initialization of module PyCall
Running “import datetime” in Python yields no issues, so I’m not sure what could be causing this. Any help is greatly appreciated!