Python for ArcGIS 1.9.0 and ArcPy 2.8 incompatibility? (pandas)

845
6
09-06-2021 09:20 PM
Peter_GPOne
New Contributor II

Hi,

We have found that there may be an issue with the pandas install when using Python for ArcGIS 1.9.0 and ArcPy 2.8 together in a conda clone. Posting to see if it affects and/or helps others.

I am using Conda 4.10.0 and ArcGIS Pro 2.8.2 is installed on the machine.

Solution first:
The following works (update pandas):

conda create -c esri -n arcgis-pro --yes --offline python=3.7
conda install -c esri --yes --offline arcgis=1.9.0
conda install -c esri --yes --offline arcpy=2.8
conda install -c anaconda --yes --offline pandas=1.1.3

 Steps to reproduce breakage:
New clone, install Python for ArcGIS 1.9.0 (works ok at this time)

conda create -c esri -n arcgis-pro --yes --offline python=3.7
conda install -c esri --yes --offline arcgis=1.9.0
conda activate arcgis-pro python
>>> import arcgis
>>>
>>> exit()

Install ArcPy 2.8 (breaks Python for ArcGIS 1.9.0)

conda install -c esri --yes --offline arcpy=2.8
python
>>> import arcgis
>>> !!explosions!! (see error below)

Error:
If pandas is not upgraded/reinstalled after installing ArcPy 2.8, we received the following error when attempting to use Python for ArcGIS 1.9.0

(arcgis-pro) PS D:\> python
Python 3.7.10 (default, Feb 26 2021, 13:06:18) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcgis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\__init__.py", line 4, in <module>
    from . import features, geoanalytics, geocoding, geometry
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\features\__init__.py", line 33, in <module>
    from . import enrich_data
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\features\enrich_data.py", line 10, in <module>
    import arcgis.network as network
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\network\__init__.py", line 7, in <module>
    from ._layer import (
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\network\_layer.py", line 10, in <module>
    from arcgis.mapping import MapImageLayer
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\mapping\__init__.py", line 8, in <module>
    from ._types import (
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\mapping\_types.py", line 30, in <module>
    from arcgis.widgets._mapview._traitlets_extension import ObservableDict
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\widgets\__init__.py", line 2, in <module>
    from arcgis.widgets._mapview import MapView
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\widgets\_mapview\__init__.py", line 1, in <module>
    from arcgis.widgets._mapview._mapview import MapView
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\arcgis\widgets\_mapview\_mapview.py", line 38, in <module>
    import pandas as pd
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\pandas\__init__.py", line 22, in <module>
    from pandas.compat import (
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\pandas\compat\__init__.py", line 23, in <module>
    from pandas.compat.pyarrow import (
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\pandas\compat\pyarrow.py", line 9, in <module>
    _palv = Version(_pa_version)
  File "C:\ProgramData\Anaconda3\envs\arcgis-pro27\lib\site-packages\pandas\util\version\__init__.py", line 339, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object

 

6 Replies
DanPatterson
MVP Esteemed Contributor

Did you check the github site for already reported issues?

Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python (github.com)

you might want to post an issue their if you didn't find and open or closed issue that matches yours.


... sort of retired...
0 Kudos
Peter_GPOne
New Contributor II

I had a look but didn't find one, so raised it for visibility.
https://github.com/Esri/arcgis-python-api/issues/1094

0 Kudos
PeterMilenkovic
New Contributor III

That's a big pick up, thank you, it  has saved me a heap of time, most of my scripts stopped working last night. I tried uninstalling pandas and reinstalling 1.1.3 with ArcGIS Pro, but it installed the latest version (even though i selected 1.1.3), so used pip install on the cloned environment.

0 Kudos
Peter_GPOne
New Contributor II

No problem!

0 Kudos
AtmaMani
Esri Contributor

Please checkout the discussion and resolution at https://github.com/Esri/arcgis-python-api/issues/1094#issuecomment-917234647

0 Kudos
DrewLevitt
New Contributor II

I found that there was a version of `pyarrow` that was faulty - it didn't return a version number as expected. As of ArcGIS Pro version 2.8, this version (1.0.1 build 1, via the esri channel) came standard with the `arcgispro-py3` environment. For whatever reason, this doesn't cause problems in the AGP GUI, but it can prevent pandas and other packages that depend on pandas from importing correctly.

The solution that worked well for me was to activate the affected environment and `conda update pyarrow`. In my environment (which began as a clone of `arcgispro-py3`), this resulted in my installing pyarrow version 1.0.1 build 2, which is seemingly identical to 1.0.1 build 1 except that it returns a version number when queried by other packages.

0 Kudos