question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DLL load failure when importing after PyTorch

See original GitHub issue

My issue is about DLL load failure on Windows. We are using Anaconda. It is causing test jobs to fail at PyTorch: https://github.com/pytorch/pytorch/issues/40366. Currently, we are downgrading it to 1.4.1.

Reproducing code example:

pip install --pre scipy torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
python -c "import torch; from scipy import stats"

Error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Jenkins\Miniconda3\lib\site-packages\scipy\__init__.py", line 104, in <module>
    from . import _distributor_init
  File "C:\Jenkins\Miniconda3\lib\site-packages\scipy\_distributor_init.py", line 61, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Jenkins\Miniconda3\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

Scipy/Numpy/Python version information:

1.5.0 1.18.1 sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:29 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
pvcommented, Jun 27, 2020

The from . import __config__ could also be added to _distributor_init.py.

Also, the numpy-distutils submodule in scipy-wheels maybe needs to be bumped to recent numpy, so that the __config__.py snippet is updated, to use os.add_dll_directory on python3.8 instead of PATH manipulations.

Also, in numpy’s __init__.py, _distributor_init is imported after __config__, opposite to scipy. We probably should sync how all this works with Numpy.

0reactions
tylerjereddycommented, Jul 5, 2020

The Python 3.6 Windows DLL load issue should be fixed in the recently-released SciPy 1.5.1, based in part on the testing in pytorch CI cross-linked above.

I’ll close this tentatively, please feel free to open another issue if DLL handling still has problems in 1.5.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

from torch._C import * ImportError: DLL load failed: The ...
I've been encountering the same problem. Pytorch seems to require openmp, however this is not part of the PIP distribution. If you install ......
Read more >
Windows FAQ — PyTorch 1.13 documentation
_C import * ImportError: DLL load failed: The specified module could not be found. The problem is caused by the missing of the...
Read more >
Pytorch Error after installation
import torch. Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
Read more >
PyTorch compiled from source for Windows is failing when ...
dll and it seems it is in intel-openmp package and $(anaconda_install)\Library\bin. I have uninstalled intel-openmp but the problem is still ...
Read more >
I cannot use the pytorch that was built successfully from source
The error is caused by our poor support for MSVC OpenMP in detectron. Please build with MKL so Intel OpenMP will be used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found