fonnesbeck / ScipySuperpack

Recent builds of Numpy, Scipy, Matplotlib, iPython and PyMC for OSX
http://fonnesbeck.github.io/ScipySuperpack
Other
490 stars 75 forks source link

The 'image not found' error while importing matplotlib.pyplot #27

Closed yashchitalia closed 11 years ago

yashchitalia commented 11 years ago

Hi Chris, I'm trying to import matplotlib.pyplot into my python code to plot a few figures, but I get the following error when I run the import command.

ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so, 2): Library not loaded: /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so
  Reason: image not found

I tried searching the problem and noticed that someone else had the same sort of an issue 6 months ago, and had posted here. However, I don't really know whether it was the same issue, and I didn't really understand the solution to the issue. Could you help me out here?

Thanks, Yash

fonnesbeck commented 11 years ago

Yash,

It looks like you may be running 32-bit python. Can you confirm this? Try running:

arch -x86_64 python

then import matplotlib, and see if it works.

yashchitalia commented 11 years ago

Hi Chris, Thanks for your reply! I tried what you advised, but got the same error. Here's a snapshot of the whole error:

 arch -x86_64 python

Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import matplotlib
>>> import matplotlib.pyplot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 98, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/__init__.py", line 25, in pylab_setup
    globals(),locals(),[backend_name])
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/backend_macosx.py", line 21, in <module>
    from matplotlib.backends import _macosx
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so, 2): Library not loaded: /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so
  Reason: image not found 

I'd noticed a thread before this one that had a similar issue, and reinstallation using 'pip' had helped. Now, since I did not install using pip, I was unsure about how to go about the solution, and whether that situation even applies to my case. Thanks, Yash

yashchitalia commented 11 years ago

Chris, Although, I must add, during installation, after I ran the shell script, I did get a lot of warnings. Is that normal? It did install completely though. Unfortunately, I don't know how to bring up the warnings up again. In such a case, will reinstalling help? Thanks, Yash

fonnesbeck commented 11 years ago

It would be useful to see the complete output of the install, yes.

yashchitalia commented 11 years ago

Actually, I'm unable to retrieve the output of the install. Could you direct me to how I could procure it? Also, if that isn't possible, how do I reinstall?

christinasc commented 11 years ago

I had this problem a week ago when i updated my fonnesbeck install.

The matplotlib 1.3 is ok up until you do import matplot.pyplot -- that's when it fails on the mac.

The only way I fixed the problem was to revert to matplotlib 1.2 and edit the .pth file.

You can also try symlinking the /System/Library/Frameworks/ CoreText.framework/Versions/A/CoreText

as this was the solution discussed on some forums, but i declined to do this as I'd probably forget about it. I prefer to have a fully working version.

-C

On Thu, Feb 14, 2013 at 12:49 PM, yashchitalia notifications@github.comwrote:

Actually, I'm unable to retrieve the output of the install. Could you direct me to how I could procure it? Also, if that isn't possible, how do I reinstall?

— Reply to this email directly or view it on GitHubhttps://github.com/fonnesbeck/ScipySuperpack/issues/27#issuecomment-13577729.

Christina Chu

"You have to believe in yourself" - Sun Tzu

yashchitalia commented 11 years ago

Hi Christina, Thanks a lot for the solution. However, I'm a bit lost about what to do (I'm just beginning with Python). Could you help me out with how I could go about getting the matplotlib 1.2 , because I couldn't find it here. Thanks, Yash

christinasc commented 11 years ago

https://github.com/matplotlib/matplotlib/downloads

for the 1.2 version

then look at your easy_intall.pth to see what version of matplotlib is listed.

it should be in the /Library/Python/2.7/site-packages/ directory

Also see:

http://stackoverflow.com/questions/12518098/failed-import-matplotlib-pylab-due-to-backends-macosx-so-reason-image-not-f/14782863#14782863

On Thu, Feb 14, 2013 at 1:41 PM, yashchitalia notifications@github.comwrote:

Hi Christina, Thanks a lot for the solution. However, I'm a bit lost about what to do (I'm just beginning with Python). Could you help me out with how I could go about getting the matplotlib 1.2 , because I couldn't find it here. Thanks, Yash

— Reply to this email directly or view it on GitHubhttps://github.com/fonnesbeck/ScipySuperpack/issues/27#issuecomment-13580269.

Christina Chu

