NCAR / NCAR/wrf-python

wrf-python installed from conda-forge produces import error

Open
#110 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Installed wrf-pyhton through conda-forge on windows 7 64 bit. Post installation, checked if the package is installed correctly using following command:-

 python -c "import wrf"

and it worked without an error. However, when I ran the script the following error is produced:-

Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wrf
Traceback (most recent call last):
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\__init__.py", line 6, in <module>
    from . import api
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\api.py", line 1, in <module>
    from .config import (xarray_enabled, disable_xarray, enable_xarray,
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\config.py", line 6, in <module>
    from ._wrffortran import (fomp_enabled, fomp_set_num_threads,
ImportError: DLL load failed: The specified path is invalid.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\__init__.py", line 18, in <module>
    from . import api
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\api.py", line 1, in <module>
    from .config import (xarray_enabled, disable_xarray, enable_xarray,
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\config.py", line 6, in <module>
    from ._wrffortran import (fomp_enabled, fomp_set_num_threads,
ImportError: DLL load failed: The specified path is invalid.

I am not sure what causes the problem. Could someone help on this t rectify...

Edit:-

Just to clarify that the same works on Linux version of miniconda.

Edit-2

Uninstalled latest version of wrf-python and installed older version (1.3.0). This time I am getting following error:-

Traceback (most recent call last):
  File "insdvp_app.py", line 30, in <module>
    import utils
  File "Y:\project\insdvpgit\insdvp\utils.py", line 34, in <module>
    from wrf import interplevel
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\__init__.py", line 16, in <module>
    from . import api
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\api.py", line 1, in <module>
    from .config import (xarray_enabled, disable_xarray, enable_xarray,
  File "C:\Users\Sundar\miniconda3\envs\insdvp\lib\site-packages\wrf\config.py", line 6, in <module>
    from ._wrffortran import (fomp_enabled, fomp_set_num_threads,
ImportError: DLL load failed: The specified path is invalid.

Edit-3

Fiddled around with package from https://www.lfd.uci.edu/~gohlke/pythonlibs/. This time it successfully installed (version 1.2.0 as it was the latest at that point of time) and imported without an error. However, while reading the wrfout file, the script closed without producing an error.

To check if the problem exist in window 10, I installed the module on a freshly installed miniconda. This time it did not show any error as I have observed in windows 7. However, It simply closes without producing any error when reading a wrfout netcdf file as seen in latest try on windows 7.

Edit-4
Checked the wheel package today again at https://www.lfd.uci.edu/~gohlke/pythonlibs/#wrf_python and found the latest version 1.3.2. Uninstalled the conda version and installed whell package from link. Finally, It worked :-)

Something is wrong with conda install on windows. You guys may want to chack it out...

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

Reproduce the conda-forge installation on Windows 7 with the reported python -c "import wrf" command. Read wrf/__init__.py and wrf/config.py around the _wrffortran import, then compare the conda package with the working wheel; done means the conda installation imports and reads a wrfout NetCDF file without the DLL failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.