[SciPy-User] Building Python wheels with Fortran on Windows 10 under Python 3.8

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Building Python wheels with Fortran on Windows 10 under Python 3.8

Johann Rohwer
Hi all

First of all, my apologies if this is not the right place for this query, if so, please direct me to a more appropriate forum.

We have developed a Python package for computational systems biology that wraps two Fortran extension modules:
https://github.com/PySCeS/pysces

For the distribution of binary wheels under Windows I've been compiling the Fortran extension modules with  MinGWin and using MSVC++ compiler to compile the Python extension, as implimented in numpy distutils and explained in detail in this blog post:
https://pav.iki.fi/blog/2017-10-08/pywingfortran.html

This has been working fine for previous versions of Python (3.6 and 3.7), but under Python 3.8 the DLL won't load, I get the following error message when trying to import the package:
DLL load failed while importing pitcon: The specified module could not be found.
INFO: Pitcon import failed: continuation not available
DLL load failed while importing nleq2: The specified module could not be found.
INFO: NLEQ2 import failed: option not available
This is using Python 3.8.1 downloaded from python.org under Windows 10 64-bit, also using 64-bit MinGWin.

When building the package under Python 3.8, the compile runs without error and the DLL files get packaged in the .libs folder beneath the top-level package folder, as for the other Python versions. Only problem is that they can't be loaded during import.

Dependencies for the build (numpy, scipy, matplotlib) are installed using pip into a clean install of the respective Python version:
matplotlib        3.1.2
numpy             1.18.1
scipy             1.4.1

Has anything changed in how this is handled under Python 3.8? I'm stymied because it all works off exactly the same code base under Python 3.6 and 3.7, and moreover the compile and wheel build completes without error, also on Python 3.8.

Thanks,
Johann


The integrity and confidentiality of this e-mail is governed by these terms / Die integriteit en vertroulikheid van hierdie e-pos word deur die volgende bepalings gereël. http://www.sun.ac.za/emaildisclaimer

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Building Python wheels with Fortran on Windows 10 under Python 3.8

tomobbe
Johan,

Have you read the porting notes for 3.8? There's a change to how libraries on Windows are loaded. You will likely need to use the new `os.add_dll_directory()` function.


Regards,
James



On Mon, 13 Jan 2020 at 10:09, Johann Rohwer <[hidden email]> wrote:
Hi all

First of all, my apologies if this is not the right place for this query, if so, please direct me to a more appropriate forum.

We have developed a Python package for computational systems biology that wraps two Fortran extension modules:
https://github.com/PySCeS/pysces

For the distribution of binary wheels under Windows I've been compiling the Fortran extension modules with  MinGWin and using MSVC++ compiler to compile the Python extension, as implimented in numpy distutils and explained in detail in this blog post:
https://pav.iki.fi/blog/2017-10-08/pywingfortran.html

This has been working fine for previous versions of Python (3.6 and 3.7), but under Python 3.8 the DLL won't load, I get the following error message when trying to import the package:
DLL load failed while importing pitcon: The specified module could not be found.
INFO: Pitcon import failed: continuation not available
DLL load failed while importing nleq2: The specified module could not be found.
INFO: NLEQ2 import failed: option not available
This is using Python 3.8.1 downloaded from python.org under Windows 10 64-bit, also using 64-bit MinGWin.

When building the package under Python 3.8, the compile runs without error and the DLL files get packaged in the .libs folder beneath the top-level package folder, as for the other Python versions. Only problem is that they can't be loaded during import.

Dependencies for the build (numpy, scipy, matplotlib) are installed using pip into a clean install of the respective Python version:
matplotlib        3.1.2
numpy             1.18.1
scipy             1.4.1

Has anything changed in how this is handled under Python 3.8? I'm stymied because it all works off exactly the same code base under Python 3.6 and 3.7, and moreover the compile and wheel build completes without error, also on Python 3.8.

Thanks,
Johann


The integrity and confidentiality of this e-mail is governed by these terms / Die integriteit en vertroulikheid van hierdie e-pos word deur die volgende bepalings gereël. http://www.sun.ac.za/emaildisclaimer

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Building Python wheels with Fortran on Windows 10 under Python 3.8

Johann Rohwer
Thanks very much James, I had missed this! It fixes the issue.

Regards,
Johann

On 13/01/2020 13:33, James wrote:
Johan,

Have you read the porting notes for 3.8? There's a change to how libraries on Windows are loaded. You will likely need to use the new `os.add_dll_directory()` function.


Regards,
James



On Mon, 13 Jan 2020 at 10:09, Johann Rohwer <[hidden email]> wrote:
Hi all

First of all, my apologies if this is not the right place for this query, if so, please direct me to a more appropriate forum.

We have developed a Python package for computational systems biology that wraps two Fortran extension modules:
https://github.com/PySCeS/pysces

For the distribution of binary wheels under Windows I've been compiling the Fortran extension modules with  MinGWin and using MSVC++ compiler to compile the Python extension, as implimented in numpy distutils and explained in detail in this blog post:
https://pav.iki.fi/blog/2017-10-08/pywingfortran.html

This has been working fine for previous versions of Python (3.6 and 3.7), but under Python 3.8 the DLL won't load, I get the following error message when trying to import the package:
DLL load failed while importing pitcon: The specified module could not be found.
INFO: Pitcon import failed: continuation not available
DLL load failed while importing nleq2: The specified module could not be found.
INFO: NLEQ2 import failed: option not available
This is using Python 3.8.1 downloaded from python.org under Windows 10 64-bit, also using 64-bit MinGWin.

When building the package under Python 3.8, the compile runs without error and the DLL files get packaged in the .libs folder beneath the top-level package folder, as for the other Python versions. Only problem is that they can't be loaded during import.

Dependencies for the build (numpy, scipy, matplotlib) are installed using pip into a clean install of the respective Python version:
matplotlib        3.1.2
numpy             1.18.1
scipy             1.4.1

Has anything changed in how this is handled under Python 3.8? I'm stymied because it all works off exactly the same code base under Python 3.6 and 3.7, and moreover the compile and wheel build completes without error, also on Python 3.8.

Thanks,
Johann


The integrity and confidentiality of this e-mail is governed by these terms / Die integriteit en vertroulikheid van hierdie e-pos word deur die volgende bepalings gereël. http://www.sun.ac.za/emaildisclaimer

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fscipy-user&amp;data=02%7C01%7C%7Cadcf4fdcb5374224bacb08d7981c9b79%7Ca6fa3b030a3c42588433a120dffcd348%7C0%7C0%7C637145121638992439&amp;sdata=CWM3XPrP1v2Q3l2OBG7ikbSDHRB3guzGbraBdMtD1qM%3D&amp;reserved=0

The integrity and confidentiality of this e-mail is governed by these terms / Die integriteit en vertroulikheid van hierdie e-pos word deur die volgende bepalings gereël. http://www.sun.ac.za/emaildisclaimer

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user