[Biopython] Bio won't import in *.py scripts

Michiel de Hoon mjldehoon at yahoo.com
Fri Dec 18 23:54:52 UTC 2009


Good to hear you found a solution.
Just for some background information:
The reason /usr/bin/python couldn't find Biopython is that you have Biopython installed with the python in /Library/Frameworks/Python.framework/Versions/2.5/bin/python. These two pythons don't know about each other, so anything you install for one python is not seen by the other python. If you want to use /usr/bin/python in your scripts, another solution would have been to install Biopython for that python using /usr/bin/python setup.py build followed by /usr/bin/python setup.py install. But usually it's better to leave the Apple-installed python in /usr/bin/python alone, and to install modules for /Library/Frameworks/Python.framework/Versions/2.5/bin/python, and use that python.

--Michiel. 


--- On Fri, 12/18/09, Jeff Tomkins <jtomkins at ICR.org> wrote:

> From: Jeff Tomkins <jtomkins at ICR.org>
> Subject: Re: [Biopython] Bio won't import in *.py scripts
> To: "Michiel de Hoon" <mjldehoon at yahoo.com>
> Date: Friday, December 18, 2009, 1:27 PM
> I got some advice from Angel V. and
> added the following lines to my .profile and the scripts now
> import Bio - it looks like  it worked and fixed the
> issue.  Thanks for getting back with me! 
> -jeff
> 
> PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/biopython-1.52-py2.5-macosx-10.3-fat.egg:${PYTHONPATH}"
> export PYTHONPATH
> 
> 
> On Dec 18, 2009, at 2:35 AM, Michiel de Hoon wrote:
> 
> > If you start python in the terminal, does it start
> /usr/bin/python or a different python?
> > 
> > --- On Thu, 12/17/09, Peter Cock <p.j.a.cock at googlemail.com>
> wrote:
> > 
> >> From: Peter Cock <p.j.a.cock at googlemail.com>
> >> Subject: Re: [Biopython] Bio won't import in *.py
> scripts
> >> To: "Jeff Tomkins" <jtomkins at icr.org>
> >> Cc: "Biopython at lists.open-bio.org"
> <Biopython at lists.open-bio.org>
> >> Date: Thursday, December 17, 2009, 5:59 PM
> >> Hi Jeff,
> >> 
> >> On Thu, Dec 17, 2009 at 7:43 PM, Jeff Tomkins
> <jtomkins at icr.org>
> >> wrote:
> >>> I installed biopython 1.52 as directed for OS
> X
> >> leopard.
> >>>  Everything imports using the python
> prompt in the
> >> terminal,
> >>> idle, ipython, wing ide, etc.
> >> 
> >> Good :)
> >> 
> >>> But when I run a standard python script
> >> (#!/usr/bin/python)
> >>> in the shell it cannot locate Bio.  What
> setup
> >> feature have I missed?
> >> 
> >> That does seem odd. You didn't call your script
> Bio.py did
> >> you?
> >> Could you show us the error message?
> >> 
> >> Peter
> >> 
> >> _______________________________________________
> >> Biopython mailing list  -  Biopython at lists.open-bio.org
> >> http://lists.open-bio.org/mailman/listinfo/biopython
> >> 
> > 
> > 
> > 
> 
> 


      




More information about the Biopython mailing list