NCAR / NCAR/wrf-python

_wrffortran cannot be found after installing from source

Open
#208 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
498
Forks
178
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/wrf/config.py and the _wrffortran import reached through src/wrf/init.py and api.py. Reproduce pip install . on the reported Windows and Python versions, checking whether the extension and its dependent DLLs are produced; done means importing wrf succeeds without the DLL load error.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.