Davis8988
Davis8988

Reputation: 418

Ubuntu - Error while running program in python: "ImportError: No module named mxnet"

I am trying to install the new MXNet from
validate-mxnet-installation.
I followed the instructions
(I chose options Linux->python->GPU->pip ) as you can see on the website and they were:

  1. install cuda8 from nvidia website
  2. install cuDNN 5 library
  3. update paths "PATH" and "LD_LIBRARY_PATH" in bashrc file
  4. install pip using these bunch of lines:

    $ sudo apt-get update
    $ sudo apt-get install -y wget python
    $ wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py    
    
  5. install the MXNet by: $ pip install mxnet-cu80
  6. validate the installation. I'm stuck here

To validate I was required to run the following:

  1. open terminal and type python to start python
  2. type the following:

    import mxnet as mx
    a = mx.nd.ones((2, 3), mx.gpu())
    b = a * 2 + 1
    b.asnumpy()
    array([[ 3.,  3.,  3.],
           [ 3.,  3.,  3.]], dtype=float32)  
    

I am getting the following error when I try to run the above:

 >>> import mxnet as mx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mxnet   

I'm kind of lost.. Does anyone know what should I do?

Upvotes: 3

Views: 7989

Answers (2)

M. Mortazavi
M. Mortazavi

Reputation: 95

Use common Linux repo installation applications like apt-get or yum to install pip3 (for Python 3) or pip (for Python 2). I use the former.

Use pip3 to install MXNet according to installation instruction.

You will also need some other packages which you can install through pip3.

It is best to create a specific Python environment and activate the environment before using pip3 inside it.

This way, you can have isolated installation in those environments.

Upvotes: 0

Davis8988
Davis8988

Reputation: 418

I figured what the problem was:
mxnet wasn't installed correctldue to lack of premissions.

In step 5 need to type: sudo pip install mxnet-cu80 instead of just
"pip install mxnet-cu80 "

Thanks everyone

Upvotes: 2

Related Questions