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

_wrffortran cannot be found after installing from source #208

Open
am-thyst opened this issue May 21, 2023 · 2 comments
Open

_wrffortran cannot be found after installing from source #208

am-thyst opened this issue May 21, 2023 · 2 comments

Comments

@am-thyst
Copy link

pip install . runs successfully, but when importing wrf in python I get the following error:

Traceback (most recent call last):
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\__init__.py", line 6, in <module>
    from . import api
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\api.py", line 1, in <module>
    from .config import (xarray_enabled, disable_xarray, enable_xarray,
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\config.py", line 6, in <module>
    from ._wrffortran import (fomp_enabled, fomp_set_num_threads,
ImportError: DLL load failed while importing _wrffortran: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\__init__.py", line 18, in <module>
    from . import api
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\api.py", line 1, in <module>
    from .config import (xarray_enabled, disable_xarray, enable_xarray,
  File "C:\Users\User\anaconda3\envs\wrfenv_rcapetest\Lib\site-packages\wrf-python\src\wrf\config.py", line 6, in <module>
    from ._wrffortran import (fomp_enabled, fomp_set_num_threads,
ImportError: DLL load failed while importing _wrffortran: The specified module could not be found.

I'm trying to install from source so I can have more control over the calculations in the fortran scripts. I'm happy to use conda install if there's some way to manually change the fortran calculations, but I can't see that functionality.

Versions:

  • OS: Windows 11
  • Python 3.11.3
  • numpy 1.23.5
  • wrapt 1.14.1
  • setuptools 67.7.2
@jnava1612
Copy link

Got the same error while trying to work with Python 3.11.1, however it's the first time i got the error, since I was able to use wrf-python without any errors before. Were you able to solve it?

@DWesl
Copy link
Contributor

DWesl commented Jun 26, 2024

My guess would be either PATH issues (you linked against some libraries python can't find: try copying them to the same directory as _wrffortran. The Fortran runtime library is the most obvious candidate) or permission issues (try the Windows version of chmod u+x _wrffortran*.dll). You can get more detail with python -vvvdc 'import wrf', but I'm guessing you've checked the big thing it would tell you (does site-packages/wrf/_wrffortran.*py311*.dll (or whatever the name is) exist, and do the tags in the name match?)

As an alternative, are the variants on the calculations in Fortran something you think others would be interested in? If so, submitting those as a PR might be able to side-step the problems with building from source.

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