I'm trying to install and use Pillow with Python 3.9.2 (managed with pyenv). I'm using Poetry to manage my virtual environments and dependencies, so I ran poetry add pillow, which successfully added Pillow = "^8.2.0" to my pyproject.toml. Per the Pillow docs, I added from PIL import Image in my script, but when I try to run it, I get:
File "<long/path/to/file.py>", line 3, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
When I look in the venv Poetry is creating for me, I can see a PIL directory (/long/path/lib/python3.9/site-packages/PIL/) and an Image.py file inside it.
What am I missing here? I've tried:
from pil import Image per this; did not workAny help would be tremendously appreciated.
I couldn't find a way to solve this either (using poetry 1.1.13).
Ultimately, I resorted to a workaround of poetry add pillow && pip install pillow so I could move on with my life. :P
poetry add pillow gets the dependency in to the TOML, so consumers of the package should be OK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With