gee-community/geemap

geemap won't import with Python 3.12.0

bethdelaney opened this issue · 2 comments

Environment Information

Python: 3.12.1, ee: 0.1.384, running on Jupyter-Lab

Description

Cannot import geemap, as getting below error. It appears to be an issue with the latest Python update (3.12):
importlib.abc.Finder, pkgutil.ImpImporter, and pkgutil.ImpLoader have been removed.

Had to downgrade Python to 3.11.7 for geemap to work.

What I Did

import geemap

Output:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 import geemap
      3 Map = geemap.Map(center=[53.468, -1.546], zoom=6)
      5 extent = ee.FeatureCollection('projects/ee-bd167/assets/Soil_Fields_Extent')

File [~\.conda\envs\bd167\Lib\site-packages\geemap\__init__.py:55](http://localhost:8888/~/.conda/envs/bd167/Lib/site-packages/geemap/__init__.py#line=54)
     51         else:
     52             print(
     53                 "Please restart Jupyter kernel after installation if you encounter any errors when importing geemap."
     54             )
---> 55         raise e
     57 if _use_eerepr():
     58     import eerepr

File [~\.conda\envs\bd167\Lib\site-packages\geemap\__init__.py:45](http://localhost:8888/~/.conda/envs/bd167/Lib/site-packages/geemap/__init__.py#line=44)
     43 else:
     44     try:
---> 45         from .geemap import *
     46     except Exception as e:
     47         if in_colab_shell():

File [~\.conda\envs\bd167\Lib\site-packages\geemap\geemap.py:28](http://localhost:8888/~/.conda/envs/bd167/Lib/site-packages/geemap/geemap.py#line=27)
     26 from .basemaps import get_xyz_dict, xyz_to_leaflet
     27 from .common import *
---> 28 from .conversion import *
     29 from .ee_tile_layers import *
     30 from . import core

File [~\.conda\envs\bd167\Lib\site-packages\geemap\conversion.py:22](http://localhost:8888/~/.conda/envs/bd167/Lib/site-packages/geemap/conversion.py#line=21)
     19 from collections import deque
     20 from pathlib import Path
---> 22 import pkg_resources
     24 from .common import *
     27 def find_matching_bracket(lines, start_line_index, start_char_index, matching_char="{"):

File [~\.conda\envs\bd167\Lib\site-packages\pkg_resources\__init__.py:2172](http://localhost:8888/~/.conda/envs/bd167/Lib/site-packages/pkg_resources/__init__.py#line=2171)
   2168     dist_groups = map(find_distributions, resolved_paths)
   2169     return next(dist_groups, ())
-> 2172 register_finder(pkgutil.ImpImporter, find_on_path)
   2174 if hasattr(importlib_machinery, 'FileFinder'):
   2175     register_finder(importlib_machinery.FileFinder, find_on_path)

AttributeError: module 'pkgutil' has no attribute 'ImpImporter'

It works fine on my end. Try creating a fresh conda env to install geemap.

image

You can also look at the solutions here. This is not a geemap issue. Closing now.