[Tutor] Biopython

Walter Prins wprins at gmail.com
Tue Apr 10 23:01:01 CEST 2012

Hi Laura,

On 10 April 2012 22:25, Laura Scearce <flitrfli at gmail.com> wrote:

> I am using Linux version 2.6 and python version 2.6.6 (gcc version 4.4.5).

What distribution of Linux?  (Ubuntu, Debian, Centos or something else?)

I followed the instructions and it seemed to work (see below error
> messages).
> [snip...]

> compilation terminated.
> error: Setup script exited with error: command 'gcc' failed with exit
> status 1

That means gcc is likely not installed.  GCC is the GNU C compiler.  On
Linux, Python modules written in C needs GCC to be able to install.  I
imagine BioPython is written in C, which would explain why it wants GCC
during installation.

On Ubuntu/Debian, you can fix the lack of GCC by using the following

sudo apt-get install build-essential

This will install the "build-essential" package which includes GCC and a
bunch of other development tools.  (If you're not using Debian or Ubuntu or
a distribution based on Debian the above command won't work.)

> *I also tried it in the directory Downloads, because this is where the
> easyinstall was downloaded to. Same message.

After installing "easy_install" into your Python environment, the
originally downloaded file is redundant/irrelevant to the functioning of
easy_install, so the folder you're in doesn't actually matter.  Which is
why you get the same message. :)

> Then I tried downloading Biopython from
> http://pypi.python.org/pypi/biopython
> I downloaded biopython-1.59.tar.gz<http://pypi.python.org/packages/source/b/biopython/biopython-1.59.tar.gz#md5=c83b26cc1bc2b2ecdce28c1b5e49110d>.
> and extracted it to the folder BLAST-SW in my Documents folder.
> Here is what I tried:
> debbie at debbie-VirtualBox:~/Documents/BLAST-SW$ sh biopython-1.59.tar.gz
> sh: Can't open biopython-1.59.tar.gz
> debbie at debbie-VirtualBox:~$ sh biopython-1.59.tar.gz
> sh: Can't open biopython-1.59.tar.gz
> debbie at debbie-VirtualBox:~/Documents/BLAST-SW$ sh biopython-1.59
> *This had no error message, but I think that Biopython is not installed
> because:
> >>> import Bio
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named Bio

A .tar.gz file is not a shellscript file or bundle.  It is a type of
archive file, and to extract it you need to use the "tar" command or a GUI
tool that can read tar.gz files.  (I'm a tad puzzled as you seem to
understand this file needs to be extracted, yet the commands you issue
implies you seem to think you can run the file as-is?)  Normally you'd use
a command like this:

tar -zxvf  biopython-1.59.tar.gz

... which will extract the the biopython-1.59.tar.gz file into the current
folder.  In case the files in the archive are not in a subfolder it's
therefore  a bit
safer to create your own targer folder first, then extract from within this
new folder, e.g. something like:

mkdir biopython
cd biopython
tar -zxvf  ../biopython-1.59.tar.gz

Finally having briefly scanned the biopython download page, I want to point
out that there are Biopython packages available for Ubuntu/Debian systems,
so if you're using one of these Linux distributions you should
preferentially use Synaptic (or another Debian package tool like apt-get or
aptitude) to install BioPython as this will be a lot less grief.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120410/15f2caa6/attachment.html>

More information about the Tutor mailing list