Error with pandas installation preventing spatial dataframes

I am trying to access a feature layer on Esri’s living Atlas. I get an error when trying to create sdf from feature layer.

ERROR:

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  
  nner/exec_code.py:88 in exec_func_with_error_handling                         
                                                                                
  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  
  nner/script_runner.py:579 in code_to_exec                                     
                                                                                
  /mount/src/portfolio/wildfireApp.py:42 in <module>                            
                                                                                
    39                                                                          
    40 # Retrieve Wildfire layer and create SDF                                 
    41 item_id = "21638fcd54d14a25b6f1affdef812146"                             
  ❱ 42 wildfire_sdf = read_fl(item_id)                                          
    43                                                                          
    44 # Filter and create Province column                                      
    45 conus_fires = wildfire_sdf[wildfire_sdf['Agency'] == 'conus']            
                                                                                
  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  
  cache_utils.py:217 in __call__                                                
                                                                                
  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  
  cache_utils.py:242 in _get_or_create_cached_value                             
                                                                                
  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  
  cache_utils.py:299 in _handle_cache_miss                                      
                                                                                
  /mount/src/portfolio/wildfireApp.py:37 in read_fl                             
                                                                                
    34 def read_fl(item_id):                                                    
    35 β”‚   living_atlas_item = gis.content.get(item_id)                         
    36 β”‚   feature_layer = living_atlas_item.layers[0]                          
  ❱ 37 β”‚   wf_sdf = feature_layer.query(where="1=1", out_sr=4326).sdf           
    38 β”‚   return wf_sdf                                                        
    39                                                                          
    40 # Retrieve Wildfire layer and create SDF                                 
                                                                                
  /home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/feature.py  
  :864 in sdf                                                                   
                                                                                
     861 β”‚   β”‚   β”‚                                                              
     862 β”‚   β”‚   β”‚   return from_featureset(fset=self)                          
     863 β”‚   β”‚   except ImportError:                                            
  ❱  864 β”‚   β”‚   β”‚   raise Exception(                                           
     865 β”‚   β”‚   β”‚   β”‚   "Could not find the panda installation, please instal  
     866 β”‚   β”‚   β”‚   )                                                          
     867 β”‚   β”‚   except Exception as e:                                         
────────────────────────────────────────────────────────────────────────────────
Exception: Could not find the panda installation, please install Pandas and 
retry
import streamlit as st
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import leafmap.foliumap as leafmap
from arcgis.gis import GIS
gis = GIS()

# Set up 
st.set_page_config(page_title='Dashboard', layout='wide')

@st.cache_data
def read_fl(item_id):
    living_atlas_item = gis.content.get(item_id)
    feature_layer = living_atlas_item.layers[0]
    **wf_sdf = feature_layer.query(where="1=1", out_sr=4326).sdf**
    return wf_sdf

# Retrieve Wildfire layer and create SDF
item_id = "21638fcd54d14a25b6f1affdef812146"
wildfire_sdf = read_fl(item_id)

Requirements.txt

streamlit
geopandas 
pandas
matplotlib
leafmap
gssapi
arcgis

packages.txt

libkrb5-dev

Does this code work in your local environment? If so, can you check the version of arcgis and pandas you are using in your local environment. I tried to find line 864 in the arcgis library that raised the exception so I could look up a bit, but that file doesn’t seem to be part of their latest files in their repository.

I’m not entirely sure what’s wrong here, but I’d check for version compatibility first. Also, you can try rebooting you app, then looking at the setup logs to see if there are any messages from when dependencies were parsed. Sometimes, a dependency will return an error that a compatible version isn’t available and that will give a hint about correcting your dependencies.

1 Like

I get the same error when running streamlit locally but it does work when I am working in jupyter notebooks locally. I don’t really know where to start with debugging version compatibility. Do I randomly assign different version and see what the console says?

Also when rebooting it seems to give errors about cannot import name 'GeoAccessor' from 'arcgis.features'. Which is what I was seeing when I was directly importing GeoAccessor. β€˜from arcgis.features import GeoAccessor, GeoSeriesAccessor’.

