I am successfully compiling my Fortran subroutine with f2py. However, a folder is created as well as a pyd file.
If I do not put the created pyd file in the generated folder I get this error
ImportError: DLL load failed: The specified module could not be found.
If I put the generated .pyd file in the generated folder, my python script will run, and the import seems to work. However, if I run print(energy_f2py.__doc__)
None
is the output, and when I try to use the subroutine I get an error AttributeError: module 'energy_f2py' has no attribute 'potential_3'
potential_3
is the name of the subroutine
inside energy_f2py.f90
I have also tried making energy_f2py.f90
a module containing the subroutine, with no difference in results.
This is the pyd file that is generated energy_f2py.cp36-win_amd64.pyd
. I am using the commandline in Pycharm (windows 10 64 bit) to compile the Fortran file using
f2py -c -m energy_f2py energy_f2py.f90
python -m numpy.f2py -c -m energy_f2py energy_f2py.f90
The same thing happens.
It seems weird to me that both the pyd file is created as well as a folder, see the below image
I am stuck at this point... it seems like it is 95% of the way to working...
Lastly, this other post had a solution saying to name the Python and Fortran modules different names. I have tried this, and it did not make a difference either.
The best solution I found which worked was to partition my hardrive and install Linux. I chose to use Lubuntu, but you could use anything.
Everything works as it should on Linux.