0

I'm trying to run a django site as a personal project.

In Windows it runs fine, so I'm trying to test it on my Synology DS916+. I installled successfully this:

Python 3.8.3

Django 3.0.7

Pillow 7.2

But when I run python manage.py runserver, it returns this:

File "/volume1/WEBMI/webmi/lib/python3.8/site-packages/PIL/Image.py", line 93, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/volume1/WEBMI/webmi/lib/python3.8/site-packages/PIL/__init__.py)

This is part of Image.py

try:
    # If the _imaging C module is not present, Pillow will not load.
    # Note that other modules should not refer to _imaging directly;
    # import Image and use the Image.core variable instead.
    # Also note that Image.core is not a publicly documented interface,
    # and should be considered private and subject to change.
    from . import _imaging as core 

    if __version__ != getattr(core, "PILLOW_VERSION", None):
        raise ImportError(
            "The _imaging extension was built for another version of Pillow or PIL:\n"
            "Core version: %s\n"
            "Pillow version: %s" % (getattr(core, "PILLOW_VERSION", None), __version__)
        )

except ImportError as v:
    core = deferred_error(ImportError("The _imaging C module is not installed."))
    # Explanations for ways that we know we might have an import error
    if str(v).startswith("Module use of python"):
        # The _imaging C module is present, but not compiled for
        # the right version (windows only).  Print a warning, if
        # possible.
        warnings.warn(
            "The _imaging extension was built for another version of Python.",
            RuntimeWarning,
        )
    elif str(v).startswith("The _imaging extension"):
        warnings.warn(str(v), RuntimeWarning)
    # Fail here anyway. Don't let people run with a mostly broken Pillow.
    # see docs/porting.rst
    raise

As you can see I ran it also in virtualenv with no success. Also tried to uninstall and install pillow several times without success.

It seems some dependency is broken but don't know which. I run out of ideas.

Thanks in advance

1 Answers1

0

First, try uninstalling everything.

pip uninstall PIL
pip uninstall Pillow

Next, you should install PIL, not pillow.

pip install --no-index -f https://dist.plone.org/thirdparty/ -U PIL

And then you install the "actual" pillow:

pip install Pillow

Reference

crimsonpython24
  • 2,223
  • 2
  • 11
  • 27
  • I tried installing PIL, first from PIP, but no longer exists, and then from that link but got this error: File "", line 1, in File "/volume1/@entware/tmp/pip-install-hvptdkam/PIL/setup.py", line 169 print "--- using Tcl/Tk libraries at", TCL_ROOT ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("--- using Tcl/Tk libraries at", TCL_ROOT)? ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. – Paco_Schumi Jul 26 '20 at 11:17
  • Seems to be a more updated one https://github.com/OlafenwaMoses/ImageAI/issues/171 – crimsonpython24 Jul 26 '20 at 11:24
  • I can't see it :( – Paco_Schumi Jul 26 '20 at 11:46