4

I'm trying to install virtual-python on linux server which I don't have root access. I have read PEAK development manual for custom installation however I still can't figure out what I'm doing wrong.

Here are my configurations:

created .pythdisutils.cfg

 [install]
 install_lib  = /home2/me/lib
 install_scripts = /home2/me/bin

Python env path in .bashrc:

 export  PYTHONPATH="${PYTHONPATH}:~/lib/"

virtual python installed in:

 ~/lib/python2.4/site-packages
 ~/bin/python

I tried these codes but not successful:

 sh setuptools-0.6c11-py2.4.egg
 sh setuptools-0.6c11-py2.4.egg --prefix=~
 ...

error I get:

 TEST FAILED: /home2/me/lib/ 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:

/home2/me/lib/

and your PYTHONPATH environment variable currently contains:

':~/lib/python2.4/site-packages/:~/lib/python2.4/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:

http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations

Please make the appropriate changes for your system and try again.
john206
  • 537
  • 1
  • 7
  • 15

2 Answers2

3

Your PYTHONPATH doesn't seem to be setup correctly. Try "exec bash", and verify the output of

echo $PYTHONPATH

to contain the expected values. Replace ~ with $HOME.

Oh, and are you actually using bash as shell? Unless you restart your shell and you are using bash, modifying .bashrc of course will not change anything.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
  • Ok I followed your suggestion and I get this: :~/lib/python2.4/site-packages/:~/lib/python2.4/site-packages/:~/lib/:~/lib/:~/lib/:/home2/me:/home2/me after typing echo. I don't why but bashrc doesnt see this weird codes. I did update baschrc tho – john206 Feb 21 '12 at 09:05
  • Don't put just `$HOMÈ`, there, you want `$HOME/lib`. And does it work? – Has QUIT--Anony-Mousse Feb 21 '12 at 09:10
  • Oh no, I put this PYTHONPATH="${PYTHONPATH}:$HOME/lib/" and I get the above line :( – john206 Feb 21 '12 at 09:13
  • Then you didn't execute it yet... You are aware that `.bashrc` is **not automatically re-read**? – Has QUIT--Anony-Mousse Feb 21 '12 at 09:14
  • I did source .bashrc and then exec bash as you said. Do I missing something? – john206 Feb 21 '12 at 09:18
  • Well, if your path still looks as above, it still will not work. Is the missing folder now in your `PYTHONPATH` or not? – Has QUIT--Anony-Mousse Feb 21 '12 at 09:23
  • I removed bashrc and created again, used echo and well this time path became home/me/lib I ran sh setuptools-0.6c11-py2.4.egg and still no luck, now it's complaining [Errno 30] Read-only file system: '/usr/lib/python2.4/site-packages/test-easy-install-29718.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/lib/python2.4/site-packages/ sorry I made you tired. I appreciate your effort – john206 Feb 21 '12 at 09:31
  • Now you just need to read that error and set `--install-dir` and `--prefix` correctly. – Has QUIT--Anony-Mousse Feb 21 '12 at 09:32
  • I set install to /home/me/lib/pythn2.4/site-packages and not working unfortunately – john206 Feb 21 '12 at 09:40
  • Yohoo! It finally worked :D I put both bashrc and pythdistutil..cfg paht to /home2/me/lib/python2.4/site-packages Thanks a lot Anony-Mousse for your effort and patience – john206 Feb 21 '12 at 09:51
0
export PYTHONPATH="${PYTH/home2/me/lib"

This seems... either a typo or wrong. Perhaps you meant...

export PYTHONPATH="$PYTHONPATH:/home2/me/lib"

?

Amber
  • 507,862
  • 82
  • 626
  • 550