"You have to believe in yourself" - Sun Tzu

yashchitalia commented 11 years ago

Christina, Thanks a lot again. However, how did you get the matplotlib 1.2 to install on python 2.7.1 as you have written on this link: http://stackoverflow.com/questions/12518098/failed-import-matplotlib-pylab-due-to-backends-macosx-so-reason-image-not-f/14782863#14782863 ? When I try to install the .dmg file for matplotlib 1.2 , it always gives me an error saying that : matplotlib1.2 requires System Python 2.7 to install. I too have a Python 2.7.1 that came preinstalled in my OSX Lion.

christinasc commented 11 years ago

2.7.1 works! That's exactly what i have. I can take a closer look tomorrow , going offline now.

On Thu, Feb 14, 2013 at 7:01 PM, yashchitalia notifications@github.comwrote:

Christina, Thanks a lot again. However, how did you get the matplotlib 1.2 to install on python 2.7.1 as you have written on this link: http://stackoverflow.com/questions/12518098/failed-import-matplotlib-pylab-due-to-backends-macosx-so-reason-image-not-f/14782863#14782863? When I try to install the .dmg file for matplotlib 1.2 , it always gives me an error saying that : matplotlib1.2 requires System Python 2.7 to install. I too have a Python 2.7.1 that came preinstalled in my OSX Lion.

— Reply to this email directly or view it on GitHubhttps://github.com/fonnesbeck/ScipySuperpack/issues/27#issuecomment-13590940.

Christina Chu

"You have to believe in yourself" - Sun Tzu

yashchitalia commented 11 years ago

Sure, thanks a lot!

yashchitalia commented 11 years ago

Christina, This is something I noticed just now. In all the installer packages on the link: https://github.com/matplotlib/matplotlib/downloads before the install, it mentions that the matplotlib1.2 is not for "Apple's built in python". So you probably installed your version from somewhere else? Thanks, Yash

christinasc commented 11 years ago

dunno - this is what i have. it works when i do from pylab import * and plot(y) also import matplotlib.pyplot works.

Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information.

On Fri, Feb 15, 2013 at 8:39 AM, yashchitalia notifications@github.comwrote:

Christina, This is something I noticed just now. In all the installer packages on the link: https://github.com/matplotlib/matplotlib/downloads before the install, it mentions that the matplotlib1.2 is not for "Apple's built in python". So you probably installed your version from somewhere else? Thanks, Yash

— Reply to this email directly or view it on GitHubhttps://github.com/fonnesbeck/ScipySuperpack/issues/27#issuecomment-13615239.

Christina Chu

"You have to believe in yourself" - Sun Tzu

yashchitalia commented 11 years ago

Okay, but how did you install matplotlib1.2 ? (When I run the .dmg files, the installer says that the version of python must not be the built-in python )

christinasc commented 11 years ago

can't remember. but you can do a search on stack overflow to see what people have done

On Fri, Feb 15, 2013 at 3:40 PM, yashchitalia notifications@github.comwrote:

Okay, but how did you install matplotlib1.2 ? (When I run the .dmg files, the installer says that the version of python must not be the built-in python )

— Reply to this email directly or view it on GitHubhttps://github.com/fonnesbeck/ScipySuperpack/issues/27#issuecomment-13634023.

Christina Chu

"You have to believe in yourself" - Sun Tzu

yashchitalia commented 11 years ago

Will do that immediately. Thanks a lot. I'll close this issue as soon as I've arrived at a solution. -Yash

yashchitalia commented 11 years ago

@fonnesbeck I tried installing a new version of python with homebrew. Then installed ran the setup file again. Here is the install log.


