Reputation: 11
I have installed PIL, but I keep getting the following error message:
'module' object has no attribute 'imread'.
I have gone through all posts regarding imread
, but have had no luck. Any thoughts?
Danys-MacBook-Pro:~ danymeneses$ python
/Users/danymeneses/Desktop/autoencoder/main.py --dataset
/Users/danymeneses/Desktop/autoencoder/dataseti --is_train True
{'batch_size': 12,
'beta1': 0.5,
'checkpoint_dir': 'checkpoint',
'dataset': '/Users/danymeneses/Desktop/autoencoder/dataseti',
'epoch': 5,
'image_size': 108,
'is_crop': False,
'is_run': False,
'is_train': True,
'learning_rate': 0.0002,
'noise': 0.5,
'output_dir': 'output',
'sample_dir': 'samples',
'train_size': inf}
WARNING:tensorflow:Passing a `GraphDef` to the SummaryWriter is deprecated.
Pass a `Graph` object instead, such as `sess.graph`.
Traceback (most recent call last):
File "/Users/danymeneses/Desktop/autoencoder/main.py", line 94, in <module>
tf.app.run()
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py",
line 30, in run
sys.exit(main(sys.argv))
File "/Users/danymeneses/Desktop/autoencoder/main.py", line 75, in main
autoencoder.train(FLAGS)
File "/Users/danymeneses/Desktop/autoencoder/model.py", line 186, in train
sample = [get_image(sample_file, self.image_size, is_crop=self.is_crop) for
sample_file in sample_files]
File "/Users/danymeneses/Desktop/autoencoder/utils.py", line 23, in get_image
return transform(imread(image_path), image_size, is_crop)
File "/Users/danymeneses/Desktop/autoencoder/utils.py", line 38, in imread
return scipy.misc.imread(path).astype(np.float)
AttributeError: 'module' object has no attribute 'imread'
Upvotes: 0
Views: 2979
Reputation: 49
Although I did not have to apply what you specified above, knowing that different version running on the same computer could create the issue helped me to fix the issue. Yes, I had to tell Jupyter notebook that the kernel version is Python 3 by changing the value in the kernel menu and then restarted and ta.
Upvotes: 0
Reputation: 11
Thanks for your replies guys! I solved my problem: i didn't notice that i had more than one version of python installed, so i just went like this:
python2.7 /Users/danymeneses/Desktop/autoencoder/main.py --dataset
/Users/danymeneses/Desktop/autoencoder/datasetii --is_train True
specifying the version of python i was using solved my problem, since pip install Pillow didn't of course install Pillow on all versions of Python.
thanks again!
Upvotes: 1