Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

Problem with the PIL (pillow) library , ImportError: dlopen.... Reason: image not found

$
0
0

Actually this not a question , its the solution that worked for me and i wanted to help others that might have been throught the same experience.So i had a problem in anaconda that i didnt know the source of it , so i ended up having to reinstall everything , during the reinstallation i also had to reinstall the libraries that was one installed by the previous conda that i had ( libraries like : pandas, numpy , pillow ... ext ) , the problem is even tho i installed pillow using this command : conda install pillow ,and installed matplotlib i kept getting error when i try to call the matplotlib library:

   File ~/anaconda3/lib/python3.11/site-packages/PIL/Image.py:84     75 MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)     78 try:     79     # If the _imaging C module is not present, Pillow will not load.     80     # Note that other modules should not refer to _imaging directly;     81     # import Image and use the Image.core variable instead.     82     # Also note that Image.core is not a publicly documented interface,     83     # and should be considered private and subject to change.---> 84     from . import _imaging as core     86     if __version__ != getattr(core, "PILLOW_VERSION", None):     87         msg = (     88             "The _imaging extension was built for another version of Pillow or PIL:\n"     89             f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"     90             f"Pillow version: {__version__}"     91         )ImportError: dlopen(/Users/moi/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so, 2): Library not loaded: @rpath/libtiff.5.dylib  Referenced from: /Users/moi/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so     Reason: image not found

after countless uninstallations and reinstallations it still didnt work .

i suddenly remembered that when i first installed anaconda and was still experimenting with python , i didnt install all my libraries with conda command , some were installed with pip and so was the case for the pillow library, so i uninstalled pillow using conda :

conda uninstall pillow

and reinstalled it using pip :

pip install pillow 

needless to say : it worked!!

Ps: im using MacOs and this actually solved my problem with pillow and matplotlib cause it uses a dependancy of pillow i gess , anyways HOPE THIS HELPS!

edit: if all of this does not work , i recommend reinstalling Jupyter notebook

conda uninstall jupyterconda install jupyter

Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>