2

Preface

I am so new to ssh/unix protocols that I hope I don't offend anybody.

Context

I am using the cores at my university, and do not have root access. Thus, when I install python modules, I resort to the answer on these two related stack overflow posts:

1) How to install python modules without root access?
2) How to install python packages without root privileges?

In the second post, Col Panic highly recommends getting pip or easy_install on the cores, and if they are not already there, 'you should politely ask the admins to add it, explaining the benefit to them (they won't be bothered anymore by requests for individual packages)."

Following that piece of advice, I request that the admin put easy_install on all the cores. They did and after some proverbial futzing around with export, PATH and PYTHONPATH, I was able to get numpy and scipy on the cores and import them into iPython environment.

Unfortunately, there was some problems with matplotlib related to this question: ImportError: No module named backend_tkagg

I thought I could just ignore this problem related to SUSE by pickling everything and then plotting it on my laptop.

My Problem

I really do need NetworkX. I wrote down some notes on all the small intricacies that I used to install the other packages my last go, but failed this time around. Maybe I am forgetting something that I did last time?

nemo01.65$ easy_install --prefix=/u/walnut/h1/grad/cmarshak/xdrive/xpylocal networkx
TEST FAILED: /u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages does
NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

  /u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages

and your PYTHONPATH environment variable currently contains:

  '/u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python2.7/site-packages'

Here are some of your options for correcting the problem:

  * You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files

  * You can add the installation directory to the PYTHONPATH environment
    variable.  (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)

  * You can set up the installation directory to support ".pth" files by
    using one of the approaches described here:

    https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.

My Attemps to Fix This

I really do networkx otherwise I have to adjust a bunch of my code that I want to put on the clusters.

1) I typed in:

export PYTHONPATH=/u/walnut/h1/grad/cmarshak/xdrive/xpylocal/lib/python3.3/site-packages

into the bash environment. No luck...

2) I asked another grad for some help. He suggested I install pip via easy_install, which I did and then use:

pip install --user networkx

When I type in:

find ./local/lib/python2.7/site-packages/ | grep net

I get a ton of files that are all from the networkx library. Unfortunately, there is still some problems with dependencies.

THANK YOU IN ADVANCE FOR YOUR HELP. Really enjoy learning new things from your answers.

Community
  • 1
  • 1
Charlie
  • 179
  • 13

1 Answers1

1

It looks like there are multiple versions of pip floating around (cf pip: dealing with multiple Python versions? ). Try installing pip using a specific version of easy_install. For example, this gave me a pip2.7

walnut.39$ easy_install-2.7 -U --user pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 1.5.6
Processing pip-1.5.6-py2.7.egg
pip 1.5.6 is already the active version in easy-install.pth
Installing pip script to /u/walnut/h1/grad/rcompton/.local/bin
Installing pip2.7 script to /u/walnut/h1/grad/rcompton/.local/bin
Installing pip2 script to /u/walnut/h1/grad/rcompton/.local/bin

Using /net/walnut/h1/grad/rcompton/.local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
walnut.40$ 

Then use pip2.7

walnut.40$ pip2.7 install --user networkx

Also, for non-root package installations, I've got the follow lines in my .bashrc:

export PYTHONPATH=$PYTHONPATH:$HOME/.local/lib/python2.7/site-packages        
export PATH=$PATH:~/.local/bin
dranxo
  • 3,148
  • 4
  • 32
  • 44