Brandon Molyneaux
Brandon Molyneaux

Reputation: 1763

pip install package - failed with error code 1/2

I'm having issues installing pygrib using pip. I tried installing pygrib by using easy_install, and I get a similar error.

Using pip I get this error:

Command "C:\Users\Brandon\AppData\Local\Enthought\Canopy\edm\envs\User\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Brandon\\AppData\\Local\\Temp\\pip-build-veulay9n\\pygrib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Brandon\AppData\Local\Temp\pip-ff_s5247-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Brandon\AppData\Local\Temp\pip-build-veulay9n\pygrib\

Using easy_install I get this error:

c:\users\brandon\appdata\local\enthought\canopy\edm\envs\user\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    pygrib.c(242): fatal error C1083: Cannot open include file: 'grib_api.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

In fact, pygrib is the only package that doesn't work when I try pip or easy_install - it works for any package I try to install. What's going on here and how do I fix this issue?

Upvotes: 0

Views: 1581

Answers (2)

phd
phd

Reputation: 94483

pygrib is a Python wrapper for libgrib-api. To compile pygrib you need to compile libgrib-abi and install the library and the header files. Download sources from https://software.ecmwf.int/wiki/display/GRIB/Releases.

Upvotes: 2

jwodder
jwodder

Reputation: 57480

pygrib includes one or more Python extension modules written in C which need to be compiled as part of the installation, and this C code depends upon some library that provides a header file named "grib_api.h". Find and install that C library, and pygrib installation should then work.

Upvotes: 0

Related Questions