ImportError: cannot import name 'np'

Hi,

I’m trying to run the code here, but it doesn’t work. Specifically, I ran this code cell in a Jupyter notebook:

%matplotlib inline
import d2l
from mxnet import gluon, image, np, npx
import os

and I got the following error:

ImportError: cannot import name 'np'

I’m running the latest NVIDIA Docker image for MXNet. My Dockerfile is extremely simple:

FROM nvcr.io/nvidia/mxnet:19.10-py3

# omitted: proxy stuff

RUN apt-get update -y

RUN pip3 install git+https://github.com/d2l-ai/d2l-en@numpy2

# omitted: certificates stuff
# omitted: generate a password for Jupyter

WORKDIR /

EXPOSE 8888

CMD ["jupyter", "notebook", "--allow-root", "--ip=0.0.0.0"]

My enviroment:

Ubuntu 18.04.3 LTS
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
Python 3.6.8

Can you help me? Thanks

np will be supported in 1.6.0, now it is available via nightly build version:

Can you try
pip install mxnet==1.6.0b20190915

Hi,

I’m having a similar issue. I have installed mxnet (version 1.6.0b20190915) but I get this error:
cannot import name ‘npx’ from ‘mxnet’

And my mxnet version is 1.6.0 using (mxnet.version).

Any ideas?

At the moment DeepNumPy (mxnet.np and mxnet.npx) is not available on Windows.

for Windows you can install mxnet with numpy API by pip install mxnet --pre