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

Can't run example code with Python 3 #3995

Closed
forcecore opened this issue Nov 27, 2016 · 5 comments
Closed

Can't run example code with Python 3 #3995

forcecore opened this issue Nov 27, 2016 · 5 comments

Comments

@forcecore
Copy link

forcecore commented Nov 27, 2016

Python example code can't be run, as they are written with Python 2.

Steps to reproduce: just run with Python 3

{ image-classification } » python3 train_mnist.py
2016-11-27 01:37:30,367 Node[0] start with arguments Namespace(batch_size=128, data_dir='mnist/', gpus=None, kv_store='local', load_epoch=None, lr=0.1, lr_factor=1, lr_factor_epoch=1, model_prefix=None, network='mlp', num_epochs=10, num_examples=60000, save_model_prefix=None)
Traceback (most recent call last):
File "train_mnist.py", line 161, in
train_model.fit(args, net, get_iterator(data_shape))
File "D:\work\tmp\mxnet-master\example\image-classification\train_model.py", line 51, in fit
(train, val) = data_loader(args, kv)
File "train_mnist.py", line 89, in get_iterator_impl
_download(data_dir)
File "train_mnist.py", line 17, in _download
urllib.urlretrieve("http://data.mxnet.io/mxnet/data/mnist.zip", zippath)
AttributeError: module 'urllib' has no attribute 'urlretrieve'

This is because Python 3 no longer has urllib.

http://stackoverflow.com/questions/17960942/attributeerror-module-object-has-no-attribute-urlretrieve

please, migrate to Python 3! It is painful to have 2 and 3 on the system, especially on Windows.

@piiswrong
Copy link
Contributor

We won't migrate to py3 but will try to keep python 2/3 compatibility.
You are welcome to submit a PR to make it compatible with python 2 and 3.

Otherwise, we'll try to find someone to fix it.
@nswamy @leopd do you have time to take a look?

@leopd
Copy link
Contributor

leopd commented Nov 27, 2016

Thanks for bringing the py3 incompatibility to our attention. I'd also like to make sure everything workings with py3, and can take a look at this issue later in the week.

@giorgioercixu
Copy link
Contributor

this should be already fixed by #3999

@forcecore
Copy link
Author

~/work/mxnet/example/image-classification/train_mnist.py works now :)

Still, there are more scripts with print operators.
{ rcnn } master » python3 -u train_end2end.py ~/work/mxnet/example/rcnn
File "train_end2end.py", line 51
print 'providing maximum shape', max_data_shape, max_label_shape

@yajiedesign
Copy link
Contributor

This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!

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

5 participants