5

Here is a description of what I've done.

I'm trying to write a program using PIL, but, when trying to import it (as shown bellow), an error appears (also shown below).

from PIL import Image

Here is the error.

Traceback (most recent call last):
  File "C:/Users/user/Desktop/Wook/Test Bench.py", line 1, in <module>
    from PIL import Image
  File "C:\Python\lib\site-packages\PIL\Image.py", line 56, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified procedure could not be found.

I have tried to simply import Image:

But, it also displays an error:

Here is the error to the second situation.

Traceback (most recent call last):
  File "C:/Users/user/Desktop/Wook/Test Bench.py", line 1, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'

Here is a very short list of what I've tried to do to solve the issue:

  • Installing PIL (Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL), suffice it to say, it didn't work;
  • Uninstalling PIL, but I cannot uninstall what I don't have installed (Cannot uninstall requirement PIL, not installed);
  • I've tried to install pillow, but it is already installed;
  • I've tried to uninstall pillow (to then install it again, and see if it would work), it did not resolve a thing.

That's all I've tried. If anyone can help me, it would be deeply appreciated, and if, any further information needs to be provided, it can, and will, be provided.

Hugo
  • 27,885
  • 8
  • 82
  • 98
Rodrigo
  • 181
  • 1
  • 8
  • Look up the error. The only thing I found that was specifically for PIL was this: https://stackoverflow.com/q/33697743/5827958, but I'm not sure that'll help you. There are a lot of other modules with the same problem, though, so you might get some ideas from that. – zondo Apr 07 '17 at 00:32
  • Are you on Python3? Install https://pypi.python.org/pypi/Pillow – Claudio Apr 07 '17 at 04:23
  • @Claudio, I already had Pillow installed. It does not function. Thank you, still. – Rodrigo Apr 07 '17 at 14:23
  • On my box: `>>> Image.__file__ '/usr/lib/python2.7/dist-packages/PILcompat/Image.pyc'` So search on yours for `Image.pyc` and then make sure Python has this module in its search path: http://stackoverflow.com/questions/3144089/expand-python-search-path-to-other-source – Claudio Apr 07 '17 at 15:05
  • Possible duplicate of [PIL: DLL load failed: specified procedure could not be found](https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found) – mrk Jul 05 '18 at 14:00

1 Answers1

4

There's a Python problem which means wheels built against Python 3.6.1, such as Pillow 4.1.0, won't work on Python 3.6.0.

The fix is to update to Python 3.6.1, or install Pillow 4.0.0 (which was built against Python 3.6.0).

For more info see: https://github.com/python-pillow/Pillow/issues/2479 https://mail.python.org/pipermail/python-dev/2017-March/147707.html https://bugs.python.org/issue29943


Update:

This has affected a number of Python libraries.

However, there's the new Pillow 4.1.1 release works around this, so you can now update to Pillow 4.1.1 and use it with both Python 3.6.0 and 3.6.1.

Hugo
  • 27,885
  • 8
  • 82
  • 98
  • 1
    Thanks a bunch for the help, @Hugo, it solved the issue! I wouldn't be able to find that sort of information on my own. – Rodrigo Apr 08 '17 at 22:03
  • 3
    I had this same problem `from . import _imaging as core ImportError: DLL load failed: The specified procedure could not be found.` recently with Anaconda Navigator 1.6.12 running Python 3.6.4. I was loading PIL 4.3.0. Upgrading PIL to 5.0.0 via Anaconda Navigator did not fix it. I ultimately fixed it via the following two step procedure. 1. Uninstall it via `conda remove --force pillow` 2. Reinstall. Fearing something was wrong with the original Anaconda distribution, I reinstalled from conda-forge instead of conda's default. So I used `conda install -c conda-forge pillow` – LWixson Feb 07 '18 at 19:33