1

I can't access my websites server ever since I upgraded to Mac OSX Mavericks. Whenever I try running the server, I get this message:

ImportError: dlopen(/Library/Python/2.7/site-packages/PIL/_imaging.so, 2): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/PIL/_imaging.so: mach-o, but wrong architecture

I'm using python 2.7 and django framework. I've been stumped on this error for a long time. Does anyone have a solution for this?

karthikr
  • 97,368
  • 26
  • 197
  • 188

2 Answers2

0

This is a Mavericks issue. Either:

  1. Stop using Mavericks
  2. reinstall pillow or PIL like this:

    sudo CFLAGS=-Wunused-command-line-argument-hard-error-in-future pip install pillow

(or just PIL, as you prefer)

ubadub
  • 3,571
  • 21
  • 32
-1

Reinstall PIL, or, better yet, install Pillow:

sudo pip install pillow

EDIT: Not sure why there's a downvote.

But, as ubadub suggested, there's an environment variable you can set (ARCHFLAGS, not CFLAGS) to fix the issue in Pillow. You can read more about it here. The short version is that it looks like you should run

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pillow

You should probably pip uninstall pillow first so that it can be reinstalled.

If that doesn't fix your problem, you should follow the advice in this thread, and run

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11
xcode-select --install

Then uninstall and reinstall pillow.

Community
  • 1
  • 1
Patrick Collins
  • 10,306
  • 5
  • 30
  • 69