jswhit / pygrib

Python interface for reading and writing GRIB data
https://jswhit.github.io/pygrib
MIT License
327 stars 97 forks source link

Installing pygrib on OSX10.13 with python3.9 fails on linking the eccodes library #176

Closed PietvdD closed 3 years ago

PietvdD commented 3 years ago

I need advise. I documented the problem on stackoverflow.

I cannot install pygrib as a working package; not by using the anaconca install , not by using the macports install and not by installing pygrib with help of pip. Set-up starting from the github source while carrying out the given instructions fails as well. The ecCodes library compiles as I expected. May be the location where I put that library is causing the problem. There are two ways out of this problem. I need to know the preffered location for that library and put it there or : I may have to manually add an absolute path to the eccodes library. At build time of pygrib the correct load path is not included, despite adding ECCODES_DIR to the setup process. I have no idea in which file I can manually add the absolute path.

jswhit commented 3 years ago

what happens when you use the pip installed wheel or the conda package?

make sure the DYLD_LIBRARY_PATH env var is not set.

PietvdD commented 3 years ago

Jef. Thanks for the reaction. The DYLD_LIBRARY_PATH env var does not show now. I do not understand what you mean by using the pip installed wheel. But when I use pip list installed I see pygrib 2.1.4 in the list.

my version of anaconda is Anaconda3 2020.11 .It is my first experience using conda, but this was discouraging. "conda install -c conda-forge pygrib" fails with 1000 lines of packkage conflicts. I attached the terminal logfile of the install. CONDA_PYGRIB_ERRORS.txt The conda environment has python3.8.5. I wonder if I omitted something implicitely present prior to the conda install

The installation from the github source succeeded after editing the library path in pygrib.cpython-38-darwin.so before the manual change --- pygrib.cpython-38-darwin.so cannot find the eccodes library. -- In the terminal I executed the command below , which normally should not be needed.

install_name_tool -add_rpath /Users/myaccount/ownprog/eccodes/lib /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pygrib-2.1.4-py3.9-macosx-10.9-x86_64.egg/pygrib/_pygrib.cpython-39-darwin.so

jswhit commented 3 years ago

I mean if you run pip install pygrib and then run python -c 'import.pygrib' what error do you see.

All those packaging conflicts you see in conda are because the installed packages are old and need to be upgraded. You should probably create a 'pygrib' conda environment and let conda install the upgraded packages there.

You should never need to run 'install_name' manually - this indicates to me that there is something wrong with your environment. I'm no macos x expert though.

PietvdD commented 3 years ago

I expect that your last comment points out the direction I need to follow. For me the question is answered.