Incubator-mxnet: ImportError: cannot import name 'np'

Created on 28 Jul 2019  Β·  5Comments  Β·  Source: apache/incubator-mxnet

Description

I installed mxnet with sudo pip3 install mxnet but I cannot import np or npx from mxnet. Importing mxnet itself works.

Environment info (Required)

➜  ~ python3 diagnose.py                                                                                                                                                                                                                                                  
----------Python Info----------                                                                                                                                                                                                                                           
Version      : 3.6.8                                                                                                                                                                                                                                                      
Compiler     : GCC 8.0.1 20180414 (experimental) [trunk revision 259383                                                                                                                                                                                                   
Build        : ('default', 'Jan 14 2019 11:02:34')                                                                                                                                                                                                                        
Arch         : ('64bit', 'ELF')                                                                                                                                                                                                                                           
------------Pip Info-----------                                                                                                                                                                                                                                           
Version      : 18.1                                                                                                                                                                                                                                                       
Directory    : /usr/local/lib/python3.6/dist-packages/pip                                                                                                                                                                                                                 
----------MXNet Info-----------                                                                                                                                                                                                                                           
Version      : 1.5.0                                                                                                                                                                                                                                                      
Directory    : /usr/local/lib/python3.6/dist-packages/mxnet                                                                                                                                                                                                               
Commit Hash   : 75a9e187d00a8b7ebc71412a02ed0e3ae489d91f                                                                                                                                                                                                                  
Library      : ['/usr/local/lib/python3.6/dist-packages/mxnet/libmxnet.so']                                                                                                                                                                                               
Build features:                                                                                                                                                                                                                                                           
βœ– CUDA                                                                                                                                                                                                                                                                    
βœ– CUDNN                                                                                                                                                                                                                                                                   
βœ– NCCL                                                                                                                                                                                                                                                                    
βœ– CUDA_RTC                                                                                                                                                                                                                                                                
βœ– TENSORRT                                                                                                                                                                                                                                                                
βœ” CPU_SSE                                                                                                                                                                                                                                                                 
βœ” CPU_SSE2                                                                                                                                                                                                                                                                
βœ” CPU_SSE3                                                                                                                                                                                                                                                                
βœ” CPU_SSE4_1                                                                                                                                                                                                                                                              
βœ” CPU_SSE4_2
βœ– CPU_SSE4A
βœ” CPU_AVX
βœ– CPU_AVX2
βœ– OPENMP
βœ– SSE
βœ” F16C
βœ– JEMALLOC
βœ– BLAS_OPEN
βœ– BLAS_ATLAS
βœ– BLAS_MKL
βœ– BLAS_APPLE
βœ” LAPACK
βœ– MKLDNN
βœ” OPENCV
βœ– CAFFE
βœ– PROFILER
βœ” DIST_KVSTORE
βœ– CXX14
βœ– INT64_TENSOR_SIZE
βœ” SIGNAL_HANDLER
βœ– DEBUG
----------System Info----------
Platform     : Linux-4.15.0-55-generic-x86_64-with-LinuxMint-19.1-tessa
system       : Linux
node         : raffael-ThinkPad-T450
release      : 4.15.0-55-generic
version      : #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019
----------Hardware Info----------
machine      : x86_64
processor    : x86_64
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               61
Model name:          Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Stepping:            4
CPU MHz:             2074.164
CPU max MHz:         2900,0000
CPU min MHz:         500,0000
BogoMIPS:            4589.41
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            3072K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap intel_pt xsaveopt dtherm ida arat pln pts md_clear flush_l1d
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0140 sec, LOAD: 3.4517 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0355 sec, LOAD: 0.8834 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0540 sec, LOAD: 0.8669 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0452 sec, LOAD: 1.2886 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0192 sec, LOAD: 0.5317 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0009 sec, LOAD: 0.0582 sec.

Error Message:

ImportError                               Traceback (most recent call last)
<ipython-input-3-a155cea35485> in <module>
----> 1 from mxnet import np

ImportError: cannot import name 'np'

Minimum reproducible example

from mxnet import np

Most helpful comment

The numpy branch has not been merged into the master branch yet.
You can install MXNet with numpy api in http://numpy.mxnet.io/

Update:
The message is outdate. Please install nightly version, such as β€˜pip install mxnet-cu100mkl β€”pre’.

https://mxnet.apache.org/get_started?version=v1.5.1&platform=linux&language=python&environ=pip&processor=cpu

All 5 comments

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended labels: Installation

The numpy branch has not been merged into the master branch yet.
You can install MXNet with numpy api in http://numpy.mxnet.io/

Update:
The message is outdate. Please install nightly version, such as β€˜pip install mxnet-cu100mkl β€”pre’.

https://mxnet.apache.org/get_started?version=v1.5.1&platform=linux&language=python&environ=pip&processor=cpu

@joyofdata Were you able to get the numpy-compatible version according to instructions on http://numpy.mxnet.io/?

The numpy branch has not been merged into the master branch yet.
You can install MXNet with numpy api in http://numpy.mxnet.io/

No, you can't, for Windows.

Hi @vjache , I replied the issue in the early date(July 29), when the NumPy branch was not merged into the master branch.
Recently, it is available to install MXNet with numpy-like API, on Windows, by β€˜pip install mxnet β€”pre’. If it can’t yet, welcome to.submit an issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zhaoyang-XU picture Zhaoyang-XU  Β·  3Comments

luoruisichuan picture luoruisichuan  Β·  3Comments

JonBoyleCoding picture JonBoyleCoding  Β·  3Comments

Shiro-LK picture Shiro-LK  Β·  3Comments

xzqjack picture xzqjack  Β·  3Comments