Is there a way to add a specific module (GeoAccessor) to my requirements to ensure it is downloaded.

More on GeoAccessor error:

[16:40:36] 🐍 Python dependencies were installed from /mount/src/portfolio/requirements.txt using pip.

Check if streamlit is installed

Streamlit is already installed

[16:40:38] πŸ“¦ Processed dependencies!




────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/feature.py  

  :862 in sdf                                                                   

                                                                                

     859 β”‚   β”‚   try:                                                           

     860 β”‚   β”‚   β”‚   from arcgis.features.geo._io.serviceops import from_featu  

     861 β”‚   β”‚   β”‚                                                              

  ❱  862 β”‚   β”‚   β”‚   return from_featureset(fset=self)                          

     863 β”‚   β”‚   except ImportError:                                            

     864 β”‚   β”‚   β”‚   raise Exception(                                           

     865 β”‚   β”‚   β”‚   β”‚   "Could not find the panda installation, please instal  

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/geo/_io/se  

  rviceops.py:120 in from_featureset                                            

                                                                                

    117 β”‚   β”‚   β”‚   β”‚   a["SHAPE"] = Geometry(g)                                

    118 β”‚   β”‚   β”‚   rows.append(a)                                              

    119 β”‚   β”‚   β”‚   del a, feat                                                 

  ❱ 120 β”‚   β”‚   from arcgis.features import GeoAccessor, GeoSeriesAccessor      

    121 β”‚   β”‚                                                                   

    122 β”‚   β”‚   if len(rows) > 0:                                               

    123 β”‚   β”‚   β”‚   for row in rows:                                            

────────────────────────────────────────────────────────────────────────────────

ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' 

(/home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/__init__.py)


During handling of the above exception, another exception occurred:


────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/exec_code.py:88 in exec_func_with_error_handling                         

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:579 in code_to_exec                                     

                                                                                

  /mount/src/portfolio/wildfireApp.py:42 in <module>                            

                                                                                

    39                                                                          

    40 # Retrieve Wildfire layer and create SDF                                 

    41 item_id = "21638fcd54d14a25b6f1affdef812146"                             

  ❱ 42 wildfire_sdf = read_fl(item_id)                                          

    43                                                                          

    44 # Filter and create Province column                                      

    45 conus_fires = wildfire_sdf[wildfire_sdf['Agency'] == 'conus']            

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  

  cache_utils.py:217 in __call__                                                

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  

  cache_utils.py:242 in _get_or_create_cached_value                             

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/caching/  

  cache_utils.py:299 in _handle_cache_miss                                      

                                                                                

  /mount/src/portfolio/wildfireApp.py:37 in read_fl                             

                                                                                

    34 def read_fl(item_id):                                                    

    35 β”‚   living_atlas_item = gis.content.get(item_id)                         

    36 β”‚   feature_layer = living_atlas_item.layers[0]                          

  ❱ 37 β”‚   wf_sdf = feature_layer.query(where="1=1", out_sr=4326).sdf           

    38 β”‚   return wf_sdf                                                        

    39                                                                          

    40 # Retrieve Wildfire layer and create SDF                                 

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/feature.py  

  :864 in sdf                                                                   

                                                                                

     861 β”‚   β”‚   β”‚                                                              

     862 β”‚   β”‚   β”‚   return from_featureset(fset=self)                          

     863 β”‚   β”‚   except ImportError:                                            

  ❱  864 β”‚   β”‚   β”‚   raise Exception(                                           

     865 β”‚   β”‚   β”‚   β”‚   "Could not find the panda installation, please instal  

     866 β”‚   β”‚   β”‚   )                                                          

     867 β”‚   β”‚   except Exception as e:                                         

────────────────────────────────────────────────────────────────────────────────

Exception: Could not find the panda installation, please install Pandas and 

retry

[16:40:49] ❗️ 

2024-11-15 16:40:49.169 503 GET /script-health-check (127.0.0.1) 6362.61ms

Here is the error when I try to import GeoAccessor directly.

ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' 

(/home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/__init__.py)

2024-11-15 16:58:03.150 503 GET /script-health-check (127.0.0.1) 405.66ms

────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/exec_code.py:88 in exec_func_with_error_handling                         

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:579 in code_to_exec                                     

                                                                                

  /mount/src/portfolio/wildfireApp.py:7 in <module>                             

                                                                                

     4 import matplotlib.pyplot as plt                                          

     5 import leafmap.foliumap as leafmap                                       

     6 from arcgis.gis import GIS                                               

  ❱  7 from arcgis.features import GeoAccessor, GeoSeriesAccessor               

     8 gis = GIS()                                                              

     9                                                                          

    10 # Set up             

When trying to change my arcgis version to 2.3.0.1. I get this error:

ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' 

(/home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/__init__.py)

2024-11-15 17:00:43.223 503 GET /script-health-check (127.0.0.1) 395.69ms

  Preparing metadata (pyproject.toml): finished with status 'done'

ERROR: Ignored the following yanked versions: 1.8.5.post1, 1.8.5.post2

ERROR: Ignored the following versions that require a different python version: 0.55.2 Requires-Python <3.5; 2.0.1 Requires-Python >=3.7, <3.10; 2.1.0 Requires-Python >=3.7, <3.10; 2.1.0.1 Requires-Python >=3.7, <3.10; 2.1.0.2 Requires-Python >=3.7, <3.10; 2.1.0.3 Requires-Python >=3.7, <3.10; 2.1.0.4 Requires-Python >=3.7, <3.10; 2.1.0.5 Requires-Python <3.10,>=3.7; 2.2.0 Requires-Python >=3.9, <3.12; 2.2.0.1 Requires-Python >=3.9, <3.12; 2.2.0.2 Requires-Python >=3.9, <3.12; 2.2.0.3 Requires-Python >=3.9, <3.12; 2.2.0.4 Requires-Python <3.12,>=3.9; 2.3.0 Requires-Python <3.12,>=3.9; 2.3.0.1 Requires-Python <3.12,>=3.9; 2.3.0.2 Requires-Python <3.12,>=3.9; 2.3.0.3 Requires-Python <3.12,>=3.9; 2.3.1 Requires-Python <3.12,>=3.9

ERROR: Could not find a version that satisfies the requirement arcgis==2.3.0.1 (from versions: 1.3.0, 1.3.0.post1, 1.3.0.post2, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.5.2.post1, 1.5.3, 1.6.0, 1.6.1, 1.6.1.post1, 1.6.2, 1.6.2.post1, 1.7.0, 1.7.1, 1.8.0, 1.8.0.post1, 1.8.1, 1.8.2, 1.8.3, 1.8.3.post1, 1.8.3.post2, 1.8.4, 1.8.5.post3, 1.9.0, 1.9.1, 2.0.0, 2.4.0)

ERROR: No matching distribution found for arcgis==2.3.0.1


[notice] A new release of pip is available: 24.0 -> 24.3.1

[notice] To update, run: pip install --upgrade pip

Checking if Streamlit is installed

────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/exec_code.py:88 in exec_func_with_error_handling                         

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:579 in code_to_exec                                     

                                                                                

  /mount/src/portfolio/wildfireApp.py:7 in <module>                             

                                                                                

     4 import matplotlib.pyplot as plt                                          

     5 import leafmap.foliumap as leafmap                                       

     6 from arcgis.gis import GIS                                               

  ❱  7 from arcgis.features import GeoAccessor, GeoSeriesAccessor               

     8 gis = GIS()                                                              

     9                                                                          

    10 # Set up                                                                 

────────────────────────────────────────────────────────────────────────────────

ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' 

(/home/adminuser/venv/lib/python3.12/site-packages/arcgis/features/__init__.py)

Found Streamlit version 1.40.1 in the environment


────────────────────────────────────────────────────────────────────────────────────────


[17:00:45] ❗️ installer returned a non-zero exit code

Try a different version of Python. When you deploy an app, you can change the Python version by clicking β€œAdvanced settings” at the bottom.

Thank you for the help and the time! So I ended up using :

arcgis == 2.3.0.1
python == 2.9

No need to mess with pandas version.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.