Incubator-mxnet: Unable to install MXNet with GPU support for python using pip

Created on 5 Sep 2017  路  4Comments  路  Source: apache/incubator-mxnet

I am trying to install MXNet for Python using pip having GPU support. I am following the instructions mentioned in this documentation. My OS is Ubuntu 16.04

After I install MXNet, I run the validation code mentioned in documentation. I get the error as stated below.

>>> import mxnet as mx
>>> a = mx.nd.ones((2,3), mx.gpu())
[17:26:19] src/c_api/c_api_ndarray.cc:147: GPU support is disabled. Compile MXNet with USE_CUDA=1 to enable GPU support.
[17:26:19] /home/travis/build/dmlc/mxnet-distro/mxnet-build/dmlc-core/include/dmlc/logging.h:308: [17:26:19] src/c_api/c_api_ndarray.cc:416: Operator _ones is not implemented for GPU.

Stack trace returned 10 entries:
[bt] (0) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(+0xec23c) [0x7f298299523c]
[bt] (1) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(+0xde7a52) [0x7f2983690a52]
[bt] (2) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(MXImperativeInvoke+0x254) [0x7f2983691544]
[bt] (3) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c) [0x7f299be918cc]
[bt] (4) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x165) [0x7f299be90a15]
[bt] (5) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x283) [0x7f299be88e43]
[bt] (6) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x96af) [0x7f299be806af]
[bt] (7) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(PyObject_Call+0x6a) [0x7f299de4aeca]
[bt] (8) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x36b6) [0x7f299df340d6]
[bt] (9) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(+0x15dbd6) [0x7f299df3abd6]

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/ndarray.py", line 1216, in ones
    return _internal._ones(shape=shape, ctx=ctx, dtype=dtype, **kwargs)
  File "<string>", line 15, in _ones
  File "/home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/_ctypes/ndarray.py", line 89, in _imperative_invoke
    c_array(ctypes.c_char_p, [c_str(str(val)) for val in vals])))
  File "/home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/base.py", line 129, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [17:26:19] src/c_api/c_api_ndarray.cc:416: Operator _ones is not implemented for GPU.

Stack trace returned 10 entries:
[bt] (0) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(+0xec23c) [0x7f298299523c]
[bt] (1) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(+0xde7a52) [0x7f2983690a52]
[bt] (2) /home/prasad/miniconda3/envs/myenv/lib/python3.5/site-packages/mxnet/libmxnet.so(MXImperativeInvoke+0x254) [0x7f2983691544]
[bt] (3) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c) [0x7f299be918cc]
[bt] (4) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x165) [0x7f299be90a15]
[bt] (5) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x283) [0x7f299be88e43]
[bt] (6) /home/prasad/miniconda3/envs/myenv/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x96af) [0x7f299be806af]
[bt] (7) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(PyObject_Call+0x6a) [0x7f299de4aeca]
[bt] (8) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x36b6) [0x7f299df340d6]
[bt] (9) /home/prasad/miniconda3/envs/myenv/bin/../lib/libpython3.5m.so.1.0(+0x15dbd6) [0x7f299df3abd6]


However, if I change the context to CPU, the code runs properly. Please can somebody tell me how to install MXNet having GPU support.

Thanks in advance.

Most helpful comment

@szha Thanks for the reply.
I looked into it. The main problem was I had installed previously MXNet using pip install mxnet command. On top of that I had installed the CUDA version MXNet which was the reason why context of mx.gpu() was not working. I uninstalled both the versions of MXNet and then installed the CUDA version and then it has started working.

Thanks for the help again.

All 4 comments

Could you paste the command you used when installing from pip and the output of that command?

@szha Thanks for the reply.
I looked into it. The main problem was I had installed previously MXNet using pip install mxnet command. On top of that I had installed the CUDA version MXNet which was the reason why context of mx.gpu() was not working. I uninstalled both the versions of MXNet and then installed the CUDA version and then it has started working.

Thanks for the help again.

Thanks for sharing the findings.

I got the same issue. I use CUDA=8.0. you should install mxnet cuda version by pip with the specific mxnet version number. You may have to uninstall current mxnet before installing below mxnet version.

pip install mxnet-cu80==0.11.0

https://mxnet.incubator.apache.org/get_started/install.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phunterlau picture phunterlau  路  3Comments

yuconglin picture yuconglin  路  3Comments

seongkyun picture seongkyun  路  3Comments

xzqjack picture xzqjack  路  3Comments

dushoufu picture dushoufu  路  3Comments