Incubator-mxnet: ImportError: cannot import name gluon when import mxnet

Created on 19 Jul 2017  路  6Comments  路  Source: apache/incubator-mxnet

For bugs or installation issues, please provide the following information.
The more information you provide, the more likely people will be able to help you.

Environment info

Operating System:Ubuntu14.04

Compiler:g++/nvcc

Package used (Python/R/Scala/Julia):python

MXNet version:0.10.0

Or if installed from source:yes

MXNet commit hash (git rev-parse HEAD):bd5df7ce0f52065ed813cc6b97e94e0f75e9b5e6

If you are using python package, please provide

Python version and distribution: 2.7.6

If you are using R package, please provide

R sessionInfo():

Error Message:

Please paste the full error message, including stack trace.

import mxnet
/usr/lib/python2.7/dist-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9
warnings.warn(_msg, ModuleDeprecationWarning)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/mxnet-0.10.1-py2.7.egg/mxnet/__init__.py", line 63, in
from . import gluon
ImportError: cannot import name gluon

Most helpful comment

or you can change in setup.py :

      packages=[
          'mxnet', 'mxnet.module', 'mxnet._ctypes', 'mxnet.rnn',
          'mxnet._cy2', 'mxnet._cy3', 'mxnet.notebook', 'mxnet.contrib',
          ],

by

      packages=[
          'mxnet', 'mxnet.module', 'mxnet._ctypes', 'mxnet.rnn',
          'mxnet._cy2', 'mxnet._cy3', 'mxnet.notebook', 'mxnet.contrib',
          'mxnet.gluon', 'mxnet.gluon.nn', 'mxnet.gluon.rnn'
          ],

It should work

All 6 comments

I fixed the issue by copying the directory gluon/ to python searching path.
I think it should be fixed in the python setup.py.

if you add mxnet/python folder in PYTHONPATH instead of running setup.py it will work
that must be an issu in setup.py

or you can change in setup.py :

      packages=[
          'mxnet', 'mxnet.module', 'mxnet._ctypes', 'mxnet.rnn',
          'mxnet._cy2', 'mxnet._cy3', 'mxnet.notebook', 'mxnet.contrib',
          ],

by

      packages=[
          'mxnet', 'mxnet.module', 'mxnet._ctypes', 'mxnet.rnn',
          'mxnet._cy2', 'mxnet._cy3', 'mxnet.notebook', 'mxnet.contrib',
          'mxnet.gluon', 'mxnet.gluon.nn', 'mxnet.gluon.rnn'
          ],

It should work

This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks!
Also, do please check out our forum (and Chinese version) for general "how-to" questions.

im getting this error ..can anyone help.......

ImportError: cannot import name 'nd' from 'mxnet' (unknown location)

@praniidabomb your installation is likely faulty. Try uninstalling all versions of mxnet you have (pip uninstall mxnet)

Was this page helpful?
0 / 5 - 0 ratings