scipy: Missing DLL dependencies, scipy 1.6.3
My issue is about FileNotFoundError thrown when I try to import scipy to python console. I have scipy version 1.6.3 installed from conda-forge:
scipy 1.6.3 py38he847743_0 conda-forge
The DLL file mentioned in the error message below exists on my system.
Reproducing code example:
import scipy
Error message:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\JetBrains\PyCharm 2021.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\kalivoda\.conda\envs\bci-classifier\lib\site-packages\scipy\__init__.py", line 130, in <module>
from . import _distributor_init
File "C:\Program Files (x86)\JetBrains\PyCharm 2021.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\kalivoda\.conda\envs\bci-classifier\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\kalivoda\.conda\envs\bci-classifier\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\kalivoda\.conda\envs\bci-classifier\lib\site-packages\scipy\.libs\libbanded5x.EHDKC2XVYTQQ5MALRS6XN2CUSS6SRL6P.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Numpy/Python version information:
1.19.5 sys.version_info(major=3, minor=8, micro=8, releaselevel='final', serial=0)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (12 by maintainers)
scipy\.libs\libbanded5x.EHDKC2XVYTQQ5MALRS6XN2CUSS6SRL6P.gfortran-win_amd64.dll
is a DLL that comes from a wheel, not a conda-forge package. So you have mixed uppip install scipy
andconda install scipy
here - that will lead to problems.I recommend you just delete this environment and create a new one.
This is not a packaging issue, so I’ll close it.
I had another look, this isn’t fixable by us in a reasonable way. @jpmaterial please use
CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
if you want to use this config; it’s fixed in newer Python versions shipped by conda.If you’re using an IDE or a notebook that’s not started from the command line, you should be able to set the
CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
environment variable globally, e.g. https://www.minitool.com/news/environment-variables-windows-10-005.htmlThis helped guide the way. Thank you.
Also :
I had this issue (in conda) due to (apparently) incompatible scipy/numpy/Python versions:
@rgommers thanks for your reply, works for me.
As a post at https://linuxtut.com/en/d4f5452fab5b59b67f39/ says this environment variable should set when load wrong dll from Windows/System32 folder.
But seems this issue is a different situation. Could you please explain how this set works for scipy? Thanks.
I mean there are many dlls under site-packages why only import scipy failed (as I know)?
same error with scipy 1.7.3 + miniconda + conda 4.11.0 + python 3.8.12
@baccandr can you try if
export CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
fixes this for you?xref https://github.com/scipy/scipy/issues/11062#issuecomment-912921620, seems related (but not identical).