Search code examples
pythonmatplotlibpygtk

install matplotlib with pip and when pygtk is in non standard location


I have installed PyGTK 2.24.0 in /software/pygtk-2.24.0/gcc directory. Is there any way without rewrite the setup program how to install matplotlib with pip?

Simple pip install matplotlib builds matplotlib without GTK support. I have even tried to put /software/pygtk-2.24.0/gcc and /software/pygtk-2.24.0/gcc/lib/python2.7/site-packages to setup.cfg basedirlist variable and also in the list in function get_base_dirs() in setupext.py, in matplotlib build dir, but didn't succeed. Also tried the last matplotlib from git.

I suppose there should be sufficient to have correctly set up the $PYTHONPATH, $LD_LIBRARY_PATH and $PKG_CONFIG_PATH which I have. Is there anything like config.log to see what really happened that setup.py doesn't recognize the PyGTK install location?

I am able to do without any problem >>> import pygtk but >>> import gtk causes "not found" answer from Python interpreter.


Solution

  • The clue is in my last sentence and in the demo script of PyGTK. Without successful >>> import gtk cannot be matplotlib compiled with PyGTK support.

    I had not correctly set $PYTHONPATH, which should not only point to /software/pygtk-2.24.0/gcc/lib/python2.7/site-packages, but also to /software/pygtk-2.24.0/gcc/lib/python2.7/site-packages/gtk-2.0. So

    export PYTHONPATH=/software/pygtk-2.24.0/gcc/lib/python2.7/site-packages/gtk-2.0:/software/pygtk-2.24.0/gcc/lib/python2.7/site-packages:$PYTHONPATH
    

    after PyGTK installation to my non standard directory has done it's job.