Closed EHBaozi closed 2 years ago
Probably you have some path problem. What is PyCall.python
, are you letting PyCall install its own Python distro via Conda or are you using some other Python distro?
I'm using my own python installation (using miniconda). THe path is properly set, i.e. I have the following before using PyCall
:
julia> println.(split(ENV["PATH"], ";"));
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\Library\mingw-w64\bin
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\Library\usr\bin
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\Library\bin
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\Scripts
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\bin
C:\Users\invis\scoop\apps\mambaforge\4.10.1-4\condabin
...
and PyCall
is also built with this python installation.
I cannot get PyCall.python
since using PyCall
crashes Julia.
You can look at the file C:\Users\invis.julia\packages\PyCall\L0fLP\deps\deps.jl
(the L0fLP
part may change if you use different PyCall version). You can also try typing ]build --verbose PyCall
in the REPL.
I cannot get
PyCall.python
sinceusing PyCall
crashes Julia.
@stevengj This is why I think #945 should have a separated config package.
deps.jl
:
const python = "C:\\Users\\invis\\scoop\\apps\\mambaforge\\4.10.1-4\\python.exe"
const libpython = "C:\\Users\\invis\\scoop\\apps\\mambaforge\\4.10.1-4\\python310.dll"
const pyprogramname = "C:\\Users\\invis\\scoop\\apps\\mambaforge\\4.10.1-4\\python.exe"
const pyversion_build = v"3.10.2"
const PYTHONHOME = "C:\\Users\\invis\\scoop\\apps\\mambaforge\\4.10.1-4"
"True if we are using the Python distribution in the Conda package."
const conda = false
The paths are set up ok.
I did a bit more digging and it turns out that this problem doesn't happen with python 3.9.4. I switched to another conda environment w/ python 3.9.4, rebuilt PyCall
with it and now it's working just fine. So something in python 3.10 is making PyCall
unhappy. Don't know what exactly though.
I met the same problem. I use Python package from conda-forge and PyCall.jl 1.93.0 on Windows 10.
_ctypes
but I can import it in PythonIt seems to be some issues on conda-forge side.
See
https://github.com/conda-forge/python-feedstock/issues/539
https://github.com/pre-commit/pre-commit/issues/1329
The same error ImportError: DLL load failed while importing _ctypes: The specified module could not be found.
Currently, I pin Python package at 3.9.7 as a temporary solution. https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning
Can you send the logs with CONDA_DLL_SEARCH_MODIFICATION_DEBUG=1
env variable set?
@isuruf When Python 3.9.10 errors, I get following log
CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(C:\Users\yangy\AppData\Local\Programs\Julia-1.7.1\bin\bin - ExePrefix)
CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(C:\Users\yangy\AppData\Local\Programs\Julia-1.7.1\bin\Scripts - ExePrefix)
CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(C:\Users\yangy\AppData\Local\Programs\Julia-1.7.1\bin\Library\bin - ExePrefix)
CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(C:\Users\yangy\AppData\Local\Programs\Julia-1.7.1\bin\Library\usr\bin - ExePrefix)
CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(C:\Users\yangy\AppData\Local\Programs\Julia-1.7.1\bin\Library\mingw-w64\bin - ExePrefix)
I think it should search miniforge3
prefix rather than Julia directory.
I find your PR https://github.com/conda-forge/python-feedstock/pull/546. Thanks for quick response and patch!
Should be fixed now. Update your python and it should work.
Can confirm. Thanks!
As the title says, despite the fact that
ctypes
is present. It also causes Julia to crash.PyCall
version 1.93.0, python version 3.10.2 (managed through a miniforge installation).Full stacktrace: