apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

ImportError: cannot import name 'transforms' #15053

Open kaivu1999 opened 5 years ago

kaivu1999 commented 5 years ago

Description

Not able to import transforms from mxnet

Environment info

CuDNN 7.1.4 Cuda 9.2 Nvcc V9.2.148

Using pthon3 and pip freeze results in :

astroid==2.2.5
backcall==0.1.0
certifi==2019.3.9
chardet==3.0.4
cycler==0.10.0
decorator==4.4.0
graphviz==0.8.4
idna==2.8
ipython==7.5.0
ipython-genutils==0.2.0
isort==4.3.20
jedi==0.13.3
kiwisolver==1.1.0
lazy-object-proxy==1.4.1
matplotlib==3.0.3
mccabe==0.6.1
-e git+https://github.com/hpi-xnor/mxnet.git@468fa60788b1d8f210f9ab45a65611bb7524e339#egg=mxnet&subdirectory=python
mxnet-cu92==1.4.1
numpy==1.14.6
parso==0.4.0
pexpect==4.7.0
pickleshare==0.7.5
pkg-resources==0.0.0
prompt-toolkit==2.0.9
ptyprocess==0.6.0
Pygments==2.4.0
pylint==2.3.1
pyparsing==2.4.0
python-dateutil==2.8.0
requests==2.22.0
six==1.12.0
traitlets==4.3.2
typed-ast==1.3.5
urllib3==1.25.2
wcwidth==0.1.7
wrapt==1.11.1

The git repository which can be seen just above mxnet-cu92==1.4.1 is due to setting up bmxnet in the same environment.

from mxnet.gluon.data.vision import transforms

Error Message:

>>> from mxnet.gluon.data.vision import transforms
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'transforms'

I am not able to fix this?

mxnet-label-bot commented 5 years ago

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

kaivu1999 commented 5 years ago

I am able to get from mxnet import gluon

zachgk commented 5 years ago

@kaivu1999 Can you try checking what installation is being used for mxnet?:

from mxnet import gluon
print(gluon.__file__)

If you are using the bmxnet, it does not contain the gluon.data.vision.transforms.py file. It is an old fork of mxnet and the transforms which are here on master https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/gluon/data/vision/transforms.py are not present there https://github.com/hpi-xnor/BMXNet/tree/master/python/mxnet/gluon/data

kaivu1999 commented 5 years ago

Yeah I am have installed BMXnet as I want to use it. I installed mxnet first ofcourse, and then bmxnet in the same environment. Yeah I checked in an other virtual environment with only mxnet-cu92 installed it works !! So I can't use transforms while using in this particular environment ? Can something be done?

>>> from mxnet import gluon
>>> print(gluon.__file__)
/home/kaivalya/ntu_first/env/lib/python3.5/site-packages/mxnet/gluon/__init__.py
zachgk commented 5 years ago

Here are a few options that might work:

  1. You could try editing the package name of bmxnet so that it does not conflict with MXNet. Then, you could import mxnet as mx and bmxnet as bmx. You can then specify that the vision transforms come from MXNet proper and everything else comes from BMXNet. I don't know if you will run into weird errors due to differences between mxnet and bmxnet if you do this, though.
  2. You could try finding the commits from mxnet that added gluon.data.vision.transforms and cherry-picking them over to BMXNet.
  3. You could try git merging bmxnet and mxnet master. This is probably the most proper way, but I would bet this gives you a ton of horrible merge conflicts to work through.

It may also be worth raising this as an issue on the BMXNet repo to see if they have any other ideas.