Pygmt-session [ERROR]: Not available in classic mode

I had this error in COLAB running “fig = pygmt.Figure()” after I installed pdf2image and poppler-utils packages.

pygmt-session [ERROR]: Not available in classic mode

GMTCLibError Traceback (most recent call last)
in ()
1 import pygmt
2
----> 3 fig = pygmt.Figure()
4
5 fig.basemap(projection=“x1i”, region=[0, 7, 3, 7], frame=True)

2 frames
/usr/local/lib/python3.7/dist-packages/pygmt/clib/session.py in call_module(self, module, args)
499 if status != 0:
500 raise GMTCLibError(
–> 501 f"Module ‘{module}’ failed with status code {status}:\n{self._error_message}"
502 )
503

GMTCLibError: Module ‘figure’ failed with status code 30:
pygmt-session [ERROR]: Not available in classic mode

Hello @brioglade,

I don’t know exactly where you’re getting this pygmt script from but I see you’re using COLAB’s default python 3.7. Just last year, with the GMT update, COLAB+pygmt started to have problems (see Installing PyGMT on Google Colab) .
However, some solutions were adapted. You can use this notebook as an example here https://github.com/andrebelem/pythonverse/blob/main/PyGMT_on_COLAB.ipynb)

I tested your code and it works perfectly.
Captura de tela 2022-06-05 094905

1 Like

Why are you doing this? poppler will only be used if GDAL was build with that as a dependency and then you’ll have it already.

pdf2image what for? PyGMT uses psconvert all the times.