2016-09-30 9 views
3

ECMWF GRIB_APIを使用してPythonからGRIBファイルにアクセスしようとしています。私はPython Anacondaパッケージを使用している場合のImportError

from gribapi import *

私はアナコンダのPython 2.7.12を使用しています。このエラーにコード:)の

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

つの行を取得するには、LinuxのCentOSには、64ビット、ユーザーとしてインストールしていないにアナコンダを追加しましたpathが該当する場合、システムのPython(2.6)がパス上にあります。 GoogleのトップヒットしたPingu Carsti channelからGRIB_APIをインストールしました。 conda installはエラーを報告しませんでした。

[[email protected] ~]$ 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% 

私はECMWF GRIB_APIのバグによって引き起こされているこのエラーについてsome bug reportsを見つけましたが、私はworkaroundsを適用する方法を見つけ出すためにアナコンダ(あるいはPythonの)について十分に知りません。

+0

PinguCarsti代わりに[conda-フォージ(https://anaconda.org/conda-forge/ecmwf_grib)チャネルを使用するように私に助言しました。私はまだ問題があります。私も[SciTools](https://anaconda.org/scitools/ecmwf_grib)を試しましたが、今でもなお問題があります。 – MarkJ

+0

これはあなたの質問に対する回答ではありませんが、参考になるかもしれません... https://stackoverflow.com/a/44246941/175793 – errata

答えて

1

私はPythonでGRIBファイルをpygribと読んでいます。私はそれをconda仮想環境(Ubuntu 16.04のMiniconda2)にうまくインストールしました。ここでは私のために働いているものです。

  1. はpygribのためのシステムの依存関係をインストールします。

    sudo apt-get install libjpeg9

    sudo apt-get install libgrib-api-dev

  2. はconda鍛造チャンネルからpygribとecmwf_gribをインストールします。

    conda install -c conda-forge pygrib ecmwf_grib

+0

答えをいただき、ありがとうございました。現時点で他のプロジェクトに取り組んでいます... – MarkJ

0

てみのpython-eccodes(注意:それはCライブラリですeccodesではありません)でconda鍛造のビルド。

それが構築されている方法:https://github.com/conda-forge/python-eccodes-feedstock/blob/master/recipe/meta.yaml

ECMWFのecCodesライブラリは、彼らのGRIBのAPIの次のバージョンで、古いGRIB APIに非常に似ています。

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' 
関連する問題