dmlc / minpy

NumPy interface with mixed backend execution
https://minpy.readthedocs.io/en/latest/
Other
1.11k stars 112 forks source link

Can not import minpy in Python 2.7 (anaconda): Type "MXNet" for name "reshape" has already existed #163

Closed rguo12 closed 7 years ago

rguo12 commented 7 years ago

Hi,

I just installed minpy with pip install minpy, but the import failed and returned this message. Could I fix this by doing something? I am with MXnet 0.9.4 on Python 2.7.13 (Anaconda), CUDA 8.0 and cudnn 5.1 and they work together.

import minpy Traceback (most recent call last): File "", line 1, in File "/home/ruocheng/anaconda2/lib/python2.7/site-packages/minpy/init.py", line 17, in from . import numpy # pylint: disable= wrong-import-position File "/home/ruocheng/anaconda2/lib/python2.7/site-packages/minpy/numpy/init.py", line 22, in numpy, name='numpy injector', injected_type={float, int, type(None), type})) File "/home/ruocheng/anaconda2/lib/python2.7/site-packages/minpy/numpy/mocking.py", line 56, in init mod.register_primitives(self._registry, primitive_wrapper) File "/home/ruocheng/anaconda2/lib/python2.7/site-packages/minpy/array_variants/mxnet/mxnet_core.py", line 104, in register_primitives reg.register('reshape', prim_wrapper(NDArray.reshape)) File "/home/ruocheng/anaconda2/lib/python2.7/site-packages/minpy/dispatch/registry.py", line 48, in register prim.typestr, name)) minpy.dispatch.registry.PrimitiveRegistryError: Type "MXNet" for name "reshape" has already existed

lryta commented 7 years ago

Please install MXNet's engine branch to properly use minpy.

rguo12 commented 7 years ago

Hi Larry, thanks for your fast response, I wonder how should I properly do this as I already have mxnet installed in ~/mxnet? As I don't quite understand the relationship between mxnet and the engine branch, I just cloned the engine branch in ~/mxnet_engine/ and ran make according to the minpy intallation instruction tutorial, no problem happened here.

In .bashrc, I have both export PYTHONPATH=.../mxnet/python:PYTHONPATH export PYTHONPATH=.../mxnet_engine/python:PYTHONPATH

Then I failed in run ~/mxnet_engine/python/setup.py install it throws:

Traceback (most recent call last): File "/home/ruocheng/mxnet_engine/mxnet/python/setup.py", line 72, in ext_modules=config_cython()) File "/home/ruocheng/mxnet_engine/mxnet/python/setup.py", line 43, in config_cython for fn in os.listdir(path): OSError: [Errno 2] No such file or directory: 'mxnet/cython'

Thank you~

lryta commented 7 years ago

Once PYTHONPATH is set up, you do not need to install through setup.py. You are good to go.

rguo12 commented 7 years ago

Thanks Larry, it works now.

samuel-davis commented 6 years ago

Where is this build branch it appears to be gone.