the correct way to install python packages as non root user in nondefault path

N

News123

Hi,

I'm having an Ubuntu host, but want to (experimentally)
install some modules, which are newer than the Ubuntu ones
(distros lag always a little behind and some tools need newer versions.)


What would be a clean way to do this?
I want to be sure, that any 'special hacks' on my host are cleanly
separated from the default installation.


I thought about installing some newer packets for example under
/opt/newpymods # or any other name
and change the python path such, that modules will first be searched
there and only then in the default path.


Is this a viable approach?

How exactly would I have to set PYTHONPATH?

I'm asking, as I had some problems installing a new version of coherence.

What I did:

##### download a newer version of Coherence
cd /downloads
svn co https://coherence.beebits.net/svn/tags/Coherence-0.6.2 Coherence

#### create a new directory for all 'newer' python modules
mkdir -p /opt/newpymod
export PYTHONPATH=/opt/newpymod
python setup.py install --prefix /opt/newpymod
### this fails, so I'll adapt PYTHONPATH
export PYTHONPATH=/opt/newpymod/lib/python2.5/site-packages
mkdir -p /opt/newpymod/lib/python2.5/site-packages
### now I get quite some error messages
running install
running bdist_egg
running egg_info
writing requirements to Coherence.egg-info/requires.txt
writing Coherence.egg-info/PKG-INFO
writing top-level names to Coherence.egg-info/top_level.txt
writing dependency_links to Coherence.egg-info/dependency_links.txt
writing entry points to Coherence.egg-info/entry_points.txt
package init file 'misc/__init__.py' not found (or not a regular file)
Traceback (most recent call last):
File "setup.py", line 124, in <module>
setup(**setup_args)
File "/usr/lib/python2.5/distutils/core.py", line 151, in setup
. . .


thanks in advance for any help
 
N

News123

Hi Alex,


Thanks a lot. Reading the description this sounds to be the right thing.


But now I'm stuck installing virtualenv as a user as this seems to be no
ubunbtu package:


export PYTHONPATH=/opt/newpymod/lib/python2.5/site-packages
mkdir -p $PYTHONPATH
easy_install --prefix /opt/newpymod install virtualenv
Creating /opt/newpymod/lib/python2.5/site-packages/site.py
Searching for install
Reading http://pypi.python.org/simple/install/
Couldn't find index page for 'install' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for install
error: Could not find suitable distribution for Requirement.parse('install')


So back to question 1 :-(
How do I install non Ubuntu python packages in a local directory?
 
D

Diez B. Roggisch

News123 said:
Hi Alex,


Thanks a lot. Reading the description this sounds to be the right thing.


But now I'm stuck installing virtualenv as a user as this seems to be no
ubunbtu package:


export PYTHONPATH=/opt/newpymod/lib/python2.5/site-packages
mkdir -p $PYTHONPATH
easy_install --prefix /opt/newpymod install virtualenv

Just because apt-get uses "install" as command doesn't mean everything else
does. And easy_install is one of those which doesn't. Remove the "install",
and things should work.

Additionally, I don't see any problem with installing virtualenv into the
system-python. It's an addon, not a replacement, thus it shouldn't collide
with package management (unless you are going to remove python)

Diez
 
N

News123

Danke Diez,

easy_install without 'install' works better :) .

As as you indicated: Virtualenv installs cleanly in a separate directory
named virtualenv-1.3.3-py2.5.egg,

So I removed the --prefix option and installed it in the default path.

By the way: Adding the word 'install' wasn't inspired by apt-get, but by
"python ./setup.py", which also seems to want a 'command'

bye

N
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top