recommended way of installing geopandas & fiona with arcpy

2059
21
Jump to solution
09-30-2021 09:15 AM
glw
by
New Contributor III

Im having trouble installing geopandas (w/ fiona)

I have Arcpro 2.8 patch2 - which mentions that installation of geopandas has been fixed. 

glw_0-1633017052386.png

My experience is that after creating the python env clone, using the arcpro gui to install geopandas, fails without error message. Using the Python Command Prompt using "conda install geopandas" succeeds in the installation of geopandas but importing within python fails.

geopandas error:

glw_1-1633017337717.png

fiona error:

glw_2-1633018297805.png

Finally I created an env within the Python Command Prompt with "conda create --name another_env python". Then installed geopandas, and finally arcpy. This installation worked for geopandas but fiona is still not working.

Is there a recommended way to install geopandas and fiona to work along side arcpy?

Thanks!

1 Solution

Accepted Solutions
DarrenConly
New Contributor III

Hi All,

I installed geopandas after updating to ArcGIS Pro 3.0, and the issue I had above with read_file() has disappeared.

Notably, when I install geopandas, instead of installing fiona 1.8.13, it installs fiona 1.8.21. Also, gdal version in Pro 3.0 is gdal 3.4.0 instead of 3.3.0.

So for what it's worth, updating to Pro 3.0 seems to have fixed the issue for me--though I'm bummed at the prospect that this will likely crop up again when ESRI releases future updates Pro updates.

View solution in original post

0 Kudos
21 Replies
DanPatterson
MVP Esteemed Contributor

geopandas   0.9 ?

fiona 1.8.13.0  ?


... sort of retired...
0 Kudos
glw
by
New Contributor III

yes that is correct.

0 Kudos
DarrenConly
New Contributor III

Is there any follow-up on this topic? I had the same issue with Pro 2.8 and still have it with Pro 2.9.

These are the versions of geopandas and fiona that I have:

DarrenConly_0-1637450143573.png

 

And this is what happens when I import fiona or run geopandas.read_file()

DarrenConly_1-1637450204671.png

As a test, I installed geopandas in a non-arcgis environment and it works fine

In the non-arcgis environment (created by running conda create geopandas-test), these are the versions of fiona/geopandas after running conda install geopandas:

DarrenConly_2-1637450604812.png

The versions and channels for geopandas and fiona look to be the same in both the arcgis and non-arcgis environments, but gdal is different: In the arcgis cloned env, gdal is version 3.3.0, while in the non-arcgis env it's 3.0.2. Not sure if this is the reason for the error, but worth noting.

With this information, is there any way to get geopandas and fiona to work in an arcgis environment? I actually can use some geopandas functions, but if it needs fiona it won't work (e.g., geopandas.read_file() requires fiona so I cannot use it currently or it gives me an error).

 

Thank you,

 

 

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

geopandas/ecosystem.md at 08cb5909b88837a2a963f22a81874287ea2ef5ae · geopandas/geopandas (github.com...

gdal 3.3.0

and I am not sure if osgeo is a full install (if you are familiar with it, compare this folder from base to your clone's )

C:\...Your_Install_folder...\bin\Python\envs\arcgispro-py3\Lib\site-packages\osgeo

If it works in the clone, stick with it until python moves beyond 3.7 at least


... sort of retired...
0 Kudos
DarrenConly
New Contributor III

Hi Dan,

I compared the osgeo folders for the two environments:

For the arcgis-pro based environment (clone of arcgispro-py3; fiona doesn't load on it):

DarrenConly_0-1637721995779.png

 

Then for the non-arcgis environment (in which fiona correctly loads):

DarrenConly_1-1637722064854.png

The most notable difference is that the arcgis env contains a script utils.py,while the non-arcgis version does not contain it.

0 Kudos
DanPatterson
MVP Esteemed Contributor

You will have to examine the __init__ and utils scripts to see what they contain


... sort of retired...
0 Kudos
GARYLESTER
New Contributor

I have had this issue before, I think you should get  the precompiled whl files from here https://www.lfd.uci.edu/~gohlke/pythonlibs/ . I downloaded gdal,fiona and geopandas. First I uninstalled  the gdal version that comes with arcgisPro then I installed gdal,fiona then geopandas. I have only had luck  installing these through command line. Make sure you download the precompiled library for your specific python version and the versions of fiona and gdal must be compatible.

0 Kudos
DarrenConly
New Contributor III

Hi Gary,

 

Thanks for the tip. I tried the following:

  1. create new environment as clone of default Pro environment
  2. Ran conda remove gdal --force-remove to remove gdal without also removing arcpy
  3. Ran conda install gdal=3.0.2 -c conda-forge, since gdal 3.0.2 did not have the fiona issue

However, running step 3 said there were various conflicts between gdal 3.0.2 and the other packages in the Pro environment. Specific conflicts are listed below, but critically, it looks like arcpy and arcgis have inconsistencies, and since my goal is to have arcpy and fiona work in the same env, I cannot get rid of arcpy.

The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - esri/win-64::arcgis==1.9.1=py37_2327
  - esri/win-64::arcpy==2.9=py37_arcgispro_32704
  - defaults/win-64::argon2-cffi==20.1.0=py36he774522_1
  - defaults/win-64::ipykernel==5.3.4=py36h5ca1d4c_0
  - defaults/win-64::ipywidgets==7.4.2=py37_0
  - esri/noarch::jupyterlab==2.2.7=py_0
  - defaults/noarch::jupyterlab_server==1.2.0=py_0
  - esri/noarch::jupyter_console==6.4.0=py_1
  - esri/noarch::jupyter_contrib_core==0.3.3=py_4
  - esri/noarch::jupyter_contrib_nbextensions==0.5.1=py_23
  - esri/noarch::jupyter_highlight_selected_word==0.2.0=py_4
  - esri/noarch::jupyter_latex_envs==1.4.6=py_3
  - esri/noarch::jupyter_nbextensions_configurator==0.4.1=py_3
  - defaults/win-64::notebook==6.1.1=py36_0
  - esri/win-64::pro_notebook_integration==2.9=py37_9
  - defaults/win-64::widgetsnbextension==3.4.2=py37_0

 

Is there any reason why the pre-compiled WHL files are different from conda forge? And did you run into the same conflicts?

 

Thanks,

 

Thanks

0 Kudos
DanPatterson
MVP Esteemed Contributor

arcpy and gdal and numpy are tied together for a variety of functions and functionality.

You would be ill advised to mess with the linkage


... sort of retired...