-
Notifications
You must be signed in to change notification settings - Fork 98
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
Installation Error #184
Comments
there is no windows binary wheel, so it's trying to install from source, and the eccodes C library is not found. If you want to build from source, you have to build the eccodes library first. |
@jswhit, Can you explain precisely please? I have the same problem I think and even with "pip install eccodes" I can't import the module pygrib. × Building wheel for pygrib (pyproject.toml) did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. |
For "you have to build the eccodes library first": so why is eccodes missing in pyproject.toml dependencies?
There is no |
I think this problem probably happens because ecCodes was not installed properly on windows as the developer site mentioned: "Windows is not a native platform for technical work at ECMWF. Therefore, ECMWF will need the help of the external user community to support these versions of ecCodes and Magics in the future". I had the same issue before, but when I migrated to Linux, everything works well. |
I had the same problem with pip. On windows, it may not be possible to install with pip. But you can get it through anaconda (conda install pygrib) with an initial full upgrade of packages (conda update --all --yes). Or you can get a Linux emulator. |
Doesn't seem to be a Windows-specific issue: I encountered this error on macos as well, where the
Possible causeThe README.md section about manually building pygrib mentions that pygrib will
I think in my case it's because I'm using a python virtualenv and not installing dependencies in the typical machine-wide directories. WorkaroundHere's a workaround that explicitly sets the environment variable so pygrib has no problem finding and making use of eccodes: # install dependency manually before attempting to install pygrib
pip install eccodes;
# lookup location of installed eccodes package and set $ECCODES_DIR to it
export ECCODES_DIR="$( pip show eccodes | grep "Location" | cut -d ' ' -f 2 )/eccodes"
# now pygrib will easily find the eccodes location and succeed install
pip install pygrib; I was able to install and use pygrib with this approach, without needing to mix pip with conda, brew, apt, or other package managers like a lot of other workarounds suggest (115, 180, 184, 211 and 19) Ideally |
Any workarounds for windows? Would be good to install it without conda. |
I don't have a tidy Windows cmd script that does the whole install automatically like the above Bash script, but you should be able to follow the same steps on Windows one at a time. The main differences are that you set environment variables with
|
UPDATE: as of pygrib version 2.1.6 (released July 2024), I am no longer encountering this problem. 🎉 🎉 No install workaround was needed now. I just created a brand new virtual environment: python3 -m venv .venv && source .venv/bin/activate Then ran: pip install pygrib==2.1.6 Which eventually printed out:
My environment:
|
I tried to install on Windows 10, 64-bit via powershell and got this...
PS C:\Users\garen> pip install pygrib
Collecting pygrib
Using cached pygrib-2.1.3.tar.gz (21.7 MB)
Installing build dependencies ... done
WARNING: Missing build requirements in pyproject.toml for pygrib from https://files.pythonhosted.org/packages/96/34/f76696b84d0249e41154f3bb3345bd05aa5385bddceb04e6ccbbde5b7ab0/pygrib-2.1.3.tar.gz#sha256=a22552e2e58c9eb9b5750a2d5a8f055334ad2a6a4fb8a6d56261356196ebe651.
WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Collecting numpy
Using cached numpy-1.20.2-cp39-cp39-win_amd64.whl (13.7 MB)
Collecting pyproj
Using cached pyproj-3.0.1-cp39-cp39-win_amd64.whl (14.5 MB)
Collecting certifi
Using cached certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
Building wheels for collected packages: pygrib
Building wheel for pygrib (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python39\python.exe' 'c:\python39\lib\site-packages\pip_vendor\pep517_in_process.py' build_wheel 'C:\Users\garen\AppData\Local\Temp\tmp3m4z_f6s'
cwd: C:\Users\garen\AppData\Local\Temp\pip-install-izcs_lz9\pygrib
Complete output (21 lines):
eccodes not found, build may fail...
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pygrib
copying pygrib_init_.py -> build\lib.win-amd64-3.9\pygrib
running build_ext
cythoning pygrib/_pygrib.pyx to pygrib_pygrib.c
C:\Users\garen\AppData\Local\Temp\pip-build-env-8_bbz0fk\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\garen\AppData\Local\Temp\pip-install-izcs_lz9\pygrib\pygrib_pygrib.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pygrib._pygrib' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\pygrib
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python39\include -Ic:\python39\include -IC:\Users\garen\AppData\Local\Temp\pip-build-env-8_bbz0fk\overlay\Lib\site-packages\numpy\core\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcpygrib_pygrib.c /Fobuild\temp.win-amd64-3.9\Release\pygrib_pygrib.obj
_pygrib.c
C:\Users\garen\AppData\Local\Temp\pip-build-env-8_bbz0fk\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
pygrib_pygrib.c(622): fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe' failed with exit code 2
ERROR: Failed building wheel for pygrib
Failed to build pygrib
ERROR: Could not build wheels for pygrib which use PEP 517 and cannot be installed directly
The text was updated successfully, but these errors were encountered: