pygmt: GEOS 3.10.0 breaks GMT on macOS
Description of the problem
On macOS, it seems like GMT is broken with GEOS 3.10 (release 22 Oct to conda-forge https://github.com/conda-forge/geos-feedstock/pull/61). See recent failure on cache_data.yml at https://github.com/GenericMappingTools/pygmt/runs/4059892997?check_suite_focus=true#step:6:8.
Full code that generated the error
from pygmt.helpers.testing import download_test_data
download_test_data()
Full error message
dyld: Library not loaded: @rpath/libgeos_c.1.dylib
Referenced from: /Users/runner/miniconda3/envs/test/lib/libgmt.6.2.0.dylib
Reason: Incompatible library version: libgmt.6.dylib requires version 16.0.0 or later, but libgeos_c.1.dylib provides version 1.0.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/runner/work/pygmt/pygmt/pygmt/__init__.py", line 70, in <module>
_begin()
File "/Users/runner/work/pygmt/pygmt/pygmt/session_management.py", line 16, in begin
with Session() as lib:
File "/Users/runner/work/pygmt/pygmt/pygmt/clib/session.py", line 183, in __enter__
self.create("pygmt-session")
File "/Users/runner/work/pygmt/pygmt/pygmt/clib/session.py", line 329, in create
c_create_session = self.get_libgmt_func(
File "/Users/runner/work/pygmt/pygmt/pygmt/clib/session.py", line 281, in get_libgmt_func
self._libgmt = load_libgmt()
File "/Users/runner/work/pygmt/pygmt/pygmt/clib/loading.py", line 59, in load_libgmt
raise GMTCLibNotFoundError("\n".join(error_msg))
pygmt.exceptions.GMTCLibNotFoundError: Error loading GMT shared library at 'libgmt.dylib'.
dlopen(libgmt.dylib, 6): Library not loaded: @rpath/libgeos_c.1.dylib
Referenced from: /Users/runner/miniconda3/envs/test/lib/libgmt.6.2.0.dylib
Reason: Incompatible library version: libgmt.dylib requires version 16.0.0 or later, but libgeos_c.1.dylib provides version 1.0.0
Error: Process completed with exit code 1.
System information
Please paste the output of python -c "import pygmt; pygmt.show_versions()":
pygmt v0.5.0
I don’t have a macOS computer to test or debug, but workaround may be to downgrade to geos=5.9 for now using conda install -c conda-forge geos=3.9. Feel free to move this issue to upstream GMT if it’s better.
Edit: Or maybe it’s an issue on the GEOS side 🙂 There is an ongoing migration for GEOS 3.10 on conda-forge, see https://github.com/conda-forge/conda-forge-pinning-feedstock/pull/2051 and https://conda-forge.org/status/#geos3100
Edit2: A user has reported similar problem on the forum at https://forum.generic-mapping-tools.org/t/import-pygmt-error-after-jupyterlab-installation/2117/4. Might be quite serious…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (16 by maintainers)
As I reported on the GMT discussion forum, the new version of
conda-forge/gmt-feedstockfixed the problem that I had running PyGMT on MacOS. Thanks for the fast work!A few notes based on some trials on macOS:
conda create --name gdal; conda activate gdal; conda install -c conda-forge gdal.conda install -c conda-forge geos=3.9solves the problem.conda create --name gmt-test; conda activate gmt-test; conda install -c conda-forge gmt; gmt --versionreproduces the problem without needing to go through PyGMT.My guess is that something is wrong with the gmt conda recipe because building gmt from source works fine even when using the conda-forge version of gdal and geos dependencies.