sh install_superpack.sh
Cloning Scipy Superpack
Cloning into 'ScipySuperpack'...
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 26 (delta 6), reused 21 (delta 3)
Receiving objects: 100% (26/26), 86.73 MiB | 2.01 MiB/s, done.
Resolving deltas: 100% (6/6), done.
Downloading gFortran ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 29.2M  100 29.2M    0     0  2032k      0  0:00:14  0:00:14 --:--:-- 2438k
Installing gFortran ...
Password:
installer: Package name is gcc-4.2 Apple build 5666.3 with GNU Fortran for Lion
installer: Upgrading at base path /
installer: The upgrade was successful.
Installing Scipy Superpack ...
Processing ipython-0.14.dev-py2.7.egg
removing '/Library/Python/2.7/site-packages/ipython-0.14.dev-py2.7.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/ipython-0.14.dev-py2.7.egg
Extracting ipython-0.14.dev-py2.7.egg to /Library/Python/2.7/site-packages
ipython 0.14.dev is already the active version in easy-install.pth
Installing ipcontroller script to /usr/local/bin
Installing iptest script to /usr/local/bin
Installing ipcluster script to /usr/local/bin
Installing ipython script to /usr/local/bin
Installing pycolor script to /usr/local/bin
Installing iplogger script to /usr/local/bin
Installing irunner script to /usr/local/bin
Installing ipengine script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/ipython-0.14.dev-py2.7.egg
Processing matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg
Extracting matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
matplotlib 1.3.x is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg
Processing numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg
Extracting numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
Removing numpy 1.5.1 from easy-install.pth file
numpy 1.8.0.dev-4600b2f-20130131 is already the active version in easy-install.pth
Installing f2py script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg
Processing pandas-0.10.1_20130131-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/pandas-0.10.1_20130131-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/pandas-0.10.1_20130131-py2.7-macosx-10.8-intel.egg
Extracting pandas-0.10.1_20130131-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
pandas 0.10.1-20130131 is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/pandas-0.10.1_20130131-py2.7-macosx-10.8-intel.egg
Processing pymc-2.2-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/pymc-2.2-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/pymc-2.2-py2.7-macosx-10.8-intel.egg
Extracting pymc-2.2-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
pymc 2.2 is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/pymc-2.2-py2.7-macosx-10.8-intel.egg
Processing scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg
Extracting scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
scikit-learn 0.14-git is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg
Processing scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx-10.8-intel.egg
Extracting scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
scipy 0.12.0.dev-b69fe18-20130131 is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx-10.8-intel.egg
Processing statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg
removing '/Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg' (and everything under it)
creating /Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg
Extracting statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg to /Library/Python/2.7/site-packages
statsmodels 0.5.0 is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg
Installing readline ...
Searching for readline
Best match: readline 6.2.4.1
Processing readline-6.2.4.1-py2.7-macosx-10.7-intel.egg
readline 6.2.4.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/readline-6.2.4.1-py2.7-macosx-10.7-intel.egg
Installing nose ...
Searching for nose
Best match: nose 1.2.1
Processing nose-1.2.1-py2.7.egg
nose 1.2.1 is already the active version in easy-install.pth
Installing nosetests script to /usr/local/bin
Installing nosetests-2.7 script to /usr/local/bin

Using /Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg
Installing six
Searching for six
Best match: six 1.2.0
Processing six-1.2.0-py2.7.egg
six 1.2.0 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/six-1.2.0-py2.7.egg
Installing python-dateutil
Searching for python-dateutil
Best match: python-dateutil 1.5
Adding python-dateutil 1.5 to easy-install.pth file

Using /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Installing pytz
Searching for pytz
Best match: pytz 2012j
Processing pytz-2012j-py2.7.egg
pytz 2012j is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/pytz-2012j-py2.7.egg
Installing Tornado
Searching for tornado
Best match: tornado 2.4.1
Processing tornado-2.4.1-py2.7.egg
tornado 2.4.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/tornado-2.4.1-py2.7.egg
Installing pyzmq
Searching for pyzmq
Best match: pyzmq 2.2.0.1
Processing pyzmq-2.2.0.1-py2.7-macosx-10.7-intel.egg
pyzmq 2.2.0.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/pyzmq-2.2.0.1-py2.7-macosx-10.7-intel.egg
Installing pika
Searching for pika
Best match: pika 0.9.9
Processing pika-0.9.9-py2.7.egg
pika 0.9.9 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/pika-0.9.9-py2.7.egg
Installing jinja2
Searching for jinja2
Best match: Jinja2 2.6
Processing Jinja2-2.6-py2.7.egg
Jinja2 2.6 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/Jinja2-2.6-py2.7.egg
Installing patsy
Searching for patsy
Best match: patsy 0.1.0
Processing patsy-0.1.0-py2.7.egg
patsy 0.1.0 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/patsy-0.1.0-py2.7.egg
Cleaning up
Done

This time there were no warnings, but it still displays the same error. -Yash

yashchitalia commented 11 years ago

@fonnesbeck Issue solved. Matplotlib 1.2 worked for me. @christinasc pip install did it for me.

pip install matplotlib