Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fortran spectral partitioning in windows. #28

Open
cehiles opened this issue Sep 28, 2020 · 5 comments
Open

fortran spectral partitioning in windows. #28

cehiles opened this issue Sep 28, 2020 · 5 comments

Comments

@cehiles
Copy link

cehiles commented Sep 28, 2020

Hello,

First thanks for publishing this super useful toolbox! I have been testing it for the last few days, including the spectral partitioning, on both Linux and Windows. On Linux I can get wavespectra installed as per the installation instructions. On Linux I can get both the pure python and Fortran spectral partitioning to work as expected.

On Windows, I can get wavespectra installed as per the installation instructions. It appears to find my gfortran installation and compile specpart. I can get spectral partitioning working via the pure Python code. When I try to execute partitioning with the Fortran code:

from wavespectra import read_swan
ds = read_swan('./wavespectra/tests/sample_files/swanfile.spec')
ds_part = ds.spec.partition( fortran_code=True)

i get the following error:

Traceback (most recent call last):
File "test_readspec_simple.py", line 7, in <module>
ds_part = ds.spec.partition( fortran_code=True)
File "c:\users\clayton\primed\projects\xxxx\analysis\wavespectra\wavespectra\specarray.py", line 766, in partition from wavespectra.specpart import specpart
ImportError: DLL load failed while importing specpart: The specified module could not be found.

Has the Fortran spectral partitioning been tested on Windows? I am not very familiar with the integration of Fortran code with Python so this error is a bit challenging for me to chase down. Any assistance would be greatly appreciated.

Thank you,

Clayton

@jorgeperezg
Copy link
Member

Hi Clayton,

I gave it a try at some point but I am not familiar with how these things work in windows and I couldn't make it work.

I'll try again but if anyone has any experience with this kind of errors it would be great to get some ideas.

@cehiles
Copy link
Author

cehiles commented Oct 7, 2020

Hi Jorge,

Thanks for the response. I'll keep testing on Linux for now. I'll let you know if I make any headway on getting Fortran partitioning to work on Windows. Cheers!

@cehiles
Copy link
Author

cehiles commented Oct 19, 2020

Hi Jorge,

I managed to get Fortran partitioning working on Windows. First I had to ensure that I had the 64 bit version of MinGW installed. I suspect that this needed match the 64 bit Python I am using. The path to the mingw binaries needs to be on the Windows PATH environment variable.

Next I created a new environment in Anaconda. Installed the dependencies via 'conda install', rather than pip, because for some reason pip was having trouble resolving the dependencies. I installed wavespectra via 'python setup.py install'.

After installation, I had to move some files around in the install directory. The library libspecpart.V2QNEESD6CQQJ6CKLCOFJS5TYBWU4J3X.gfortran-win_amd64.dll had to be copied from \wavespectra.libs\ to \wavespectra\ . I created a new directory \wavespectra\specpart\ . I copied specpart.py from \wavespectra\ to \wavespectra\specpart.

I have not tested extensively, but partitioning with Fortran in Windows now seems to be working.

Cheers!

Clayton

@jorgeperezg
Copy link
Member

Thanks a lot for looking into it. I'll add a link to your comment in the Readme file to help other users that may have similar problems.

@RubendeBruin
Copy link

We managed to get the wavespectra/wavespectra fork on conda-forge.

This means that the compiled version of the fortran module can be obtained by installing wavespectra via conda:

conda install wavespectra -c conda-forge

or

mamba install wavespectra -c conda-forge

this will download the compiled version:

image

I suspect that you can just copy the .pyd file (windows) and use it. Just make sure that you're using the same python version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants