Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify difficulties installing mpl on OSX. #3416

Closed
danielballan opened this issue Aug 26, 2014 · 13 comments
Closed

Specify difficulties installing mpl on OSX. #3416

danielballan opened this issue Aug 26, 2014 · 13 comments
Milestone

Comments

@danielballan
Copy link
Contributor

For me, installing mpl on OSX from source required tinkering with homebrew. This is a note to self to make a more detailed report of the issue and an invitation to other OSX users to report installation difficulties. There seems to be fairly widespread problem.

@jenshnielsen
Copy link
Member

pip install matplotlib just works for me without any issues and has for a long time. All dependencies installed from Homebrew.

I would like some more details about which issues you are seeing.

@cimarronm
Copy link
Contributor

Same as @jenshnielsen. I Install/work from the source all the time on OSX and never had to tweak any of my dependencies installed from homebrew.

@danielballan You should send your build logs when you can

@danielballan
Copy link
Contributor Author

I think this issue arises when you try to pip install matplotlib (or development matplotlib from github) into a conda environment. In all other cases I know of, conda and pip get along fine; conda is meant to be supplemented by pip. But I have seen this combo fail on three separate Macs.

I will reproduce and share my build logs soon.

@jenshnielsen
Copy link
Member

Ok that is useful to know. I don't have conda installed but perhaps I should setup an environment to test

There was some talk about integrating the conda mpl script into matplotlib at scipy this year see #3311

@tacaswell tacaswell added the OSX label Aug 27, 2014
@tacaswell tacaswell added this to the v1.4.x milestone Aug 27, 2014
@amadio
Copy link

amadio commented Aug 28, 2014

I install matplotlib on OS X using a Gentoo prefix install. Everything seems to work ok. The only problem I've encountered so far is that when I try to save something to a file, I can't change the filename on the dialog box, because the keyboard strokes go to the terminal where I am running python. I don't know if this is a matplotlib issue or a issue in tkinter from Python, but matplotlib is the only place where I have this problem.

@tacaswell
Copy link
Member

@amadio Can you create a new issue for the key-stroke problem? That is definitely a run-time not install-time issue.

@tacaswell
Copy link
Member

@danielballan @mwaskom Any word on tracking this down? It sounds like this was isolated on macs using conda and they are now shipping 1.4.0 binaries.

Closing for now, ping me if this needs to be re-opened.

@mwaskom
Copy link

mwaskom commented Sep 5, 2014

Upgrading to 1.4 through conda did work fine (although I simultaneously deleted my matplotlib font cache – not very good science!), but I'm unable to install matplotlib through pip. I don't use homebrew, though. My understanding was that unless you use homebrew for everything it causes more trouble than it's worth, but perhaps this is outdated advice.

Here's a recipe of my attempt to install matplotlib in a clean conda environment:

[~]$ conda create -n pip_matplotlib pip numpy scipy pandas ipython-notebook
[~]$ . activate pip_matplotlib
(pip_matplotlib)[~]$ pip install matplotlib > ~/Desktop/pip_error.txt

And here is the resulting log.

@cimarronm
Copy link
Contributor

It looks like you don't have libpng installed (at least not with pkgconfig) or you have it installed in a non-standard directory.

For some reason, matplotlib setup check seems to always assume libpng is installed instead of really checking for it which is why it gets all the way to building the _png extension before erroring out.

@mwaskom
Copy link

mwaskom commented Sep 5, 2014

Ok so I did conda install libpng and then pip install matplotlib worked, but:

(pip_matplotlib)[~]$ ipython
[mwaskom]|1> import matplotlib
[mwaskom]|2> import matplotlib.pyplot
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-6f467123fe04> in <module>()
----> 1 import matplotlib.pyplot

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
     25
     26 import matplotlib
---> 27 import matplotlib.colorbar
     28 from matplotlib import style
     29 from matplotlib import _pylab_helpers, interactive

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
     32 import matplotlib.artist as martist
     33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
     35 import matplotlib.colors as colors
     36 import matplotlib.contour as contour

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
     25 import matplotlib.artist as artist
     26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
     28 import matplotlib.path as mpath
     29 from matplotlib import _path

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
     54
     55 import matplotlib.tight_bbox as tight_bbox
---> 56 import matplotlib.textpath as textpath
     57 from matplotlib.path import Path
     58 from matplotlib.cbook import mplDeprecation

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
     20 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
     21 from matplotlib.ft2font import LOAD_TARGET_LIGHT
---> 22 from matplotlib.mathtext import MathTextParser
     23 import matplotlib.dviread as dviread
     24 from matplotlib.font_manager import FontProperties

/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/mathtext.py in <module>()
     61
     62 import matplotlib.colors as mcolors
---> 63 import matplotlib._png as _png
     64 ####################
     65

ImportError: dlopen(/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: libpng15.15.dylib
  Referenced from: /Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/_png.so
  Reason: image not found

@cimarronm
Copy link
Contributor

What does otool -L /Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/_png.so and pkg-config libpng --libs show?

@mwaskom
Copy link

mwaskom commented Sep 5, 2014

(pip_matplotlib)[~]$ otool -L /Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/_png.so
/Users/mwaskom/anaconda/envs/pip_matplotlib/lib/python2.7/site-packages/matplotlib/_png.so:
    libpng15.15.dylib (compatibility version 29.0.0, current version 29.0.0)
    libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
    /usr/local/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.17.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)

(pip_matplotlib)[~]$ pkg-config libpng --libs
-bash: pkg-config: command not found

@cimarronm
Copy link
Contributor

I think you have two options here:

  1. export DYLD_LIBRARY_PATH=/Users/mwaskom/anaconda/envs/pip_matplotlib/lib before you run anything that way the dynamic linker knows where to load the libpng library from
  2. Install libpng at the system level (not in a user directory)

A more involved approach which is what the maintainers for anaconda do (I presume) is to adjust the linker flags when building each package so that when the linker builds each executable or shared library, it sets the dynamic library load commands to @loader_path relative. By doing so, they will pick up only the libraries they have installed in their own lib directory and not get any accidental loading of system libraries in /usr/lib, usr/local/lib, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants