简体   繁体   中英

Installing pygrib Package

Apologies in advance for what is probably a bad/poorly phrased question, but I merely dabble in programming and am very unfamiliar with under the hood aspects of package installation, etc.

Basically, I am trying to install the pygrib package (available here: https://github.com/jswhit/pygrib ) via a cygwin terminal.

I am running Python 2.7.3 32-bit on Windows 10.

Originally I encountered the missing vcvarsall.bat error the first time I tried to run 'python seteup.py build' and followed the advice here: error: Unable to find vcvarsall.bat

After installing the MS Visual Studio package, I have made it past that error and to another I do not understand with the following output:

$ python setup.py build
reading from setup.cfg...running build
running build_py
running build_ext
skipping 'pygrib.c' Cython extension (up-to-date)
building 'pygrib' extension

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\Matthew\Anaconda2\lib\site-packages\numpy\core\include -I/usr/local\include -I/usr/local\include -I/usr/local\include/jasper -I/usr/local\include -I/usr\include -I/usr\include -Ig2clib_src -IC:\Users\Matthew\Anaconda2\include -IC:\Users\Matthew\Anaconda2\PC /Tcpygrib.c /Fobuild\temp.win32-2.7\Release\pygrib.obj
pygrib.c
c:\users\matthew\anaconda2\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 9.0\\VC\\BIN\\cl.exe' failed with exit status 2

Obviously it's still looking for some other files, or needs other environment variables defined, but I'm at a loss as to how to proceed and I'm far from an expert when it comes to any of this.

I'd also be glad to try something completely different if you have a better way to go about this process entirely.

I have tried pip and the conda installer, but have not had any luck with them either.

Thank you in advance for anything you can offer.

Better to use linux on virtual machine within Windows ten. Then you can install pygrib without pain. As you are trying to play with meteorological data, it is recommended to install Linux and it will help you at may places. There is even Anaconda has a package (only for Linux and Mac). You can install using:-

conda install -c conda-forge pygrib=2.0.1

For your specif case following link might be useful:-

https://github.com/jswhit/pygrib/issues/19

https://github.com/jswhit/pygrib/pull/18 and https://github.com/conda-forge/ecmwf_grib-feedstock/issues/5

Gud luck.

对于 python 3,我需要直接使用 linux 包管理器安装它

sudo apt-get install python3-grib

To use: pip install pygrib
you need to install python3-grib:
sudo apt install python3-grib

NOTE:
Ubuntu Linux:
python3-grib requires libeccodes-dev
if later you install libgrib-api-dev it requires libgrib-api-dev.
which is not compatable with libgrib-api-dev
Meaning, if you install libgrib-api-dev after you install python3-grib you break the python3-grib installation.

Take me a while also, but this way was very simple and efficient. I then installed it on pycharm. and on anaconda with

  • pip install pyproj
  • pip install pygrib

I am using Anaconda on Windows 10.

I have accessed Anaconda Prompt for the environment that I wanted to install the package.

In there, I have started by installing pyproj :

pip install pyproj

And then:

conda install -c conda-forge pygrib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM