0

I am trying to import Basemap into a Jupyter notebook. I installed it using the anaconda CMD promt and it installed along with some other packages like py-lief-0.9.0, geos-3.6.2, jupyterlab-1.2.6, basemap-1.2.0 and a few others.

The packages were installed successfully but when I attempted to import them into the workbook environment I was met with the following error message :

KeyError                                  Traceback (most recent call last)
<ipython-input-8-d9467465a3b6> in <module>
----> 1 from mpl_toolkits.basemap import Basemap

~\anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py in <module>
    153 
    154 # create dictionary that maps epsg codes to Basemap kwargs.
--> 155 pyproj_datadir = os.environ['PROJ_LIB']
    156 epsgf = open(os.path.join(pyproj_datadir,'epsg'))
    157 epsg_dict={}

~\anaconda3\lib\os.py in __getitem__(self, key)
    677         except KeyError:
    678             # raise KeyError with the original key value
--> 679             raise KeyError(key) from None
    680         return self.decodevalue(value)
    681 

KeyError: 'PROJ_LIB'

I used this code to import the module

import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

Any and all help is appreciated. Thanks in advance

0 Answers0