I am not able to run Basemap codes in dataquest portal. Everytime i run, my code is timed-out. I tried in jupyter notebook but there I am getting Error : Proj Lib. I tried stackflow but none of the solution worked for me.
Hi,
Can you show us the piece of code that fails please?
Max
@Maxime I have the same issue as amjad21khan’s.
I installed everything according to stackoverflow suggested.
- pyproj
- numpy
- matplotlib
- GEOS
- basemap
Here is the error info from my jupyter notebook;
KeyError Traceback (most recent call last)
<ipython-input-6-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)
676 except KeyError:
677 # raise KeyError with the original key value
--> 678 raise KeyError(key) from None
679 return self.decodevalue(value)
680
KeyError: 'PROJ_LIB'
Hi @yoyotooie,
I assume you are using Windows OS, please try adding this code (after making changes according to the username and proj4 folder name) at the top of your code:
import os
os.environ['PROJ_LIB'] = (r'C:\Users\<username>\AppData\Local\Continuum\anaconda3\pkgs\proj4-<complete_folder_name>\Library\share')
Hope this works for you.
Best,
Sahil
1 Like