Skip to content

Install problems #30

Closed
Closed

Description

@shicks-seismo

Hi Leo

I'm using Python3.5 on OSX.

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

Activity

  1. leouieda commented on Jul 27, 2017

    @leouieda
    Member

    Hi Stephen, thanks for trying this out!

    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.

  2. shicks-seismo commented on Jul 27, 2017

    @shicks-seismo
    Author

    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:

    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.

  3. leouieda commented on Jul 27, 2017

    @leouieda
    Member

    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:

    1. Create a blank environment:

       conda create -n gmt-python python=3.6 pip
      
    2. Activate the environment:

        source activate gmt-python
      
    3. 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.

       conda install -c conda-forge/label/dev -c conda-forge gmt numpy jupyter
      
    4. Install GMT/Python from Github:

       pip install https://github.com/GenericMappingTools/gmt-python/archive/master.zip
      

    Now you can test things without messing up the dependencies in your base environment.
    Just remember to source activate before starting jupyter.

  4. shicks-seismo commented on Jul 28, 2017

    @shicks-seismo
    Author

    Great, that method works!
    Looking forward to seeing the new developments - happy to test and help out where possible.

  5. leouieda commented on Jul 28, 2017

    @leouieda
    Member

    Thanks, it's good to know that things work. Let me know if you have any ideas

  6. luchiayu commented on Jul 26, 2018

    @luchiayu

    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

  7. leouieda commented on Jul 26, 2018

    @leouieda
    Member

    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.

  8. ofbodur commented on Oct 10, 2018

    @ofbodur

    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'

  9. shaunwbell commented on Oct 10, 2018

    @shaunwbell

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions