Sushant Singh
Sushant Singh

Reputation: 11

"OSError: [WinError 126] The specified module could not be found" while importing mxnet library

After installing below packages on Windows 8.1 CPU 64-bit using conda command: "conda install mxnet", I am getting error (OSError: [WinError 126] The specified module could not be found) while importing mxnet library.

Packages installed:

_mutex_mxnet: 0.0.40-mkl
libmxnet:     1.2.1-mkl_h0aaf724_1
mxnet:        1.2.1-h8cc8929_0
py-mxnet:     1.2.1-py36hcd68555_0

Also, popup window OS error appears while executing the import command with OS error description: "The program can't start because tiff.dll is missing from your computer.

Please note that tiff.dll file is already present in my folder "C:\Users\XX\AppData\Local\Continuum\anaconda3\pkgs\libtiff-4.0.9-hb8ad9f9_1\Library\bin" and have also tried re-installing the mxnet package but unfortunately problem is still not solved. Also, i already tried to searched similar issue on stackflow but couldn't find any relevant solution. Kindly help to resolve the issue.

PFB my code and error message.

from __future__ import print_function
import numpy as np
import mxnet as mx
from mxnet import nd, autograd, gluon

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-32-4901168cc2e7> in <module>()
      1 from __future__ import print_function
      2 import numpy as np
----> 3 import mxnet as mx
      4 from mxnet import nd, autograd, gluon

~\AppData\Local\Continuum\anaconda3\lib\site-packages\mxnet\__init__.py in <module>()
     23 
     24 from .context import Context, current_context, cpu, gpu
---> 25 from . import engine
     26 from .base import MXNetError
     27 from . import base

~\AppData\Local\Continuum\anaconda3\lib\site-packages\mxnet\engine.py in <module>()
     21 
     22 import ctypes
---> 23 from .base import _LIB, check_call
     24 
     25 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\mxnet\base.py in <module>()
    111 __version__ = libinfo.__version__
    112 # library instance of mxnet
--> 113 _LIB = _load_lib()
    114 
    115 # type definitions

~\AppData\Local\Continuum\anaconda3\lib\site-packages\mxnet\base.py in _load_lib()
    103     """Load library by searching possible path."""
    104     lib_path = libinfo.find_lib_path()
--> 105     lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
    106     # DMatrix functions
    107     lib.MXGetLastError.restype = ctypes.c_char_p

~\AppData\Local\Continuum\anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    346 
    347         if handle is None:
--> 348             self._handle = _dlopen(self._name, mode)
    349         else:
    350             self._handle = handle

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

Upvotes: 0

Views: 3068

Answers (2)

Sushant Singh
Sushant Singh

Reputation: 11

Thanks for your response Sina. Yes, I already tried re-installing with pip but it doesn't help. However, I managed to solve the problem by overriding my environment path using below code. Thus, there seems to be some issue with retrieving environments path details which i already added correctly both in system as well as in account variables settings.

import os
os.environ["PATH"] += os.pathsep + 'C:/Users/XX/AppData/Local/Continuum/anaconda3/Library/mingw-w64/bin'

Upvotes: 1

Sina Afrooze
Sina Afrooze

Reputation: 980

Can you try using the pip package instead of the conda package? Conda package is a package created by Anaconda, not the Apache MXNet community.

Upvotes: 0

Related Questions