[Biopython] Installation Help

Peter Cock p.j.a.cock at googlemail.com
Tue May 14 14:10:16 UTC 2013


On Tue, May 14, 2013 at 1:38 AM, Tomlin, Joshua James
<tomlin.9 at wright.edu> wrote:
>
> I'm trying to install biopython on my laptop. I have mac os x 10.7.5,
> python 2.7, and have installed numpy I believe.
> I can run the 'import Bio' command in python without any errors but
> when I try run 'python setup.py test' I get 6 errors as seen in the output below:
>
> Basically I need to know if I have done everything I need to do correctly?
> If I have then why are these 6 tests failing and will that impact my future
> use of biopython?

There are four issues here, mostly quite minor:

* NCBI online resource temporarily unavailable, retest should be fine
* Missing test files ( see below)
* Python 2.7.4 made a change to the SAX XML parser (see below)
* GZIP bug in Python 2.7.4 (see below)

There were some unfortunate breakages in Python 2.7.4 which you've
run into, plus missing test files.

If you installed Python 2.7.4 yourself, it might be simplest to replace
it with Python 2.7.3 in the short term. If this came with the Apple OS
then don't do that ;)

> ======================================================================
> ERROR: test_read_from_url (test_Entrez_online.EntrezOnlineCase)
> Test Entrez.read from URL
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test_Entrez_online.py", line 34, in test_read_from_url
>     rec = Entrez.read(einfo)
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/Entrez/__init__.py", line 362, in read
>     record = handler.read(handle)
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/Entrez/Parser.py", line 184, in read
>     self.parser.ParseFile(handle)
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/Entrez/Parser.py", line 322, in endElementHandler
>     raise RuntimeError(value)
> RuntimeError: Unable to open connection to #DbInfo?dbaf=

This is an online test and the NCBI API didn't respond in this case,
if you wait and retry it should work.

> ======================================================================
> ERROR: test_write_multiple_from_blastxml (test_SearchIO_write.BlastXmlWriteCases)
> Test blast-xml writing from blast-xml, BLAST 2.2.26+, multiple queries (xml_2226_blastp_001.xml)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test_SearchIO_write.py", line 55, in test_write_multiple_from_blastxml
>     self.parse_write_and_compare(source, self.fmt, self.out, self.fmt)
>   File "test_SearchIO_write.py", line 27, in parse_write_and_compare
>     SearchIO.write(source_qresults, out_file, out_format, **kwargs)
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/SearchIO/__init__.py", line 610, in write
>     writer.write_file(qresults)
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/SearchIO/BlastIO/blast_xml.py", line 695, in write_file
>     xml.startDocument()
>   File "/Users/joshtomlin/Downloads/biopython-1.61/Bio/SearchIO/BlastIO/blast_xml.py", line 612, in startDocument
>     self.write('<?xml version="1.0"?>\n'
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/saxutils.py", line 103, in write
>     super(UnbufferedTextIOWrapper, self).write(s)
> TypeError: must be unicode, not str

Python 2.7.4 broke our code, see:
http://lists.open-bio.org/pipermail/biopython-dev/2013-April/010505.html

The next Biopython release will fix this, so you could try that
or perhaps downgrade to Python 2.7.3 instead?

> ======================================================================
> ERROR: test_fastq-sanger_Quality_example_fastq_bgz_get_raw (test_SeqIO_index.IndexDictTests)
> Index fastq-sanger file Quality/example.fastq.bgz get_raw
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test_SeqIO_index.py", line 432, in <lambda>
>     f = lambda x : x.get_raw_check(fn, fmt, alpha, c)
>   File "test_SeqIO_index.py", line 272, in get_raw_check
>     raw_file = h.read()
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 253, in read
>     while self._read(readsize):
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 293, in _read
>     self._read_gzip_header()
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 205, in _read_gzip_header
>     self._read_exact(struct.unpack("<H", self._read_exact(2)))
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 185, in _read_exact
>     data = self.fileobj.read(n)
> TypeError: an integer is required

This is a bug in Python 2.7.4, which broke GZIP support.
You can downgrade to Python 2.7.3, wait for 2.7.5, apply
the one line fix by hand: http://bugs.python.org/issue17666 or
ignore this if you do not plan to use BGZF compressed files.

(This explains most of the failures)

> ======================================================================
> ERROR: test_doctests (test_Tutorial.TutorialTestCase)
> Run tutorial doctests.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test_Tutorial.py", line 152, in test_doctests
> ValueError: 4 Tutorial doctests failed: test_from_line_05671, test_from_line_06030, test_from_line_06190, test_from_line_06479

Recently reported bug, I missed two sample data files, see:
http://lists.open-bio.org/pipermail/biopython-dev/2013-May/010599.html

You can download the two missing files:

Doc/examples/my_blast.xml
Doc/examples/my_blat.psl

Available from github or here:
http://biopython.org/SRC/Doc/examples/my_blast.xml
http://biopython.org/SRC/Doc/examples/my_blat.psl

I guess we need to push out Biopython 1.62 sooner rather
than later, which would solve most of these issues.

Thanks for taking the time to report these problems.

Regards,

Peter

(Sorry you'll get this twice Tomlin, I forget to CC the list on my first reply)



More information about the Biopython mailing list