-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault on MacOS caused by LibGMT.log_to_file #164
Comments
@chandrex thank you reporting this and sorry for all the trouble! I really appreciate the amount of effort you put in to the issue. That really helps! Welcome to the world of open-source! I hope you'll like it and consider becoming involved 😀 OK, this is a bad crash. It normally shouldn't happen but it's really tricky dealing with C code from Python. One possibility is that Python is finding the wrong version of GMT. Do you have GMT installed from another source (homebrew, fink, etc)? Could you try removing the If that doesn't work, then can you please post the output of Again, thanks for detailed issue! |
OK, here are a few things you can try:
I'm working on a better way that we can diagnose these problems (#167). Again, thanks for reporting this! |
@chandrex just to let you know that your issue contributed several changes to the project: #168 #173 #175 #176 and #177 #177 introduces a new way to set the path to the GMT shared library. Once, that's incorporated (it will say "Merged" on the link) please try deleting your conda environment and following the new instructions that will appear in http://www.gmtpython.xyz/install.html Again, thank you for helping us make things more robust! |
@chandrex please let me know if the new changes work for you. If not we can at least better diagnose the problem. |
Hi @leouieda, alas I have tried everything you suggested and I am still getting the same problem at the final step when I do the gmt.test(), with the failures and segmentation fault. |
:( sorry to hear. You shouldn't have uninstall GMT5. Could you please post the new output of |
Hi @leouieda here is the screenshot: And in writing: import gmt
|
Hi.
My dependencies (e.g., xarray, pandas) were all installed with conda. Please let me know if anyone makes any progress on solving this. Cheers! |
Hi @mikehagerty and @chandrex this is a very strange failure. I'll try to get my hands on a Mac to investigate. @mikehagerty out of curiosity, do you also have GMT5 installed? |
There seems to be a segfault problem (#164) that doesn't happen on Linux. I'm re-enabling the Mac build to check if it happens on Travis as well.
OK, I managed to replicate the issue using Travis CI on #180. It's not a problem with your installation or with the pre-installed GMT5. I'll investigate further to try to get to the bottom of this. Thanks for bringing this to my attention! It's hard to track these issues when I'm not using a Mac. |
Hi there,
Any luck on the mac os test fails ?
I just did a clean install of gmt-python and tried the test again:
(gmt-python) mth@Mikes-MBP [~/mth]> python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:14:23)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>> import gmt
>> gmt.test()
=============================================== Currently loaded libgmt
================================================
binary dir: /Users/mth/mth/miniconda3/envs/gmt-python/bin
cores: 4
grid layout: rows
image layout:
library path: /Users/mth/mth/miniconda3/envs/gmt-python/lib/libgmt.dylib
padding: 2
plugin dir: /Users/mth/mth/miniconda3/envs/gmt-python/lib/gmt/plugins
share dir: /Users/mth/mth/miniconda3/envs/gmt-python/share/gmt
version: 6.0.0
usage: [options] [file_or_dir] [file_or_dir] [...]
: error: unrecognized arguments: --mpl
inifile: None
rootdir: /Users/mth/mth
It seems the usage has changed (?)
Cheers!
-Mike
(gmt-python) mth@Mikes-MBP [~/mth]> conda list gmt
# packages in environment at /Users/mth/mth/miniconda3/envs/gmt-python:
#
# Name Version Build Channel
dcw-gmt 1.1.3 0 conda-forge
gmt 6.0.0a14 blas_openblas_201
[blas_openblas] conda-forge/label/dev
gmt-python 0+unknown <pip>
gshhg-gmt 2.3.7 0 conda-forge
…On Thu, May 10, 2018 at 10:43 PM, Leonardo Uieda ***@***.***> wrote:
OK, I managed to replicate the issue using Travis CI on #180
<#180>. It's not a
problem with your installation or with the pre-installed GMT5. I'll
investigate further to try to get to the bottom of this.
Thanks for bringing this to my attention! It's hard to track these issues
when I'm not using a Mac.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACDAwkjw0uvHtdeTG851Wq472kl8HlPfks5txPq7gaJpZM4TdsgC>
.
|
@mikehagerty sorry, haven't had much time to look into to yet. It seems like you don't have |
Hi Leonardo,
You were right that I didn't have pytest-mpl installed, however installing
it doesn't fix the seg-fault (see below).
(gmt-python) mth@Mikes-MBP [~/mth/python_pkgs/gmt-python]> python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:14:23)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>> import gmt
>> gmt.test()
=============================================== Currently loaded libgmt
================================================
binary dir: /Users/mth/mth/miniconda3/envs/gmt-python/bin
cores: 4
grid layout: rows
image layout:
library path: /Users/mth/mth/miniconda3/envs/gmt-python/lib/libgmt.dylib
padding: 2
plugin dir: /Users/mth/mth/miniconda3/envs/gmt-python/lib/gmt/plugins
share dir: /Users/mth/mth/miniconda3/envs/gmt-python/share/gmt
version: 6.0.0
================================================= test session starts
==================================================
platform darwin -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0 --
/Users/mth/mth/miniconda3/envs/gmt-python/bin/python
cachedir: .pytest_cache
Matplotlib: 2.2.2
Freetype: 2.8.0
rootdir: /Users/mth/mth/python_pkgs/gmt-python, inifile:
plugins: mpl-0.9
collected 133 items
gmt/base_plotting.py::gmt.base_plotting.BasePlotting._preprocess PASSED
[ 0%]
gmt/figure.py::gmt.figure.Figure gmt-python-session [ERROR]: Long input
record (246 bytes) was truncated to first 126 bytes!
PASSED
[ 1%]
gmt/clib/core.py::gmt.clib.core.LibGMT PASSED
[ 2%]
gmt/clib/core.py::gmt.clib.core.LibGMT._check_dtype_and_dim PASSED
[ 3%]
gmt/clib/core.py::gmt.clib.core.LibGMT.extract_region gmt-python-session
[ERROR]: Long input record (236 bytes) was truncated to first 126 bytes!
gmt-python-session [ERROR]: Long input record (247 bytes) was truncated to
first 126 bytes!
gmt-python-session [ERROR]: Long input record (239 bytes) was truncated to
first 126 bytes!
PASSED [ 3%]
gmt/clib/core.py::gmt.clib.core.LibGMT.get_libgmt_func PASSED
[ 4%]
gmt/clib/core.py::gmt.clib.core.LibGMT.grid_to_vfile FAILED
[ 5%]
gmt/clib/core.py::gmt.clib.core.LibGMT.log_to_file *Segmentation fault:* 11
(gmt-python) mth@Mikes-MBP [~/mth/python_pkgs/gmt-python]>
Update: Here's a quick test:
import gmt
with gmt.clib.LibGMT() as lib:
mode = lib.get_constant('GMT_MODULE_CMD')
with lib.log_to_file() as logfile:
call_module = lib.get_libgmt_func('GMT_Call_Module')
print("MTH: mode=", mode)
print("MTH: session=", lib.current_session)
print("MTH: type(call_module)=", type(call_module))
status = call_module(lib.current_session, 'info'.encode(),
mode, 'bogus-file.bla'.encode())
print("MTH: status=", status)
It seems to be dying when trying to follow the pointer to call_module().
So maybe it's a ctypes issue ?
MTH: mode= 0
MTH: session= 140533251525120
MTH: type(call_module)= <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
Segmentation fault: 11
Cheers!
-Mike
…On Wed, May 30, 2018 at 7:31 PM, Leonardo Uieda ***@***.***> wrote:
@mikehagerty <https://github.com/mikehagerty> sorry, haven't had much
time to look into to yet.
It seems like you don't have pytest-mpl installed. Can you check, please?
A lot of the tests compare generated plots using the matplotlib pytest
plugin (hurray for duck typing!).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACDAwqoKhLMo0NC00mHPIeZM92j66ivfks5t3yvYgaJpZM4TdsgC>
.
|
@mikehagerty thanks for the info! I suspect that it's the log file actually but it's a bit tough to debug when TravisCI is not cooperating. I haven't found a good fix for that yet so I might just disable it for now. This is used to get the error messages printed by GMT. It's helpful but not vital for now. |
There seems to be a segfault problem (#164) that doesn't happen on Linux. I'm re-enabling the Mac build to check if it happens on Travis as well.
Good news everyone @chandrex @mikehagerty! 🎉 🍰 🎈 I finally managed to fix this issue in #188! It was a long struggle and I still have no idea why the fault was happening. But I replaced the code that was causing the problem with something better and the fault went away. Things should be working smoothly on Mac now. Could you please give it a try and report back? Thank you for all the information you all provided and sorry for long delay. 🚀 |
Hi, I've been trying to install gmt-python for the past day and a half with no avail. I am on macOS 10.13.4, Python 3.6.5 (installed with Anaconda 3). I've been following all of the installation instruction, and everything seems fine except when I get to the very end, with the gmt.test().
I am in the conda environment (using source activate gmt-python), and trying this in the Python interpreter. This is what happens:
returns
I feel like this might be because of a bash profile issue. I am not sure how to set up a .bashrc profile properly on the Mac (sorry!), but my .bash_profile looks like this (note the 'added by...' is commented out):
Any help would be much appreciated! 😄
ps. let me know if any clarifications are needed, sorry first time writing an issue in!
pps. attached a screenshot of terminal, just to be super clear!
The text was updated successfully, but these errors were encountered: