Skip to content Skip to sidebar Skip to footer

Basemap Won't Import Because 'epsg' File Or Directory Can't Be Found (macos, Anaconda, Jupyter Notebook)

I am trying to use the Matplotlib Basemap toolkit but am running into a FileNotFoundError related to epsg when I try importing it. I installed it using the following command: conda

Solution 1:

You are looking for this file: https://github.com/matplotlib/basemap/blob/master/lib/mpl_toolkits/basemap/data/epsg

Your PROJ_LIB env var does not appear to end with .../site-packages. Please refer to https://ctcoding.wordpress.com/2019/01/29/solved-proj_lib-error-when-installing-basemap-on-windows-using-anaconda/

Take a look at $ conda info --base, and then run

$ find `conda info --base` -name epsg

to verify the file was installed in the intended directory. Adjust PROJ_LIB to point there.

Solution 2:

As said in another comment run this command in terminal or in the Anaconda executor thing (if you run it in Anaconda make sure you redo the single quotes part if you copy and paste the below):

$ find `conda info --base` -name epsg

When you run that command several file paths should come up. Before you import Basemap into your program put the following lines:

import osos.environ['PROJ_LIB'] = '/Users/XXXXXXXX/opt/anaconda3/pkgs/proj4-5.2.0-h0a44026_1/share/proj/'

where the whole line in quotes is the filepath that appears from the first line of code (without the epsg/ at the end). The part in quotes above is what appeared for me. If no file paths come up or another issue arrises check out the github pages on this (just google the error) or try

conda install -c conda-forge proj4

Post a Comment for "Basemap Won't Import Because 'epsg' File Or Directory Can't Be Found (macos, Anaconda, Jupyter Notebook)"