import pygmt
# Load sample earth relief data
grid = pygmt.datasets.load_earth_relief(resolution="10m", region=[109, 117.4, 20, 25.6])
fig = pygmt.Figure()
fig.grdview(
grid=grid,
# Set the azimuth to -130 (230) degrees and the elevation to 30 degrees
perspective=[-130, 30],
frame=["xaf", "yaf", "WSnE"],
projection="M15c",
zsize="1.5c",
surftype="s",
cmap="geo",
plane="1000+ggrey",
# Set the contour pen thickness to "0.1p"
contourpen="0.1p",
)
fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])
fig.show()
it reports the following errors:
Traceback (most recent call last):
File “d:\python\PyFile\gmt\temp.py”, line 1, in
import pygmt
File “C:\Users\kjzha.conda\envs\pygmt\Lib\site-packages\pygmt_init_.py”, line 29, in
with clib.Session() as lib:
File “C:\Users\kjzha.conda\envs\pygmt\Lib\site-packages\pygmt\clib\session.py”, line 217, in enter
self.create(“pygmt-session”)
File “C:\Users\kjzha.conda\envs\pygmt\Lib\site-packages\pygmt\clib\session.py”, line 364, in create
c_create_session = self.get_libgmt_func(
^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\kjzha.conda\envs\pygmt\Lib\site-packages\pygmt\clib\session.py”, line 316, in get_libgmt_func
self._libgmt = load_libgmt()
^^^^^^^^^^^^^
File “C:\Users\kjzha.conda\envs\pygmt\Lib\site-packages\pygmt\clib\loading.py”, line 59, in load_libgmt
raise GMTCLibNotFoundError(“\n”.join(error_msg))
pygmt.exceptions.GMTCLibNotFoundError: Error loading GMT shared library at ‘gmt.dll’.
Could not find module ‘gmt.dll’ (or one of its dependencies). Try using the full path with constructor syntax.
Error loading GMT shared library at ‘gmt_w64.dll’.
Could not find module ‘gmt_w64.dll’ (or one of its dependencies). Try using the full path with constructor syntax.
Error loading GMT shared library at ‘gmt_w32.dll’.
Could not find module ‘gmt_w32.dll’ (or one of its dependencies). Try using the full path with constructor syntax.
your issue looks like the problem described at Installing — PyGMT. Please try to follow these instructions to fix it; let us know if it is still not working.
Hi. I have the same problem as this one. Does any one of you solve this problem on Windows? I have followed the instructions from PyGMT page, but it still does not work properly.
Dongdong, that is the same error I see when trying to launch pygmt from the root dir of the git checkout.
We (me and Weiji) briefly tried to fix at the AGU but no success. The error makes of some dependency not-found/conflict of some kind. But the strange thing is that c:\programs\GMTDIR\gmt_w64.dll is the exact same dll that the Julia wrapper uses in my developing machine, and no dependency is missing.
>>> import pygmt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\__init__.py", line 24, in <module>
from pygmt import datasets
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\datasets\__init__.py", line 7, in <module>
from pygmt.datasets.earth_age import load_earth_age
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\datasets\earth_age.py", line 12, in <module>
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\datasets\load_remote_dataset.py", line 9, in <module>
from pygmt.clib import Session
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\clib\__init__.py", line 9, in <module>
from pygmt.clib.session import Session, __gmt_version__
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\clib\session.py", line 110, in <module>
_libgmt = load_libgmt()
^^^^^^^^^^^^^
File "C:\progs_cygw\GMTdev\gmt5\pygmt\pygmt\clib\loading.py", line 62, in load_libgmt
raise GMTCLibNotFoundError("\n".join(error_msg))
pygmt.exceptions.GMTCLibNotFoundError: Error loading GMT shared library at 'c:\programs\GMTDIR\gmt_w64.dll'.
Could not find module 'c:\programs\GMTDIR\gmt_w64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Error loading GMT shared library at 'gmt.dll'.
Could not find module 'gmt.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Error loading GMT shared library at 'gmt_w64.dll'.
Could not find module 'gmt_w64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Error loading GMT shared library at 'gmt_w32.dll'.
Could not find module 'gmt_w32.dll' (or one of its dependencies). Try using the full path with constructor syntax.