ImportError when using Pacon Anaconda grib_api package

I am trying to use ECMWF GRIB_API to access GRIB files with Python. I get this error

Traceback (most recent call last):
  File "/home/martin/markj/JustImportGRIB.py", line 1, in <module>
    from gribapi import *
ImportError: No module named gribapi

One line of code :)

from gribapi import *

I am using Anaconda Python 2.7.12, Linux Centos 64-bit, installed as a user and not adding Anaconda to the path, if necessary - the Python system (2.6) is on the path. I installed GRIB_API from the Pingu Carsti channel , which was Google's best hit. The conda installation did not report any errors.

[martin@bonnie ~]$ anaconda2/bin/conda install -c pingucarsti grib_api=1.10.4
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment /home/martin/anaconda2:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    grib_api-1.10.4            |                3         1.7 MB  pingucarsti

The following NEW packages will be INSTALLED:

    grib_api: 1.10.4-3 pingucarsti

Proceed ([y]/n)? y

Fetching packages ...
grib_api-1.10. 100% |################################| Time: 0:00:01   1.24 MB/s
Extracting packages ...
[      COMPLETE      ]|###################################################| 100%
Linking packages ...
[      COMPLETE      ]|###################################################| 100%

I found some error messages about this error caused by an error in ECMWF GRIB_API, but I don’t know enough about Anaconda (or maybe Python) to figure out how to apply workarounds.

+4
2

GRIB Python pygrib. conda (Miniconda2 Ubuntu 16.04). :

  • pygrib:

    sudo apt-get install libjpeg9

    sudo apt-get install libgrib-api-dev

  • pygrib ecmwf_grib conda-forge.

    conda install -c conda-forge pygrib ecmwf_grib

+1

python-eccodes ( : eccodes, C).

: https://github.com/conda-forge/python-eccodes-feedstock/blob/master/recipe/meta.yaml

ECMWF ecCodes API GRIB API GRIB.

pelson> conda create -n gribby -c conda-forge python-eccodes
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /Users/pelson/miniconda/envs/gribby:

The following NEW packages will be INSTALLED:

    ca-certificates: 2017.7.27.1-0         conda-forge
    curl:            7.54.1-0              conda-forge
    eccodes:         2.4.0-0               conda-forge
    hdf4:            4.2.12-0              conda-forge
    hdf5:            1.8.18-1              conda-forge
    intel-openmp:    2018.0.0-h68bdfb3_7   defaults   
    jasper:          1.900.1-4             conda-forge
    jpeg:            9b-1                  conda-forge
    krb5:            1.14.2-0              conda-forge
    libgfortran:     3.0.1-h93005f0_2      defaults   
    libnetcdf:       4.4.1.1-8             conda-forge
    libpng:          1.6.28-1              conda-forge
    libssh2:         1.8.0-1               conda-forge
    mkl:             2018.0.0-h5ef208c_6   defaults   
    ncurses:         5.9-10                conda-forge
    numpy:           1.13.3-py27h62f9060_0 defaults   
    openssl:         1.0.2l-0              conda-forge
    python:          2.7.14-0              conda-forge
    python-eccodes:  2.4.0-py27_1          conda-forge
    readline:        6.2-0                 conda-forge
    sqlite:          3.13.0-1              conda-forge
    tk:              8.5.19-2              conda-forge
    zlib:            1.2.8-3               conda-forge
#
# To activate this environment, use:
# > source activate gribby
#
# To deactivate an active environment, use:
# > source deactivate
#


pelson> source activate gribby
python(gribby) pelson> python
Python 2.7.14 | packaged by conda-forge | (default, Oct  5 2017, 23:08:53) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gribapi
>>> gribapi.__version__
'2.4.0'
+1

Source: https://habr.com/ru/post/1656329/


All Articles