3

On an ubuntu system on which I don't have sudo previleges, I wish to install a package via pip (matplotlib to be precise), but some source packages are not installed on the system (however the binaries are installed).

I have created a virtual environment in which to install, and have downloaded the required source code, but I can't place them in the default /usr/include/ etc.. When pip runs matplotlib's setup.py script, the source files are reported as missing.

Is there a way to instruct pip or setup.py where to look for the source?

ps: setting CFLAGS or CPPFLAGS adds the locations of the downloaded source to compile instructions, but setup.py didn't find the source, so didn't attempt to compile some components (graphic backends).

pps: this is similar to, but more specific than this question

Community
  • 1
  • 1
drevicko
  • 14,382
  • 15
  • 75
  • 97
  • Would this help? http://stackoverflow.com/questions/7465445/how-to-install-python-modules-without-root-access – Wiwiweb Oct 22 '13 at 00:23
  • 1
    @Wiwiweb useful link, but no, for this situation those answers don't help. I believe I've found an answer though - it seems matplotlib provides a `setup.cfg` in which you can specify extra source directories... – drevicko Oct 22 '13 at 01:04

1 Answers1

0

I would suggest doing:

  • Rebuild whatever binaries you need in your own home directory (this also avoids an issue if the apps get upgraded on the system or are otherwise different versions from your source). Assuming the programs use the standard configure scripts, you can do
mkdir ~/dev
cd app_src
./configure --prefix=~/dev
make; make install
  • Then when you want to do your pip install, do

export PATH=~/dev/bin:$PATH
export LD_LIBRARY_PATh=~/dev/lib

(Note, what I should be suggesting is pointing it to your virtualenv but I haven't had the issue you're having)

  • Do the pip install; if memory serves, pkg-config should pick up the info you want (this assumes matplotlib uses pkg-config to figure out where packages are stored)
Foon
  • 6,148
  • 11
  • 40
  • 42
  • I had a go - apart from minor things (eg. --prefix expects a full path), the nest of dependencies made me give up for now. It wouldn't necessarily protect you from system upgrades either - these are graphics packages whose dependencies run quite deep - It'd probably be safer than not compiling though? For now, I've asked the sysadmin to install build deps for matplotlib... – drevicko Oct 22 '13 at 08:34