You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I first tried to install via Anaconda. The install looked ok, but when I tried import gmt, it said the module was not found.
So instead, I downloaded the source from git and installed using pip. This seems to go okay, but when I try: import gmt, I get the following error:
Traceback (most recent call last):
File "", line 1, in
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/init.py", line 18, in
_begin()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/session_management.py", line 20, in begin
with APISession() as session:
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 205, in enter
self.session_id = create_session()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 135, in create_session
libgmt = load_libgmt()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 32, in load_libgmt
libgmt = ctypes.CDLL('.'.join(['libgmt', lib_ext]))
File "/Users/sph1r17/anaconda/lib/python3.5/ctypes/init.py", line 347, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgmt.dylib, 6): image not found
When you conda install gmt what you're getting is GMT itself, not GMT/Python. You also have to pip install the github repository to get GMT/Python. In the future, you'll be able to conda install gmt-python and get everything.
Have you tried setting your LD_LIBRARY_PATH as described in the install instructions?
This is sometimes required for ctypes to find the GMT shared library.
It wasn't 100% clear in the instructions that these were the two steps :).
Anyway, I have made a bit of progress, but now getting an error related to gdal libraries:
Traceback (most recent call last):
File "", line 1, in
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/init.py", line 18, in
_begin()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/session_management.py", line 20, in begin
with APISession() as session:
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 205, in enter
self.session_id = create_session()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 135, in create_session
libgmt = load_libgmt()
File "/Users/sph1r17/anaconda/lib/python3.5/site-packages/gmt/clib/core.py", line 32, in load_libgmt
libgmt = ctypes.CDLL('.'.join(['libgmt', lib_ext]))
File "/Users/sph1r17/anaconda/lib/python3.5/ctypes/init.py", line 347, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgmt.dylib, 6): Library not loaded: @rpath/liblzma.5.dylib
Referenced from: /Users/sph1r17/anaconda/lib/libgdal.20.dylib
Reason: Incompatible library version: libgdal.20.dylib requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
I tried updating / reinstalling gdal, but this didn't help.
Are you working on a separate environment or on your main one? There can be issues with compatibility when mixing packages from conda-forge with the default channel.
I would suggest trying the following:
Create a blank environment:
conda create -n gmt-python python=3.6 pip
Activate the environment:
source activate gmt-python
Install GMT, numpy, and jupyter into the environment. It's important to include the dev label before the main conda-forge channel to force conda to get the alpha version of GMT.
I very much appriciate your efforts and would welcome any further developments in this direction. When trying gmt python I followed the guidelines from you and could install it, however, I got the following message:
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/init.py in ()
23
24 # Start our global modern mode session
---> 25 _begin()
26 # Tell Python to run _end when shutting down
27 _atexit.register(_end)
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/session_management.py in begin()
15 """
16 prefix = "gmt-python-session"
---> 17 with Session() as lib:
18 lib.call_module("begin", prefix)
19
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/session.py in enter(self)
170
171 """
--> 172 self.create("gmt-python-session")
173 # Need to store the version info because 'get_default' won't work after the
174 # session is destroyed.
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/session.py in get_libgmt_func(self, name, argtypes, restype)
261 """
262 if not hasattr(self, "_libgmt"):
--> 263 self._libgmt = load_libgmt()
264 function = getattr(self._libgmt, name)
265 if argtypes is not None:
GMTCLibNotFoundError: Error loading the GMT shared library 'libgmt.so':
libkea.so.1.4.7: cannot open shared object file: No such file or directory
Please tell me how to fix it.
Chia
@ofbodur - my guess is that when you are starting a jupyter instance, it is using the default environment/kernel and not the gmt-python environment/kernel
Activity
leouieda commentedon Jul 27, 2017
Hi Stephen, thanks for trying this out!
When you
conda install gmtwhat you're getting is GMT itself, not GMT/Python. You also have topip installthe github repository to get GMT/Python. In the future, you'll be able toconda install gmt-pythonand get everything.Have you tried setting your
LD_LIBRARY_PATHas described in the install instructions?This is sometimes required for ctypes to find the GMT shared library.
shicks-seismo commentedon Jul 27, 2017
Thanks, Leo.
It wasn't 100% clear in the instructions that these were the two steps :).
Anyway, I have made a bit of progress, but now getting an error related to gdal libraries:
I tried updating / reinstalling gdal, but this didn't help.
leouieda commentedon Jul 27, 2017
Are you working on a separate environment or on your main one? There can be issues with compatibility when mixing packages from conda-forge with the default channel.
I would suggest trying the following:
Create a blank environment:
Activate the environment:
Install GMT, numpy, and jupyter into the environment. It's important to include the
devlabel before the mainconda-forgechannel to forcecondato get the alpha version of GMT.Install GMT/Python from Github:
Now you can test things without messing up the dependencies in your base environment.
Just remember to
source activatebefore starting jupyter.shicks-seismo commentedon Jul 28, 2017
Great, that method works!
Looking forward to seeing the new developments - happy to test and help out where possible.
leouieda commentedon Jul 28, 2017
Thanks, it's good to know that things work. Let me know if you have any ideas
Instruction for installing inside a conda env
Instruction for installing inside a conda env
Instruction for installing inside a conda env (#58)
luchiayu commentedon Jul 26, 2018
I very much appriciate your efforts and would welcome any further developments in this direction. When trying gmt python I followed the guidelines from you and could install it, however, I got the following message:
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import gmt
OSError Traceback (most recent call last)
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/loading.py in load_libgmt(env)
41 try:
---> 42 libgmt = ctypes.CDLL(libpath)
43 check_libgmt(libgmt)
~/anaconda3/envs/gmt-python/lib/python3.6/ctypes/init.py in init(self, name, mode, handle, use_errno, use_last_error)
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
OSError: libkea.so.1.4.7: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
GMTCLibNotFoundError Traceback (most recent call last)
in ()
----> 1 import gmt
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/init.py in ()
23
24 # Start our global modern mode session
---> 25 _begin()
26 # Tell Python to run _end when shutting down
27 _atexit.register(_end)
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/session_management.py in begin()
15 """
16 prefix = "gmt-python-session"
---> 17 with Session() as lib:
18 lib.call_module("begin", prefix)
19
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/session.py in enter(self)
170
171 """
--> 172 self.create("gmt-python-session")
173 # Need to store the version info because 'get_default' won't work after the
174 # session is destroyed.
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/session.py in create(self, name)
311 "GMT_Create_Session",
312 argtypes=[ctp.c_char_p, ctp.c_uint, ctp.c_uint, ctp.c_void_p],
--> 313 restype=ctp.c_void_p,
314 )
315
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/session.py in get_libgmt_func(self, name, argtypes, restype)
261 """
262 if not hasattr(self, "_libgmt"):
--> 263 self._libgmt = load_libgmt()
264 function = getattr(self._libgmt, name)
265 if argtypes is not None:
~/anaconda3/envs/gmt-python/lib/python3.6/site-packages/gmt/clib/loading.py in load_libgmt(env)
49 ]
50 )
---> 51 raise GMTCLibNotFoundError(msg)
52 return libgmt
53
GMTCLibNotFoundError: Error loading the GMT shared library 'libgmt.so':
libkea.so.1.4.7: cannot open shared object file: No such file or directory
Please tell me how to fix it.
Chia
leouieda commentedon Jul 26, 2018
Hi @luchiayu, we're having some trouble with the binary packages for GMT at the moment. I'm trying to get everything fixed but it will take a couple of days still until I can sort things out. Please sign up for our Gitter chatroom to get updates on this: https://gitter.im/GenericMappingTools/gmt-python I'll post as soon as everything is fixed.
ofbodur commentedon Oct 10, 2018
Hi Leo,
Thanks for this great package.
I also followed the instructions.
I exported the path to my bash profile as well.
I do
source activate gmt-python
and it gives me
(gmt-python) in the terminal, then open jupyter notebook,
execute
import gmt
but ModuleNotFoundError: No module named 'gmt'
shaunwbell commentedon Oct 10, 2018
@ofbodur - my guess is that when you are starting a jupyter instance, it is using the default environment/kernel and not the gmt-python environment/kernel
I've found the following stack overflow discussion useful to bookmark everytime i come across this - https://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook