17

Just updated my Mac to El Capitan 10.11. I am trying to run Django 1.6 with Celery 3.1 and I'm getting this error now:

Unhandled exception in thread started by <function wrapper at 0x10f861050>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 75, in _populate
    self.load_app(app_name, True)
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/debug_toolbar/models.py", line 9, in <module>
    dt_settings.patch_all()
  File "/Library/Python/2.7/site-packages/debug_toolbar/settings.py", line 215, in patch_all
    patch_root_urlconf()
  File "/Library/Python/2.7/site-packages/debug_toolbar/settings.py", line 203, in patch_root_urlconf
    reverse('djdt:render_panel')
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 503, in reverse
    app_list = resolver.app_dict[ns]
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 329, in app_dict
    self._populate()
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 267, in _populate
    for pattern in reversed(self.url_patterns):
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 365, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/pedrotorres/Documents/work/projects/bparts/netpecasv2/urls.py", line 10, in <module>
    url(r'', include('Common.urls')),
  File "/Library/Python/2.7/site-packages/django/conf/urls/__init__.py", line 26, in include
    urlconf_module = import_module(urlconf_module)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/urls.py", line 3, in <module>
    from APIMobile.views import request_product_info_by_qrcode
  File "/Users/pedrotorres/Documents/work/projects/bparts/APIMobile/views.py", line 9, in <module>
    from Common.views import resizeImage, token_generator, getWatermarkImage, filterProductsByBrandModelVersionYear, \
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/views.py", line 34, in <module>
    from Common.tasks import turn_off_demo_mode_new_workshop
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/tasks.py", line 3, in <module>
    from netpecasv2.celeryapp import app
  File "/Users/pedrotorres/Documents/work/projects/bparts/netpecasv2/celeryapp.py", line 5, in <module>
    from celery import Celery
  File "/Library/Python/2.7/site-packages/celery/__init__.py", line 130, in <module>
    from celery import five
  File "/Library/Python/2.7/site-packages/celery/five.py", line 51, in <module>
    from kombu.five import monotonic
  File "/Library/Python/2.7/site-packages/kombu/five.py", line 52, in <module>
    libSystem = ctypes.CDLL('libSystem.dylib')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libSystem.dylib, 6): image not found

Everything worked fine before. Can't find a solution to fix this. I've seen this thread but doesn't work: "OSError: dlopen(libSystem.dylib, 6): image not found" (OS X + macports + Celery 3.1.7)

I didn't have any DYLD_FALLBACK_LIBRARY_PATH before. I tried to:

export DYLD_FALLBACK_LIBRARY_PATH="/usr/lib":$DYLD_FALLBACK_LIBRARY_PATH

but Python can't find the Library despite it being located under "/usr/lib"

Anyone has had a problem like this?

Community
  • 1
  • 1
pedrotorres
  • 1,222
  • 2
  • 13
  • 26

11 Answers11

15

I suspect (but can't confirm) the System Integrity Protection (SIP) of OSX El Capitan is preventing access to your /usr/lib folder.

It would be extreme and defeating the purpose of the security feature, but you could try disabling SIP by booting into the OS X Recovery partition, executing csrutil disable and rebooting...atleast until another option / work-around can be found.

ArsTechnica has a write-up here: http://arstechnica.com/apple/2015/09/os-x-10-11-el-capitan-the-ars-technica-review/9/

And a similar issue is described here: http://blog.honekamp.net/blog/2015/09/07/el-cap-and-my-printer/

More discussion on Hacker News here: https://news.ycombinator.com/item?id=10309576

Joe Young
  • 5,749
  • 3
  • 28
  • 27
  • 2
    Well, despite that solution not being recommended, i tried it and it worked. Best solution so far. – pedrotorres Oct 02 '15 at 12:45
  • @Joe Young: This might also be the case for me cause since upgrading to El Capitan I can't run celery anymore. I'm extensively using celery for local development and I really need it, but as you mentioned, it's an extreme measure to disable SIP altogether. Is there any other solution you might wanna suggest ? – SpiXel Oct 07 '15 at 07:17
  • 1
    Just upgraded to El Capitan. Worked for me as well. For those that don't know already, you can open recovery mode for your Mac by holding CMD + R during boot-up. Thanks Joe! – Alex Williams Oct 09 '15 at 04:01
  • I don't know anything about this specific package, but on unix systems, you're supposed to install your own stuff into /usr/local/ (eg. /usr/local/lib) and I think El Capitan is still fine when you do that? – Matthew Gunn Nov 19 '15 at 03:27
11
pip install --upgrade billiard
pip install --upgrade celery
pip install --upgrade kombu
pip install --upgrade amqp

This should work.

Jonathan Lam
  • 16,831
  • 17
  • 68
  • 94
Tiexin Guo
  • 119
  • 5
3

I uninstall "billiard,celery,kombu,amqp" those four packages. Then reinstall the latest version from github solved this

Kevin.Xin
  • 86
  • 5
3

I also ran into the same problem just after upgrading the OS to OS X El Captain. Disabling SIP does the trick, but if someone is not comfortable doing that updating five.py in few modules in site-packages will help. (I know it's not that nice, but it's OK as long as you know what you're doing)

Update the places that access the DLL to have absolute path in following modules

line 145 of site-packages/amqp/five.py 
line 52 of site-packages/kombu/five.py 
line 42 of site-packages/billiard/five.py 

update to:

libSystem = ctypes.CDLL('libSystem.dylib') => libSystem = ctypes.CDLL('/usr/lib/libSystem.dylib')

hope this helps ;)

njs
  • 113
  • 8
2

I ran into the same issue getting celery to work.

I did some quick tests and here's what I found, but can't quite pin it on a specific cause yet:

a. stock python with ctypes.CDLL("libSystem.dylib") results in the image not found error.

b. stock python with ctypes.CDLL("/usr/lib/libSystem.dylib") works

c. virtualenv python with ctypes.CDLL("libSystem.dylib") works

Eric Wang
  • 41
  • 3
0

Reinstalling python solved the issue for me. Using brew you can just brew install python again. If it says that you need permission to write to /usr/local, try to change permissions by sudo chown -R $(whoami):admin /usr/local, and then install python.

0

I tried updating to the latest versions of these libraries from github, but it did not help. The simplest solution that I've found is to use virtualenv

virtualenv myenv
cd myenv
source bin/activate
pip install celery

To confirm it worked:

python -c "import celery"

This seems preferable to disabling a fundamental security feature of the OS, and virtualenv has its own (well documented) benefits.

chadrik
  • 3,413
  • 1
  • 21
  • 19
0

You can delete the current celery version, and then download it from the http://pypi.python.org/pypi/celery/, build and install the sorce code.It is helpful for me, and I hope so do you.

dyljqq
  • 41
  • 3
0

In my case, the error is because Homebrew was not symlink to gettext properly. I've solved this using

brew unlink gettext && brew link --force gettext
Leonardo
  • 791
  • 1
  • 5
  • 21
0

copying from How to install h5py (needed for Keras) on MacOS with M1?

in case someone ended up here first like I was and wants to avoid disabling SIP. this seems to work for me:

brew install hdf5@1.10  
export HDF5_DIR=/usr/local/Cellar/hdf5@1.10/1.10.7_1
pip install 'h5py==2.10.0' --force-reinstall --no-binary=h5py
ozgeneral
  • 6,079
  • 2
  • 30
  • 45
-1

1 . Install Homebrew as macOS Sur is missing the necessary ODBC package

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2 . Install missing ODBC package

brew install libiodbc
Bisi Afolalu
  • 59
  • 1
  • 4