Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » libsbml-development » python binding
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
fbergman


Posts: 122
Registered:
February 2010
Re: python binding 23 Dec '11 17:28 Go to previous messageGo to previous message

Hello Kieran …

it should be simpler than all that, the DMG installer for lion contains the binaries. They are installed by default into

/usr/local/lib/python2.7/site-packages/

so running:

$ PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from libsbml import *
>>> print getLibSBMLDottedVersion()
5.3.0
>>>

would be all that is needed. These binaries are also universal:

file python2.7/site-packages/libsbml/_libsbml.so
python2.7/site-packages/libsbml/_libsbml.so: Mach-O universal binary with 2 architectures
python2.7/site-packages/libsbml/_libsbml.so (for architecture i386): Mach-O bundle i386
python2.7/site-packages/libsbml/_libsbml.so (for architecture x86_64): Mach-O 64-bit bundle x86_64


so they include the 32 and 64bit bindings. So is the default python on OSX:

$ file `which python`
/usr/bin/python: Mach-O universal binary with 2 architectures
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386): Mach-O executable i386

So you simply switch it to 64 / 32 bit mode as needed with an environment variable:

VERSIONER_PYTHON_PREFER_32_BIT=no

to force 64bit mode or yes for 32bit mode.

When you want to compile it yourself on osx it is sufficient to compile with:

./configure --with-python --enable-universal-binaries=yes

best
Frank

On Dec 23, 2011, at 5:13 PM, kieran wrote:

> Hello all,
>
> I've decided to give python a go, but have been having real problems
> getting it to speak to libSBML. All problems below may just be my being
> a python newb, but thought I should ask.
>
> I installed enthought (on my Mac OSX lion), a 64 bit python package
> located by default at
> /Library/Frameworks/EPD64.framework/Versions/Current/bin/python
>
> After installing the stable 5.3.0 binary, I followed the instructions,
> changing ~/.bashprofile to include the line
> export PYTHONPATH=/usr/local/lib/python2.7/site-packages
> and the permissions of all files located there. However, typing
>> from libsbml import *
> produced
>> Fatal Python error: Interpreter not initialized (version mismatch?)
> Further investigation revealed that the .py and .pyc files were missing,
> with __init__.py/c in their place.
>
> So I decided to try the experimental binary instead. This time the error was
>> ImportError: No module named libsbml
> and I saw that the file libsbml.pyc was missing.
>
> Finally, I decided to try compiling the (stable) source with
> ./configure
> --with-python=/Library/Frameworks/EPD64.framework/Versions/Current
> but I ran into the same problems (error and wrongly named files) as when
> using the stable binary.
>
> Any ideas what I'm doing wrong?
>
> Cheers,
> k
>
> --
> kieran smallbone
> kieran.smallbone@manchester.ac.uk
> http://u003f.com/
>
> manchester centre for integrative systems biology
> manchester interdisciplinary biocentre
> 131 princess street
> manchester m1 7dn. uk
> ____________________________________________________________
> To manage your libsbml-development list subscription, visit
> https://utils.its.caltech.edu/mailman/listinfo/libsbml-development
>
> For a web interface to the libsbml-development mailing list, visit
> http://sbml.org/Forums/
>
> For questions or feedback about the libsbml-development list,
> contact sbml-team@caltech.edu
>

____________________________________________________________
To manage your libsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/libsbml-development

For a web interface to the libsbml-development mailing list, visit
http://sbml.org/Forums/

For questions or feedback about the libsbml-development list,
contact sbml-team@caltech.edu

      

SubjectPosterDate
Read Message   python binding kieransmallbone23 Dec '11 17:13
Read Message   Re: python binding  fbergman23 Dec '11 17:28
Read Message   Re: python binding kieransmallbone24 Dec '11 10:17
Read Message   Re: python binding fbergman24 Dec '11 11:23
Read Message   Re: python binding with enthought kieransmallbone29 Dec '11 05:14
Previous Topic:Release of libSBML-5.4.0
Next Topic:Release of libSBML-5.3.0
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.