jronayne / PyTransport

A Python Package for the calculation of inflationary correlation functions.
Other
14 stars 3 forks source link

Cannot run any examples: `Py_InitModule3` is no longer part of Python.h #10

Open rjrosati opened 1 year ago

rjrosati commented 1 year ago

Hi,

I've been trying to verify the results of another transport method package by running PyTransport, but have run into some issues. I'm not sure what environment PyTransport needs or what its dependencies on the Python version are. See #9 for another issue I encountered but was able to resolve with the gravipy dependency.

After applying the fix I dicussed in #9 and trying to run the DoubleQuadNC example, the compilation of the generated PyTrans.cpp fails with the error:

/home/robbie/code/PyTransport/PyTransport/PyTrans/PyTrans.cpp: In function ‘int initPyTransDQuadNC()’:
/home/robbie/code/PyTransport/PyTransport/PyTrans/PyTrans.cpp:692:42: error: ‘Py_InitModule3’ was not declared in this scope
  692 | int initPyTransDQuadNC(void)    {        Py_InitModule3("PyTransDQuadNC", PyTransDQuadNC_funcs,                       "Extension module for inflationary statistics");        import_array();   }//initFunc

After some googling, it seems that Py_InitModule3 has not been part of the Python C extensions for some time, and a different module initialization setup is now necessary: http://python3porting.com/cextensions.html

Perhaps this is not a problem with the appropriate Python version, but I haven't yet been able to guess the right environment.

dmulryne commented 1 year ago

Hi, Did you get this working? Please email me directly on d.mulryne@qmul.ac.uk if you want help. We are still actively using the package in my group and have a number of other users, but you are right there are often system/version dependent issues that require a but of googling to resolve. Because of the way things are set up to compile for each model of inflation its not so easy to set up for pip install as you suggest. Best wishes, David