0

Getting the below error when I run my python code. any suggestions?

Traceback (most recent call last):
  File "C:\Users\User\OneDrive\Desktop\crop recommend Final\app.py", line 11, in <module>
    from torchvision import transforms
  File "C:\Users\User\OneDrive\Desktop\crop recommend Final\venv\lib\site-packages\torchvision\__init__.py", line 6, in <module>
    from torchvision import datasets, io, models, ops, transforms, utils
  File "C:\Users\User\OneDrive\Desktop\crop recommend Final\venv\lib\site-packages\torchvision\datasets\__init__.py", line 1, in <module>
    from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
  File "C:\Users\User\OneDrive\Desktop\crop recommend Final\venv\lib\site-packages\torchvision\datasets\_optical_flow.py", line 10, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

enter image description here

Nidew
  • 347
  • 1
  • 7
  • 20
  • 1
    Did you `pip install Pillow`? – SuperStormer Apr 06 '23 at 03:13
  • yes I run this in my terminal it says .. Requirement already satisfied: Pillow in c:\users\user\onedrive\desktop\crop recommend final\venv\lib\site-packages (9.5.0) – Nidew Apr 06 '23 at 03:14
  • anything else I should try? – Nidew Apr 06 '23 at 03:22
  • Install `Pillow` outside the `venv` and execute the file to ensure it's not a problem due to `venv`, then try checking the [Official Page](https://pillow.readthedocs.io/en/latest/installation.html) – Bibhav Apr 06 '23 at 03:31
  • I didnt get what u saying. Outside the venv means where? Can you please explain – Nidew Apr 06 '23 at 07:48
  • does `pip install image` help? see https://stackoverflow.com/questions/8863917/importerror-no-module-named-pil for further ideas. – Christian Karcher Apr 06 '23 at 08:36

0 Answers0