Humayun Ahmad Rajib
Humayun Ahmad Rajib

Reputation: 1560

Can not import fastai [WinError 126] The specified module could not be foun

Firstly I run the following command: conda install -c pytorch -c fastai fastai. After finishing install. I import this:

from fastai.imports import *

I got an error like this:

Traceback (most recent call last):

  File "C:\Users\acer\Desktop\Reddit Bot\demo.py", line 70, in <module>
    from fastai.imports import *

  File "C:\Users\acer\anaconda3\lib\site-packages\fastai\imports\__init__.py", line 2, in <module>
    from .torch import *

  File "C:\Users\acer\anaconda3\lib\site-packages\fastai\imports\torch.py", line 1, in <module>
    import torch, torch.nn.functional as F

  File "C:\Users\acer\anaconda3\lib\site-packages\torch\__init__.py", line 81, in <module>
    ctypes.CDLL(dll)

  File "C:\Users\acer\anaconda3\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)

OSError: [WinError 126] The specified module could not be found

I watch some post on stackoverflow but can't solve this. How can I solve this? Please help me.

Upvotes: 0

Views: 545

Answers (1)

rubyruins
rubyruins

Reputation: 29

This probably happened if you, like me - are using a machine without a NVIDIA GPU card. conda install -c pytorch -c fastai fastai will install a version that uses the GPU.

To resolve this, I uninstalled pytorch and then conda installed the CPU version using conda install pytorch torchvision cpuonly -c pytorch. It worked for me! You can check the pytorch installation guide on the official website :)

Upvotes: 2

Related Questions