简体   繁体   中英

Installing matplotlib via pip on Ubuntu 12.04

I'm trying to use matplotlib on Ubuntu 12.04. So I built a wheel with pip:

python .local/bin/pip wheel --wheel-dir=wheel/ --build=build/ matplotlib

Then successfully installed it:

python .local/bin/pip install --user --no-index --find-links=wheel/ --build=build/ matplotlib

But when I'm trying to import it in ipython ImportError occures:

In [1]: import matplotlib

In [2]: matplotlib.get_backend()
Out[2]: u'agg'

In [3]: import matplotlib.pyplot

ImportError
Traceback (most recent call last) /place/home/yefremat/ in () ----> 1 import matplotlib.pyplot

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/pyplot.py in () 32 from matplotlib import docstring 33 from matplotlib.backend_bases import FigureCanvasBase ---> 34 from matplotlib.figure import Figure, figaspect 35 from matplotlib.gridspec import GridSpec 36 from matplotlib.image import imread as _imread

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/figure.py in () 38 import matplotlib.colorbar as cbar 39 ---> 40 from matplotlib.axes import Axes, SubplotBase, subplot_class_factory 41 from matplotlib.blocking_input import BlockingMouseInput, BlockingKeyMouseInput 42 from matplotlib.legend import Legend

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/ init .py in () 2 unicode_literals) 3 ----> 4 from ._subplots import * 5 from ._axes import *

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/_subplots.py in () 8 from matplotlib import docstring 9 import matplotlib.artist as martist ---> 10 from matplotlib.axes._axes import Axes 11 12 import warnings

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/axes/_axes.py in () 36 import matplotlib.ticker as mticker 37 import matplotlib.transforms as mtransforms ---> 38 import matplotlib.tri as mtri 39 import matplotlib.transforms as mtrans 40 from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/ init .py in () 7 import six 8 ----> 9 from .triangulation import * 10 from .tricontour import * 11 from .tritools import *

/home/yefremat/.local/lib/python2.7/site-packages/matplotlib/tri/triangulation.py in () 4 import six 5 ----> 6 import matplotlib._tri as _tri 7 import matplotlib._qhull as _qhull 8 import numpy as np

ImportError: /home/yefremat/.local/lib/python2.7/site-packages/matplotlib/_tri.so: undefined symbol: _ZNSt8__detail15_List_node_base9_M_unhookEv

May be I'm doing somethig wrong? Or may be there is a way to turn off gui support of matplotlib?

Thanks in advance.

Okay, the problem was in gcc version. During building and creating wheel of package pip uses system gcc (which version is 4.7.2). I'm using python from virtualenv, which was built with gcc 4.4.3. So version of libstdc++ library is different in IPython and one that pip used.

As always there are two solutions (or even more): pass LD_PRELOAD environment variable with correct libstdc++ before entering IPython or to use same version of gcc during creating wheel and building virtualenv. I prefred the last one.

Thank you all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM