NOAA-MDL / grib2io

Python interface to the NCEP G2C Library for reading and writing GRIB2 messages.
https://noaa-mdl.github.io/grib2io
MIT License
33 stars 12 forks source link

pip install fail #65

Closed Marston closed 1 year ago

Marston commented 1 year ago
#  grib2io-1.1.0.tar.gz
 pip install grib2io
EricEngle-NOAA commented 1 year ago

HI @Marston. grib2io does not interface with eccodes/cfgrib, so those are not required for grib2io. grib2io interfaces with the NCEPLIBS-g2c library. So that must be installed prior to installing grib2io.

See the procedure for g2c build and install here: https://github.com/NOAA-EMC/NCEPLIBS-g2c#building

Once you have the latest g2c (1.7.0) installed, you should be able to perform the following

G2C_DIR=/path/to/g2c pip install grib2io
Marston commented 1 year ago

Hi @EricEngle-NOAA

I have no memory of installing g2c last year. What has changed with the latest version of grib2io? I have g2clib (1.6.3) and I was able to install grib2io (1.0.3).

EricEngle-NOAA commented 1 year ago

That is because prior to grib2io v1.1.0, g2c library was bundled in the source code. v1.1.0 removed this and pointed to an existing installation of g2c. See v1.1.0 release notes

Marston commented 1 year ago

Got NCEPLIBS installed and will install grib2io manually. Thanks for the help.

Marston commented 1 year ago

@EricEngle-NOAA

I'm able to install the NCEPLIB-g2c/sp/ip into a conda/mamba environment.

#!/bin/bash
set -e

source $HOME/mambaforge-pypy3/etc/profile.d/conda.sh
conda activate grib

echo 'Install NCEPLIB-g2c'
rm -rf NCEP* ncep*
wget -O nceplibs-g2c-1.7.0 https://github.com/NOAA-EMC/NCEPLIBS-g2c/archive/refs/tags/v1.7.0.tar.gz
tar xvf nceplibs-g2c-1.7.0
cd NCEPLIBS-g2c-1.7.0
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_PREFIX_PATH=$CONDA_PREFIX ..
make -j8
make test
make install

This works but I can only get version 1.1.0 installed: pip install grib2io==1.1.0 not the latest release. You have hardcoded some paths to ip and that causes the build to fail. Created an issue.