2

I want to work with images in python, but I get an error when I try to use PIL. I want to import images from PIL with the following command:

from PIL import Image  

But I get the following error:

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in <module>
    from PIL import Image
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PIL\Image.py", line 56, in <module>
    from . import _imaging as core
ImportError: DLL load failed: A megadott eljárás nem található.

(The last sentence translates to 'The specified procedure could not be found')
I followed the instructions under this question and uninstalled Pillow 4.1.0 and reinstalled Pillow 4.0.0. It didn't solve my problem, but now I get a different error message:

Warning (from warnings module):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PIL\Image.py", line 74
    # Explanations for ways that we know we might have an import error
RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL
Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    from PIL import Image
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PIL\Image.py", line 58, in <module>
    raise ImportError("The _imaging extension was built for another "
ImportError: The _imaging extension was built for another version of Pillow or PIL  

Following the instructions on another question I uninstalled PIL (but failed because it wasn't installed in the first place), then uninstalled pillow, and then reinstalled pillow (the newest version), but I still get the second error message.
I am using windows 8.1 and python 3.6.0. Does anybody know how to solve this problem?

Community
  • 1
  • 1
Wanda W.
  • 45
  • 1
  • 8
  • How did you install Pillow, exactly? FWIW, Pillow 4.0.0 works on my Python 3.6.0 system, but I use Linux & don't know much about Windows. However, you may have better luck with a pre-built Windows package from [Christoph Gohlke's site](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow). – PM 2Ring Apr 18 '17 at 12:03
  • I installed it with the command `py -m pip install pillow`. – Wanda W. Apr 18 '17 at 14:18
  • Does `py -V` print `Python 3.6.0`? – PM 2Ring Apr 18 '17 at 14:22
  • Yes, it printed that. – Wanda W. Apr 18 '17 at 14:25
  • Ok, so that _should_ be installing (or uninstalling) stuff in the right places. All I can suggest is to try uninstalling again, and then re-installing the desired version. Specify the `--no-cache-dir` option so pip doesn't use any files from its local cache. BTW, you can get a list of all the files that pip has installed for Pillow using `py -m pip show -f Pillow`. I guess if all else fails you could try deleting the PIL and Pillow files manually, but that _could_ make an even worse mess... – PM 2Ring Apr 18 '17 at 14:46
  • I had a similar error. Uninstalling `pillow` and `pillow-simd` in my case and reinstalling helped. `pillow-smd` was previously installed by `pip` and was recognized by conda. Uninstalling `pillow` was straightforward but `pillow-simd` was hidden (PackagesNotFoundError while `conda` still sees it). Did this in `jupyter`: `!pip uninstall -y pillow-simd` and repeated the command to install pillow-smd via pip and all was good. Maybe you never got rid of `PIL`. Try listing your packages and try the `jupyter` uninstall. – agent18 Oct 01 '20 at 23:59

0 Answers0