Open mahernadar opened 7 years ago
I encounter the exact same problem! DId you manage to find the solution? Thanks
I also encounter the exact same prolem , is anyone have solution ?
I am having the same error . is there any solution?
One of these did the trick:
pip install --upgrade tensorflow keras numpy pandas sklearn pillow
I would assume tensorflow or keras.
I think something is related to the O/S , which os you're using ?
On Feb 4, 2018 5:48 AM, "Neil Greisman" notifications@github.com wrote:
One of these did the trick:
pip install --upgrade tensorflow keras numpy pandas sklearn pillow
I would assume tensorflow or keras.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/asataniAIR/Image_DL_Tutorial/issues/4#issuecomment-362868430, or mute the thread https://github.com/notifications/unsubscribe-auth/AgwmTjPeC7KPmQj1TKD45EwRJGNApZgXks5tRPdNgaJpZM4OQBWt .
My answer above was not clear. I was getting the same error message and fixed it with the pip upgrade above (Ubuntu).
anyone got the solution so far?
I solved this problem. I just did not have sklearn package. So I enter 'pip install --upgrade tensorflow keras numpy pandas sklearn pillow' on anaconda prompt, and add 'from sklearn.preprocessing import LabelEncoder' in python code instead 'from PIL import Image'. It works to me!
In my case pip install pillow was the solution. o_O!
I originally was still having a similar issue after running pip install pillow
until I realized I had to deactivate and reactivate my environment, for the case anyone else forgets to do this step
pip install --upgrade tensorflow keras numpy pandas sklearn pillow
This worked for me.
I did
pip install --upgrade tensorflow keras numpy pandas sklearn pillow
and after
import numpy as np
stopped working.
I got the error
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Thus I recommend not to use this command.
If you have the same problem as me, I suggest you do
conda list --revisions
conda install --revision [revision number]
where revision number is the number before the last command.
I did as @SuekyeongNam directed and it worked for me too.
Thanks.
uninstall pil or pillow both then install pillow package and re-run the environment and notebook worked for me.
I'm still getting the same error as above described. I tried all the method like:
None of the above methods worked for me. if anybody found any solution plz let me know.
'pip install --upgrade tensorflow keras numpy pandas sklearn pillow' This one worked! Thanks!
I originally was still having a similar issue after running
pip install pillow
until I realized I had to deactivate and reactivate my environment, for the case anyone else forgets to do this step
That is exactly, what solved it for me!
deactivating and activating work for me, i think so
pip install --upgrade tensorflow keras numpy pandas sklearn pillow conda deactivate conda activate tfenv
pip install --upgrade tensorflow keras numpy pandas sklearn pillow conda deactivate conda activate tfenv
Worked For Me. Thank you
In your environment -
pip install pillow
Restart kernel. (Works)
deactivate and activating the environment has worked for me
I installed Matplotlib on my Virtual Environment while still running the notebook in the background. Matplotlib imported without any errors on that notebook, but this error keep coming.
"ImportError: Could not import PIL.Image. The use of array_to_img
requires PIL"
Simply Deactivating and then activating that virtual environment worked for me.
Initially, I encountered the same issue after running pip install pillow. This worked for me pip install --upgrade tensorflow keras numpy pandas sklearn pillow
I have got this problem in 2023, ye~~ , 2023 with keras+tf in 2.8.0 I found some of the solution is to setup pillow, such as pip3 install pillow, I tried ,but it didn't work another solution is , en..., build the load_img function from PIL import Image
def load_img(img_path, target_size): image = Image.open(img_path) resize_img = image.resize(target_size) return resize_img
img = image.load_img(img_path, target_size=(224, 224)). => transit to img =load_img(img_path, target_size=(224, 224))
It works!
Dear Gents,
I am trying to fine-tune the VGG16 model in order to classify 5 classes, inspired by the link : https://gist.github.com/fchollet/7eb39b44eb9e16e59632d25fb3119975.
When i used to run it on my laptop, i was not encountering any problems.
However, i am currently using a virtual machine in order to access some university servers (it's faster as you may imagine).
The problem is that now i am encountering this Error:
Epoch 1/50 Exception in thread Thread-18: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/usr/lib/python3.4/threading.py", line 868, in run self._target(*self._args, *self._kwargs) File "/home/mnadar/tensorflow/lib/python3.4/site-packages/tensorflow/contrib/keras/python/keras/engine/training.py", line 615, in data_generator_task generator_output = next(self._generator) File "/home/mnadar/tensorflow/lib/python3.4/site-packages/tensorflow/contrib/keras/python/keras/preprocessing/image.py", line 804, in next return self.next(args, **kwargs) File "/home/mnadar/tensorflow/lib/python3.4/site-packages/tensorflow/contrib/keras/python/keras/preprocessing/image.py", line 1063, in next target_size=self.target_size) File "/home/mnadar/tensorflow/lib/python3.4/site-packages/tensorflow/contrib/keras/python/keras/preprocessing/image.py", line 361, in load_img raise ImportError('Could not import PIL.Image. ' ImportError: Could not import PIL.Image. The use of
array_to_img
requires PIL.ValueError Traceback (most recent call last)