pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

'grib_api.h': No such file or directory on Windows

Open zaheerkzz opened this issue 1 year ago • 3 comments

I am trying to install pygrib on windows. i already installed VS build tools for c++ I am getting this error `Building wheels for collected packages: pygrib Building wheel for pygrib (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pygrib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [22 lines of output] eccodes not found, build may fail... running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-38 creating build\lib.win-amd64-cpython-38\pygrib copying src\pygrib_init_.py -> build\lib.win-amd64-cpython-38\pygrib running build_ext cythoning src/pygrib/_pygrib.pyx to src/pygrib_pygrib.c building 'pygrib._pygrib' extension creating build\temp.win-amd64-cpython-38 creating build\temp.win-amd64-cpython-38\Release creating build\temp.win-amd64-cpython-38\Release\src creating build\temp.win-amd64-cpython-38\Release\src\pygrib "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ic:\users\zahee\appdata\local\programs\python\python38\include -Ic:\users\zahee\appdata\local\programs\python\python38\Include -IC:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsrc/pygrib_pygrib.c /Fobuild\temp.win-amd64-cpython-38\Release\src/pygrib_pygrib.obj _pygrib.c C:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION src/pygrib_pygrib.c(756): fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory C:\Users\zahee\AppData\Local\Temp\pip-build-env-a8xx5o11\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\zahee\AppData\Local\Temp\pip-install-9rng5s0e\pygrib_20eaa5920fdd4d09ae6fbbe6d3015227\src\pygrib_pygrib.pyx tree = Parsing.p_module(s, pxd, full_module_name) error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pygrib Failed to build pygrib ERROR: Could not build wheels for pygrib, which is required to install pyproject.toml-based projects`

fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory also tried clone pygrib repo https://jswhit.github.io/pygrib/installing.html but grib_api.h not exists in the path. can anyone help with this issue. I am trying to make an executable using windows. the code running perfect on macos and linux. thank you

zaheerkzz avatar Oct 20 '22 11:10 zaheerkzz

grib_api.h is part of the eccodes C-library that pygrib depends on. You can set the ECCODES_DIR env var to the installation path to fix this.

jswhit avatar Oct 25 '22 01:10 jswhit

grib_api.h is part of the eccodes C-library that pygrib depends on. You can set the ECCODES_DIR env var to the installation path to fix this.

thank you. I will check that solution

zaheerkzz avatar Oct 27 '22 13:10 zaheerkzz

hi @jswhit , here i downloaded EcCodes-win-x64.zip (https://github.com/moonpyk/eccodes-build-windows/releases) file.

unzip and save in C:
set all the paths mentioned here https://github.com/moonpyk/eccodes-build-windows/blob/master/README.md the issue is still same : fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory here are my path: ECCODES_DEFINATION_PATH : C:\ECMWF ECCODES_DEFINITION_PATH : C:\ECMWF\share\eccodes\definitions ECCODES_DIR : C:\ECMWF\bin Is there anything im missing? I installed vs code build tools and eccodes using pip. thank you

zaheerkzz avatar Nov 07 '22 15:11 zaheerkzz

@zaheerkzz were you able to get around this?

LakshyaKhatri avatar Nov 26 '22 14:11 LakshyaKhatri

yes, using conda i installed pygrib, and it worked perfectly, on windows

zaheerkzz avatar Nov 30 '22 10:11 zaheerkzz

Thanks @zaheerkzz 👌🏽

LakshyaKhatri avatar Nov 30 '22 14:11 LakshyaKhatri