xuy/pyipopt

Symbol not found: _PyInt_AsLong in python3

Balandat opened this issue · 5 comments

Thanks a lot for adding python 3 support. Compiling and installing works fine, but I do get the following error when trying to import pyipopt (pyipopt runs great under python 3.7 with the same ipopt library):

import pyipopt
ImportError Traceback (most recent call last)
in ()
----> 1 import pyipopt
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyipopt/init.py in ()
14
15 from ipoptconst import *
---> 16 from pyipoptcore import *
17 from ipoptunconstrained import fmin_unconstrained
18
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyipopt/pyipoptcore.so, 2): Symbol not found: _PyInt_AsLong
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyipopt/pyipoptcore.so
Expected in: flat namespace
in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyipopt/pyipoptcore.so

xuy commented

Looks like Python 3.0 removed the Int_AsLong function for int. Did you compiled it against a Python.h that is 3.0+?

I guess so, I did not choose any Python.h explicitly. I was just compiling
it using macports python 3.4 on OSX. The only change to the setup file was
to modify the ipopt path.

On Wed, Oct 8, 2014 at 12:30 PM, Eric Xu notifications@github.com wrote:

Looks like Python 3.0 removed the Int_AsLong function for int. Did you
compiled it against a Python.h that is 3.0+?


Reply to this email directly or view it on GitHub
#17 (comment).

Hi guy's I ran into the same problem with python 3.2,
I forked the repo and managed to solve it very easily, Just changed PyInt to PyLong in callback.c
I'm able to run the example now.

xuy commented

Thanks for forking, @BrechtBa . Would you mind issue me a pull request so I can merge your changes back?

Just changed PyInt to PyLong in callback.c