How to update Biopyhton?
1
0
Entering edit mode
4.2 years ago
JV ▴ 410

Somehow I can't update my biopython module on my system. I currently have biopython v1.65 for python 2.7.6 installed. I want to update it, because some bugs in the Entrez-submodule have been fixed in the meantime.

So I tried updating with pip --install --upgrade biopython. Biopython 1.68 is downloaded, and the install begins. However I get this error message at the end:

[...]
error: could not delete '/usr/local/lib/python2.7/dist-packages/Bio/KEGG/Enzyme/__init__.py': Permission denied

----------------------------------------
  Can't roll back biopython; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_john/biopython/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-JgDMcb-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_john/biopython
Traceback (most recent call last):
  File "/usr/bin/pip2", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip2')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 40: ordinal not in range(128)

So i thought, maybe I need admin rights to install my python modules (Can't remember how I originally installed them exactly, only that i used pip)?

So I tried again with sudo pip install --upgrade biopython. Now I get no error message, just these warnings at the end:

 [...]
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.py{}' found anywhere in distribution
    warning: no previously-included files matching '*.py-e' found anywhere in distribution
Successfully installed biopython
Cleaning up...

When I then start a python shell and run

 import Bio
 print Bio.__version__

I still get version 1.65! So biopython was not updated at all! What am I doing wrong?

biopython python linux pip • 3.2k views
ADD COMMENT
3
Entering edit mode

Could you check the python version and pip version you are using? e.g. use which python and which pip to find out the path to the executable

Alternatively, try running pip as:

(sudo) python -m pip install biopython --upgrade

(to make sure the correct python interpreter is combined with the correct pip)

Finally, I recommend using conda (and pip) from anaconda

ADD REPLY
1
Entering edit mode

Hi,

my pip version is: pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

my python version is Python 2.7.6

running pip per your suggestion gave me the same result

I guess i could create a virtual (Conda) python environment and try from within there, but basically it should work without that shouldn't it?

As I get it, I basically need Conda environments mostly if I want to switch easily between python versions (Which i never had to do to this day) or if you want to easily install dependencies without admin-rights (I am working on my own system and can "sudo" everything).

So until now I never felt the need to create virtual python environments on my system (I am using them on my institutes servers, however)

ADD REPLY
1
Entering edit mode

I agree, it should work. But having multiple python environments sure is troublesome. Is your python 2.7.6 also the one in /usr/lib/python2.7/?

ADD REPLY
1
Entering edit mode

Well the shebangs of the *.py files in that folder seem to point either directly to this python executable or to "/usr/bin/env python" which in turn also points to this python executable

ADD REPLY
1
Entering edit mode

Oh and isn't that pip version terribly outdated? We're currently at pip 9.0.1. Maybe updating that might also help...

ADD REPLY
1
Entering edit mode

I tried updating pip several times. Still end up with the same old pip version. Seems to be the same issue as with the biopython update. Probably some conflict with the "System-python" V2.6 and my own python 2.7 (although can't remember having any issue with that before)?

Anyway i ditched that completely and am now using Conda environments instead, as you suggested. Seems to be a good workaround.

ADD REPLY
2
Entering edit mode
4.2 years ago
JV ▴ 410

OK never mind, I guess this has something to do with the fact that I have to maintain 2.6 as the "system"-python and have python 2.7 and python 3.5 installed in parallel.

Never seemed to have in Issue with that before, but it seems the easiest way is to follow the general recommendation and only use python from within CONDA environments. ( as WouterDeCoster recommended in the comments also). I thought this was only necessary when you worked on a server where you have no admin rights, but apparently I was wrong with that.

After ditching my current python-installs and now working exclusively from within conda environments everything seems to work, so I#ll just go with that.

ADD COMMENT

Login before adding your answer.

Traffic: 2344 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6