vision: ImportError: DLL load failed on Windows

I have a dll load failed the specified module could not be found error when importing torchvision

PyTorch stable 1.1:

C:\Windows\system32>python -m pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl
Collecting torch==1.1.0 from https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl
  Using cached https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl
Requirement already satisfied: numpy in c:\python37\lib\site-packages (from torch==1.1.0) (1.16.4+mkl)
Installing collected packages: torch
Successfully installed torch-1.1.0

C:\Windows\system32>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
>>> exit()

Nightly:


C:\Windows\system32>python -m pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html
Looking in links: https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html
Collecting torch_nightly
  Using cached https://download.pytorch.org/whl/nightly/cu100/torch_nightly-1.1.0.dev20190612-cp37-cp37m-win_amd64.whl
Installing collected packages: torch-nightly
Successfully installed torch-nightly-1.1.0.dev20190612

C:\Windows\system32>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\site-packages\torchvision\__init__.py", line 1, in <module>
    from torchvision import models
  File "C:\Python37\lib\site-packages\torchvision\models\__init__.py", line 11, in <module>
    from . import detection
  File "C:\Python37\lib\site-packages\torchvision\models\detection\__init__.py", line 1, in <module>
    from .faster_rcnn import *
  File "C:\Python37\lib\site-packages\torchvision\models\detection\faster_rcnn.py", line 7, in <module>
    from torchvision.ops import misc as misc_nn_ops
  File "C:\Python37\lib\site-packages\torchvision\ops\__init__.py", line 1, in <module>
    from .boxes import nms, box_iou
  File "C:\Python37\lib\site-packages\torchvision\ops\boxes.py", line 2, in <module>
    from torchvision import _C
ImportError: DLL load failed: La procédure spécifiée est introuvable.
>>>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 25 (10 by maintainers)

Most upvoted comments

cuda10:conda install pytorch torchvision cudatoolkit=10.0 -c pytorch cuda9:conda install pytorch torchvision cudatoolkit=9.0 -c pytorch none cuda:conda install pytorch-cpu torchvision-cpu -c pytorch

@anemes Yes, that’s because we didn’t upload torchvision 0.4.0 for Windows. I’ll tell you when it’s ready.

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch worked for me. I’m using latest version on anconda for windows, thks for th workaround.

Yes, please.

I am encountering the same issue with

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

when I run: from torchvision import datasets, transforms

C:\ProgramData\Anaconda3\lib\site-packages\torchvision\ops\boxes.py in <module>()
      1 import torch
----> 2 from torchvision import _C
      3 
      4 
      5 def nms(boxes, scores, iou_threshold):

ImportError: DLL load failed: The specified module could not be found.

@plammens yes, that seems to be the case. But we might need to make some modifications in torchvision so that this works, see https://github.com/pytorch/vision/issues/1075

@Jonas1312 Not needed anymore. See what I said in the last post.