Skip to content

Fix conda-based pherProj kernel spec

Katharina Höflich requested to merge fix-pherproj-jupyter-kernel-spec into main

Fixes the following Jupyter kernel problem,

[1]: from mpl_toolkits.basemap import Basemap
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_52/3341290477.py in <module>
----> 1 from mpl_toolkits.basemap import Basemap

/miniconda3/envs/pherproj/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py in <module>
    150 
    151 # create dictionary that maps epsg codes to Basemap kwargs.
--> 152 pyproj_datadir = os.environ['PROJ_LIB']
    153 epsgf = open(os.path.join(basemap_datadir,'epsg'))
    154 epsg_dict={}

/miniconda3/envs/pherproj/lib/python3.7/os.py in __getitem__(self, key)
    679         except KeyError:
    680             # raise KeyError with the original key value
--> 681             raise KeyError(key) from None
    682         return self.decodevalue(value)
    683 

KeyError: 'PROJ_LIB'

while,

(base) jovyan@cloudlab:~$ conda activate pherproj
(pherproj) jovyan@cloudlab:~$ python
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpl_toolkits.basemap import Basemap
>>> 

is working perfectly well. See also !56 (merged).

Edited by Katharina Höflich

Merge request reports

Loading