6

(1) I have to install one python package (HTSeq) but i dont have root privileges.

The package need python 2.4 or latest version. We have python 2.3 on our cluster.

Thus I installed python 2.7 on my one local directory using

./configure --prefix=/home/amit/tools/localpython 
make 
make install

(2) The package also requires numpy : so I also installed it on my local directory using:

/home/amit/tools/localpython/bin/python2.7 setup.py install --home=/home/amit/tools/localnumpy 

and done

>>> sys.path.append("/home/amit/tools/localnumpy/lib/")

(3) I downloaded the tar file of HTSeq (Which i want to download) and run

/home/amit/tools/localpython/bin/python2.7 setup.py install --home=/home/amit/tools/localhtseq

it is throwing following error:

Could not import 'setuptools',
falling back to 'distutils'.
Setup script for HTSeq: Failed to import 'numpy'.
Please install numpy and then try again to install HTSeq.

Kindly provide me some hint on how to get over it

Thanks in advance

Serge S.
  • 4,855
  • 3
  • 42
  • 46
bioinformatician
  • 364
  • 1
  • 12
  • 27

3 Answers3

8

Setuptools is another requirement which you need to install that package.

One option is to use virtualenv to create a contained python environment. This can be made everywhere and is owned by the user who creates it.

To install virtualenv without admin rights (from this answer):

Download tar.gz of the latest version of virtualenv. Unpack it. You don't even need to install it, just run virtualenv.py, for example:

wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.1.2.tar.gz
tar -xzf virtualenv-1.7.1.2.tar.gz
/home/amit/tools/localpython/bin/python2.7 virtualenv-1.7.1.2/virtualenv.py env

env/bin/pip install HTSeq
env/bin/pip install numpy

Now run your script using the python binary in the virtual environment:

env/bin/python myscript.py
Community
  • 1
  • 1
Jasper van den Bosch
  • 3,169
  • 4
  • 32
  • 55
  • Thanks Jasper Van den Bosch, I will try it (after little googling) using virtualenv as i am unaware of this, if i encounter any prob i will let you know – bioinformatician May 01 '12 at 12:05
  • alright, I have added some commands, let me know how it works out! – Jasper van den Bosch May 01 '12 at 12:23
  • Dear Jasper, its working...i installed both packages and now imported HTseq in current python 2.7 session on terminal. thanks – bioinformatician May 01 '12 at 13:04
  • If you're going to be using virtualenv (which is definitely recommended) you should look into [virtualenvwrapper](http://www.doughellmann.com/projects/virtualenvwrapper/), it makes using lots of virtualenvs simple. – quodlibetor May 01 '12 at 13:26
2

1) You have to install setuptools (it is necessary to run setup.py of your HTSeq).

Download sources tar.gz setuptools-0.6c11.tar.gz, unpack it, and then do the steps like you installed python2.7, but in the folder where you unpacked setuptools sources:

./configure --prefix=/home/amit/tools/localpython 
make 
make install

2) When you will install setuptools, a easy_install executable will apear in python2.7/scripts/ folder. You can use it to install packages easily:

/home/amit/tools/localpython/bin/python2.7/scripts/easy_install HTSeq

it will automatically find the package and will download and install it for you along with all dependencies.

Serge S.
  • 4,855
  • 3
  • 42
  • 46
  • Thanks SergeanT, but sorry to bother you once again - when i type python on terminal, it automatically takes old python version (2.3). I have to use python 2.7. so when i run sh sh setuptools-0.6c11-py2.7.egg it gives an error : setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found – bioinformatician May 01 '12 at 12:02
  • It is better to install setuptools from sources (use `tar.gz` link), then do everything like you installed python2.7 (`./configure --prefix=...`, `make`, `make install`. I have updated my answer with these steps. – Serge S. May 01 '12 at 12:10
0

Another way is to install pip as the local user and then install packages. As explained in the pip docs (check for OS specifics) you can install it as follows - obtain the get-pip.py script, then run it:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

Once it is installed you can then install packages like this:

python -m pip install PACKAGE_NAME
Pierz
  • 7,064
  • 52
  • 59