3. Troubleshooting#

3.1. Issue with basemap#

When using this package, You may encountered this error:

ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

or the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/miniconda3/lib/python3.10/site-packages/basemap_data_hires-1.3.2-py3.10.egg/mpl_toolkits/basemap_data/epsg'

To solve these issues, first, install libgeos library by

sudo apt install libgeos3.10.2 libgeos-dev -y

Next, install basemap package directly thought its GitHub repository as follows.

python -m pip install git+https://github.com/matplotlib/basemap#subdirectory=packages/basemap
python -m pip install git+https://github.com/matplotlib/basemap#subdirectory=packages/basemap_data
python -m pip install git+https://github.com/matplotlib/basemap#subdirectory=packages/basemap_data_hires

If the issue is not yet resolved with the above solutions, try reinstalling all prerequisite packages using conda instead of pip as follows:

conda install -c conda-forge --file conda-recipe/requirements_conda.txt

In the above command, the file requirements_conda.txt is located in the source code under /conda-receipe directory.

3.2. Issue with geos#

When building the sphinx documentation, you may get this error:

Extension error (pydata_sphinx_theme):
Handler <function _overwrite_pygments_css at 0x7fb8efce2cb0> for event 'build-finished' threw an exception (exception: [Errno 13] Permission denied: '/opt/miniconda3/lib/python3.10/site-packages/geos-0.2.3-py3.10.egg/EGG-INFO/entry_points.txt')
make: *** [Makefile:20: html] Error 2

To resolve this issue, uninstall, then install the geos package:

python -m pip uninstall geos
python -m pip install --upgrade geos

3.3. Issue with libgeos#

The following issue may encounter at runtime:

File "/opt/miniconda3/lib/python3.11/site-packages/restoreio/_geography/detect_land_ocean.py", line 16, in <module>
from mpl_toolkits.basemap import Basemap, maskoceans
File "/opt/miniconda3/lib/python3.11/site-packages/mpl_toolkits/basemap/__init__.py", line 47, in <module>
import _geoslib
ImportError: libgeos_c-d46a9444.so.1: cannot open shared object file: No such file or directory

To resolve this issue, install libgeos library:

sudo apt install libgeos3.10.2 libgeos-dev -y