Hey there, I’m trying to get pygmt to run on my pc, either through a Jupyter notebook or python command prompt, but had the same problem both times. It’s something to do with a psconvert error, but I have no idea how to read it and even less how to fix it. I’m just trying the simplest of codes, which is the example code in the pygmt website
pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 79:
psconvert [ERROR]: System call [@gswin64c -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/fedes/.gmt/sessions/gmt_session.11152/gmt_1.ps-" 2> "C:/Users/fedes/.gmt/sessions/gmt_session.11152/psconvert_6264c.bb"] returned error 1.
My only suspicion is that it might have something to do with a previous install of either ghostscript or gmt that I had on my pc and didn’t properly get rid of, but I’m not sure and can’t find anything like it.
Just for reference here’s what pygmt.show_versions() gives me
Thanks for the answer. I’m actually importing the module, just didn’t realize to add that line to the question. I also expected it to run for anyone with a working gmt and pygmt, it’s most definitely something about my installation process that is causing this. I guess the quickest solve would be to uninstall everything, python included, but I wanted to avoid that if I could.
Can you run this command and post the verbose output? The pygmt.config(GMT_VERBOSE="d") setting will let the fig.show() call output more debugging messages, which may help us find why it doesn’t work for you.
Thanks for the help, running that just gives me this error
C:\Users\fedes>gmt clear sessions
El sistema no puede encontrar la ruta especificada.
clear [ERROR]: Failed to remove session directory C:/Users/fedes/.gmt/sessions [error = 1]
I guess there’s no session to be cleared, and C:/Users/fedes/.gmt/ is empty too.
You should not get that error either. Running gmt clear sessions on an empty .gmt is a perfectly valid move.
When the py code errors does your .gmt is still empty? No .gmt\sessions\...?
What is the gmt version?
It’s still empty indeed, no folder is created when I run the code. When I run gmt it says the version is 6.2.0.
Could it be some sort of permission problem, as if gmt wouldn’t have permission to make sessions in that folder? I would not know how to allow it (or, for that matter, change the folder either).
By the way, I tried a completely clean install of everything, this time in an anaconda environment, and keep getting the exact same error. All folders have changed except for this temp folder, so maybe that has something to do?
Small update: I realized that python does indeed create a sessions folder, but it’s gone as soon as I close the terminal. If I don’t close it and run gmt clear sessions on another cmd, it works just fine. And as you said, one of the files there has extension .ps-
Thanks for the tons of help. I began to suspect it might be an environment variable that’s set incorrectly, but I don’t even know which variables even exist for gmt and gs, and where I should set them to.
I’ll go cry for a bit, maybe come back to it after that.
Try running a pure GMT command like gmt basemap -R0/1/0/1 -JX1 -Baf -Vi -png map (and provide the output). Will be easier to troubleshoot, and allow us to see if this is a GMT problem or PyGMT problem.
It actually doesn’t work either, here’s the output:
(cin2020) C:\Users\fedes>gmt basemap -R0/1/0/1 -JX1 -Baf -Vi -png map
begin [INFORMATION]: Creating a workflow directory C:/Users/fedes/.gmt/sessions/gmt_session.5956
basemap [INFORMATION]: Constructing the basemap
basemap [INFORMATION]: Auto-frame interval for x-axis (item 0): a0.2f0.1
basemap [INFORMATION]: Auto-frame interval for y-axis (item 0): a0.2f0.1
basemap [INFORMATION]: Map scale is 0.001 km per cm or 1:100.
end [INFORMATION]: Process GMT figure queue: 1 figures found
end [INFORMATION]: Processing GMT figure #0 [map png ]
El sistema no puede encontrar la ruta especificada.
psconvert [INFORMATION]: Processing C:/Users/fedes/.gmt/sessions/gmt_session.5956/gmt_0.ps-...
psconvert [INFORMATION]: Find HiResBoundingBox ...
El sistema no puede encontrar la ruta especificada.
psconvert [ERROR]: System call [@"C:/Users/fedes/anaconda3/envs/cin2020/Library/bin/gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/fedes/.gmt/sessions/gmt_session.5956/gmt_0.ps-" 2> "C:/Users/fedes/.gmt/sessions/gmt_session.5956/psconvert_7176c.bb"] returned error 1.
end [ERROR]: Failed to call psconvert
end [ERROR]: gmtinit_process_figures returned error 79
end [INFORMATION]: Destroying the current workflow directory C:/Users/fedes/.gmt/sessions/gmt_session.5956
basemap [ERROR]: Unable to call module end for a one-liner plot.
It keeps telling me it can’t find the specified path