Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

324
Visualizações
Error with compiled Pillow on Python 3.6 virtualenv

I am running a linux box with ubuntu 14, it runs an apache2 server that hosts a Django application. This application imports PIL from the installed Pillow library. It was all working fine when I was on Python 3.5, however after upgrading to Python 3.6 and reinstalling Pillow in the Virtualenv, I get an error when the webserver tries importing PIL.

When I run the Python interpreter it all imports fine as it uses the py script directly however as the webserver is using the installed and compiled pillow library it is failing. The error from Django shows the stack as such:

    Internal Server Error: /ticket-printing/
    Traceback (most recent call last):
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
        response = self.process_exception_by_middleware(e, request)
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "/home/ubuntu/ipos/tickets/views.py", line 30, in stic_app
PrintList.initiateSticApp(request)
      File "/home/ubuntu/ipos/tickets/models.py", line 434, in initiateSticApp
BrandLogo.createBlankLogo()
      File "/home/ubuntu/ipos/store_admin/brands/models.py", line 108, in createBlankLogo
from PIL import Image
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/Pillow-4.1.0-py3.6-linux-x86_64.egg/PIL/Image.py", line 56, in <module>
from . import _imaging as core
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/Pillow-4.1.0-py3.6-linux-x86_64.egg/PIL/_imaging.py", line 7, in <module>
__bootstrap__()
      File "/home/ubuntu/ipos-venv/lib/python3.6/site-packages/Pillow-4.1.0-py3.6-linux-x86_64.egg/PIL/_imaging.py", line 6, in __bootstrap__
imp.load_dynamic(__name__,__file__)
    ImportError: /home/ubuntu/ipos-venv/lib/python3.6/site-packages/Pillow-4.1.0-py3.6-linux-x86_64.egg/PIL/_imaging.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_AdjustIndices

I've tried uninstalling, reinstalling Pillow via pip, easy_install and the tar.gz setup.py method and all fail.

Any guidance and help would be much appreciated.

Thanks

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Whoa that was a whole bunch of WTH...

Ok so after trying almost every combination of installing and reinstalling Pillow, I decided to take a look at my apache2/mod_wsgi set up.

It turns out that my version of mod_wsgi compiled with Python 2.7 was not capable of running the server while calling the Pillow compiled files.

So after following some of the instructions here: https://pypi.python.org/pypi/mod_wsgi

I used pip install mod_wsgi in my virtualenv which created an .so file in the site-packages/mod_wsgi folder of my virtualenv. I then copied that file over to /usr/lib/apache2/modules/mod_wsgi.so-X.X and then modified the /etc/apache2/mods-enabled/wsgi.load file to point to the new .so-X.X file.

Restarted apache2 and the error ceased to appear again.

One day I'll understand these things... One day...

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda