Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

ImportError: cannot import name 'np' #15681

Closed
joyofdata opened this issue Jul 28, 2019 · 5 comments
Closed

ImportError: cannot import name 'np' #15681

joyofdata opened this issue Jul 28, 2019 · 5 comments

Comments

@joyofdata
Copy link

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

@mxnet-label-bot
Copy link
Contributor

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

@wkcn
Copy link
Member

wkcn commented Jul 29, 2019

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

@wkcn wkcn added the Question label Jul 29, 2019
@haojin2
Copy link
Contributor

haojin2 commented Jul 29, 2019

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

@vjache
Copy link

vjache commented Dec 7, 2019

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.

@wkcn
Copy link
Member

wkcn commented Dec 7, 2019

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.

@leezu leezu closed this as completed Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants