2

I installed mxnet in linux mint. I use anaconda for python 3.5. I followed the instruction and it was successfully installed. Both mxnet and the anaconda are latest version. However, when I tried the code:

import mxnet as mx
res = mx.nd.array([1,2,3])

I got the error:

AttributeError: module 'mxnet' has no attribute 'nd'

if I typed mx, I got: <module 'mxnet' (namespace)>

after repeating the installation and checking the scripts, I saw mxnet was installed under python 2.7, and graphviz is also under python 2.7. How can change them to python 3.5?

pfnuesel
  • 14,093
  • 14
  • 58
  • 71
fffly
  • 23
  • 1
  • 4

4 Answers4

2

Working for MXNet python 3 is still in progress. Some functions are not fully tested yet.

At this time I suggest using python 2.7.

kevinthesun
  • 336
  • 1
  • 5
2

It should work in Python 3 environments.

I've installed MXNet in one easy set with pip3 in a python environment.

Everything works well.

Missing are some MXNet python API's advertised in the documentation, which are absent in the distribution and look absent in the current head of the repository as well.

So, I would not currently depend on the tutorial or example documentation -- they seem to be outdated or ahead of the repository. They cannot always guide you properly although in order to rescue yourself from particular situations reading the actual API documentation might help.

1

Anaconda Python 3.5 works fine for MXNet. See evidence below.

$ which python
/Users/username/anaconda3/bin/python

$ python --version
Python 3.5.2 :: Anaconda 4.2.0 (x86_64)

$ python
Python 3.5.2 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:52:12) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mxnet as mx
>>> res = mx.nd.array([1,2,3])
>>> print(res)
<NDArray 3 @cpu(0)>
>>> print(res.asnumpy())
[ 1.  2.  3.]
>>> mx
<module 'mxnet' from '/Users/username/anaconda3/lib/python3.5/site-packages/mxnet-0.9.5-py3.5.egg/mxnet/__init__.py'>

The Python API documentation has been updated in newer releases. See: https://github.com/dmlc/mxnet/releases

0

When you use Anaconda3 with Python3 and MXNet, the installation process might get a bit cumbersome.

In my case, after following the installation steps and executing python setup.py install - I had to manually copy python/mxnet files into the ~/Anaconda3/Lib/site-packages/mxnet*../

Before I copied the files, I've seen the same error module 'mxnet' has no attribute 'nd'

Stanley Kirdey
  • 602
  • 5
  • 20