question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with psconvert finding gswin64

See original GitHub issue

Description of the problem

Trying to save or show a figure results in an error with ghostscript (gs) not found with a fresh conda install on Windows 10. This is with following the installation instructions at https://github.com/GenericMappingTools/pygmt/blob/v0.2.1/CONTRIBUTING.md#setting-up-your-environment. Note sure if there’s something wrong with the conda gmt package at https://github.com/conda-forge/gmt-feedstock?

Full code that generated the error

pytest --verbose -x

Full error message

(pygmt) PS H:\github\pygmt> pytest --verbose -x
======================================== test session starts ========================================
platform win32 -- Python 3.8.6, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- C:\Users\username\.conda\envs
\pygmt\python.exe
cachedir: .pytest_cache
Matplotlib: 3.3.4
Freetype: 2.10.4
rootdir: H:\github\pygmt, configfile: pyproject.toml
plugins: cov-2.11.1, mpl-0.12
collected 0 items / 1 error

============================================== ERRORS ===============================================
________________________ ERROR collecting examples/gallery/coast/borders.py _________________________
examples\gallery\coast\borders.py:25: in <module>
    fig.show()
H:\github\pygmt\pygmt\figure.py:277: in show
    png = self._preview(
H:\github\pygmt\pygmt\figure.py:349: in _preview
    self.savefig(fname, dpi=dpi, **kwargs)
H:\github\pygmt\pygmt\figure.py:232: in savefig
    self.psconvert(prefix=prefix, fmt=fmt, crop=crop, **kwargs)
H:\github\pygmt\pygmt\helpers\decorators.py:267: in new_module
    return module_func(*args, **kwargs)
H:\github\pygmt\pygmt\helpers\decorators.py:411: in new_module
    return module_func(*args, **kwargs)
H:\github\pygmt\pygmt\figure.py:173: in psconvert
    lib.call_module("psconvert", build_arg_string(kwargs))
H:\github\pygmt\pygmt\clib\session.py:503: in call_module
    raise GMTCLibError(
E   pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 78:
E   psconvert [ERROR]: System call [@gswin64c -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pa
gefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/username/.gmt/sessions/gmt_session.13356/gm
t_1.ps-" 2> "C:/Users/username/.gmt/sessions/gmt_session.13356/psconvert_12992c.bb"] returned error 1.
------------------------------------------ Captured stderr ------------------------------------------
The system cannot find the path specified.
The system cannot find the path specified.
psconvert [ERROR]: System call [@gswin64c -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefi
ll -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/username/.gmt/sessions/gmt_session.13356/gmt_1.
ps-" 2> "C:/Users/username/.gmt/sessions/gmt_session.13356/psconvert_12992c.bb"] returned error 1.
====================================== short test summary info ======================================
ERROR examples/gallery/coast/borders.py - pygmt.exceptions.GMTCLibError: Module 'psconvert' failed ...

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================= 1 error in 2.92s ==========================================

I’ve hit this issue a few times now since late last year, and had a friend who had a similar issue with not finding ghostscript last month, and I think the workaround he did was to manually download the ghostscript executable (gswin32.exe?) and place it at the right path. Not sure if it’s a problem with our university’s Windows system (we have funny network drives) or something with the gmt conda package not linking to ghostscript properly. This looks similar-ish to issue #393

Edit: Might be an upstream gmt issue actually. Running pure GMT doesn’t work either:

gmt basemap -R0/1/0/1 -JX1 -Baf -Vi -png map
begin [INFORMATION]: Creating a workflow directory C:/Users/username/.gmt/sessions/gmt_session.13584
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 ]
The system cannot find the path specified.
psconvert [INFORMATION]: Processing C:/Users/username/.gmt/sessions/gmt_session.13584/gmt_0.ps-...
psconvert [INFORMATION]: Find HiResBoundingBox ...
The system cannot find the path specified.
psconvert [ERROR]: System call [@"C:/Users/username/.conda/envs/pygmt/Library/bin/gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/username/.gmt/sessions/gmt_session.13584/gmt_0.ps-" 2> "C:/Users/username/.gmt/sessions/gmt_session.13584/psconvert_12268c.bb"] returned error 1.
end [ERROR]: Failed to call psconvert
end [ERROR]: gmtinit_process_figures returned error 78
end [INFORMATION]: Destroying the current workflow directory C:/Users/username/.gmt/sessions/gmt_session.13584
basemap [ERROR]: Unable to call module end for a one-liner plot.

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.2.2.dev90+g8e2b3691
System information:
  python: 3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 22:54:47) [MSC v.1916 64 bit (AMD64)]
  executable: C:\Users\username\.conda\envs\pygmt\python.exe
  machine: Windows-10-10.0.16299-SP0
Dependency information:
  numpy: 1.19.5
  pandas: 1.2.1
  xarray: 0.16.2
  netCDF4: 1.5.5.1
  packaging: 20.8
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: C:/Users/username/.conda/envs/pygmt
  cores: 6
  grid layout: rows
  library path: C:/Users/username/.conda/envs/pygmt/Library/bin/gmt.dll
  padding: 2
  plugin dir: C:/Users/username/.conda/envs/pygmt/Library/bin/gmt_plugins
  share dir: C:/Users/username/.conda/envs/pygmt/Library/share/gmt
  version: 6.1.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
seismancommented, Feb 3, 2021

@weiji14 Perhaps you can try to install the GMT dev version instead?

0reactions
weiji14commented, Feb 20, 2021

Ok, haven’t had time to reproduce this properly. I’ll close for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with psconvert on pyGMT - GMT Community Forum
Running out of ideas but as a final test try to move away (just rename them) the gswin64c.exe and the gsdll64.dll that you...
Read more >
psconvert — GMT 6.0.0_r20460 documentation
psconvert converts one or more PostScript files to other formats (BMP, EPS, JPEG, PDF, PNG, PPM, SVG, TIFF) using GhostScript. Input file names...
Read more >
How to Use Ghostscript
The interpreter reads and executes the files in sequence, using the method described under "File searching" to find them. The interpreter runs in...
Read more >
How to fix "Unable to find GhostScript executable to run ...
Upon deepening, I found: ["These errors occur when one tries to assign a value to a variable that doesn't exist, or that R...
Read more >
Cannot execute Ghostscript (gs): GMT error number = 79
It seems that my program is having trouble executing Ghostscript. I'm on a Mac OS system. Error message: psconvert [ERROR]: Cannot execute ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found