WebFaction
Community site: login faq

Hi,

I've created a virtualenv and Installed a markdown utility that requires Pillow. In production I get all to work but in the server I get this error:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fc23dddd730>
Traceback (most recent call last):
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/management/base.py", line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/checks/registry.py", line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    for pattern in resolver.url_patterns:
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/zanklord/webapps/python_granada/website/core/urls.py", line 13, in <module>
    url(r'^markdownx/', include('markdownx.urls')),
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 52, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/zanklord/webapps/python_granada/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/markdownx/urls.py", line 3, in <module>
    from .views import (
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/markdownx/views.py", line 5, in <module>
    from .forms import ImageForm
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/markdownx/forms.py", line 11, in <module>
    from .utils import scale_and_crop
  File "/home/zanklord/webapps/python_granada/lib/python3.5/site-packages/markdownx/utils.py", line 3, in <module>
    from PIL import Image
  File "/home/zanklord/lib/python2.7/PIL/Image.py", line 66, in <module>
    from PIL import _imaging as core
ImportError: dynamic module does not define module export function (PyInit__imaging)

I made sure to run the script using python3 as is the version I selected when creating the virtualenv.

asked 26 Jul '16, 20:40

yabirgb
1114
accept rate: 100%


Finally I was able to fix the error using which to see what pip I was using. First re-created muy virtualenv using no site packages and after used pip3.5 to install(instead of pip). Pip3.5 seems to call the virtualenv pip.

permanent link

answered 26 Jul '16, 22:13

yabirgb
1114
accept rate: 100%

I was able to load the PIL module as your user via SSH. Which seems to indicate that it was installed and is functioning correctly,

>>> PIL.VERSION
'1.1.7'

I do notice this line and the python version it is showing is 2.7 as opposed to 3.5,

  File "/home/zanklord/lib/python2.7/PIL/Image.py", line 66, in <module>
    from PIL import _imaging as core
ImportError: dynamic module does not define module export function (PyInit__imaging)

Is the above path being defined in your application or elsewhere in the PYTHONPATH? If so remove it since it is a 2.7 path and will cause the error with the module named 'Image'.

permanent link

answered 26 Jul '16, 21:46

johns
5.4k412
accept rate: 23%

Thanks for the effort. I managed to fix the instalation

(26 Jul '16, 22:13) yabirgb
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×12
×3

question asked: 26 Jul '16, 20:40

question was seen: 2,694 times

last updated: 26 Jul '16, 22:13

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2021 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM