1

I want to install mxnet with gpu. and used pip install mxnet-cu90. However, when I am importing the package I come across this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\__init__.py", line 24, in <module>
    from .context import Context, current_context, cpu, gpu, cpu_pinned
  File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\context.py", line 24, in <module>
    from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
  File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\base.py", line 213, in <module>
    _LIB = _load_lib()
  File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\base.py", line 204, in _load_lib
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
  File "C:\Users\Anuj\anaconda3\envs\py36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found 

I tried reinstalling by downloading .whl file from this but it didn't work. Its still giving the same error.

I am using python 3.6.12.

harry r
  • 786
  • 2
  • 6
  • 19
  • it may try to load some C/C++ library which you may have to install separatelly (but not with `pip`) – furas Apr 01 '21 at 20:12
  • Okay. How can I find out which library I have to install? – harry r Apr 02 '21 at 05:29
  • error gives you path to `mxnet\base.py` and you could open it and see in code what lirbraries it tries to load. Eventually you should check documentation on official page for `mxnet` and maybe they describe what else you have to install. – furas Apr 02 '21 at 13:05
  • 1
    I check official page for [mxnet](https://mxnet.apache.org) and on page [Get Started](https://mxnet.apache.org/versions/1.8.0/get_started?platform=linux&language=python&processor=gpu&environ=pip&) (after selecting what version I want to install) I shows: **CUDA should be installed first. Starting from version 1.8.0, CUDNN and NCCL should be installed as well.**. It also shows to check installed CUDA with `nvcc --version` – furas Apr 02 '21 at 13:09
  • Yes you are absolutely right. I did go through their documentation and downloaded Nvidia cuda 11.2 and then could run the command ```nvcc --version```. I also had cudatoolkit installed, but it still didn't work. I haven't heard about NCCL, I'll look into it again. – harry r Apr 02 '21 at 16:23

1 Answers1

2

I still don't know what was causing this problem but I solved by installing the package from conda.

First I created a brand new environment and used

conda install -c anaconda mxnet-mkl

Hopefully it works for you too.

harry r
  • 786
  • 2
  • 6
  • 19
  • `mkl` in name `mxnet-mkl` can means [Math Kernel Library](https://en.wikipedia.org/wiki/Math_Kernel_Library) created in C/C++ by Intel. And this could be your missing library. OR if you was installing `mxnet-cu90` then it would need library `cu90` which can means some `CUDA` library. – furas Apr 02 '21 at 13:02