1

In order to install matplotlib to a non default location, I change the file setup.cfg, setting the variable basedirlist.

I do

python setup.py build

and then

python setup.py install

but the last fail because:

copying build/lib.linux-x86_64-2.6/mpl_toolkits/axes_grid1/colorbar.py -> /opt/python/2.6.4/lib/python2.6/site-packages/mpl_toolkits/axes_grid1
error: could not delete '/opt/python/2.6.4/lib/python2.6/site-packages/mpl_toolkits/axes_grid1/colorbar.py': Read-only file system

I am not root, so how can I install matplotlib? is there any other variable I have to set?

simona
  • 1,679
  • 4
  • 25
  • 35
  • Could you use `easy_install`? This is what I used, try: `easy_install -a -U --install-dir non/default/directory`. Although be aware of http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install – Chris Apr 20 '12 at 10:38
  • thanks, but then I should install easy_install – simona Apr 20 '12 at 15:36

1 Answers1

1

Try with an unmodified version of setup.cfg and run python setup.py install --help There are several options for controlling where the files are installed, the important part of the help message being:

Options for 'install' command:
  --prefix            installation prefix
  --exec-prefix       (Unix only) prefix for platform-specific files
  --home              (Unix only) home directory to install under
  --user              install in user site-package
                      '/home/yannpaul/.local/lib/python2.6/site-packages'
  --install-base      base installation directory (instead of --prefix or --
                      home)

Read over those options and choose which one suits you best.

I recommend, however, to use vertualenv. This sets up, in a directory of your choice, a custom library location and copy of python. All the other libraries (installed by a system admin for example) are available until you install your own copy of the library in this virtualenv.

Virtualenv is also a good option if you want to play around with the development version of a library, matplotlib for example. Setup a virtualenv for these development libraries, then use the python "executable" associated with that virtualenv to get access to the development version of the library.

Check out What's the proper way to install pip, virtualenv, and distribute for Python? to get setup with virtualenv.

Community
  • 1
  • 1
Yann
  • 28,129
  • 7
  • 73
  • 66