How I got f2py working with 64-bit Windows 7 and Python 3.6

0 views
Skip to first unread message

ahaw...@gmail.com

unread,
Jun 22, 2017, 6:14:03 PM6/22/17
to Anaconda - Public
I had to do a few tricky work-arounds to build a Fortran extension under Python 3.6 this week. We're running Windows 7 and we installed from Anaconda 4.3.1 (64-bit). Our extension module is build by f2py via numpy.distutils, and it requires that we conda install mingw libpython.

When we ran python setup.py install, the first error was "ValueError: Unknown MS Compiler version 1900." The solution was to manually comment out a few lines in the distutils and numpy.distutils code as described by Michael Hirsch.

The next error was

...

running build_py

running build_ext

Looking for python36.dll

Building import library (arch=AMD64): "c:\ProgramData\Anaconda3\libs\libpython36.a" (from c:\ProgramData\Anaconda3\python36.dll)

error: [WinError 2] The system cannot find the file specified


The solution was to copy the file c:\ProgramData\Anaconda3\libs\libpython36.dll.a to ...\libpython.a. Renaming the file probably would have worked too.

Finally, our module failed to load because the compiled extension was named _mymodule.cp36-win_amd64.pyd instead of _mymodule.pyd. After renaming the file everything ran splendidly and we're back to doing science.

Andrew Hawryluk

Will Warner

unread,
Jun 23, 2017, 2:21:37 PM6/23/17
to Anaconda - Public, ahaw...@gmail.com
Thank you for taking the time to record this for posterity! Anyone who runs into these problems in the future and finds your post in a search will be very grateful.

If anyone else reading this overcomes similar problems with advanced or unusual Anaconda use cases, please feel welcome to post about it on the list.
Reply all
Reply to author
Forward
0 new messages