ArcPro 2.8 and arcpy install errors

4379
6
Jump to solution
08-13-2021 02:16 PM
kkUSGS
by
New Contributor II

I'm running ArcPro 2.8 and trying to install arcpy into a separate conda distribution (that is, a conda distribution not associated with Arc) using the command:

 

conda install arcpy -c esri

 

 

If I understand correctly, this should be possible with ArcPro >2.7. I get the error: ERROR conda.core.link:_execute(698): An error occurred while installing package 'esri::arcgis-1.9.0-py37_2172' and and 

"TypeError: expected string or bytes-like object

==> script output <==
stdout: jupyter nbextension command failed: map widgets in the jupyter notebook may not work, installation continuing...
jupyter nbextension command failed: map widgets in the jupyter notebook may not work, installation continuing...

stderr:
return code: 1"

 

Some considerations:

I need a separate conda installation because most of my Python work is done outside of the Arc software. I need the flexibility to update conda/packages as needed and have a variety of envs.

But I'd also like to use arcpy... whether that is 1) in an environment associated with my separate conda installation or 2) with the Arc-distributed conda installation. I cannot get either option to work. For option 2, I cannot clone the arcgispro-py3 environment or activate it from my cmd (I think because my PATHS are all associated with my separate conda distribution). 

Am I missing something obvious? Are others running a separate conda installation *and* leveraging arcpy in an environment?

 

0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor

Hello @kkUSGS,

Best I can tell this is a bug with either the Python API or one of the packages it installs. Could you try breaking down the installation into two stages, first installing the Python API, then secondarily installing ArcPy? Because ArcPy has the Python API listed as a dependency, it ends up installing many packages all in one shot, and this may be sufficient to prevent whatever is failing from affecting the installation. See if running:

conda install -c esri arcgis

Succeeeds, then afterward run:

conda install -c esri arcpy=2.7

If either of those steps fail, I can suggest more in-depth approaches to addressing the issue.

View solution in original post

6 Replies
DanPatterson
MVP Esteemed Contributor

Have you tried installing "arcpy" inside your separate environment?  It is supposed to be possible as long as your computer has ArcGIS Pro installed on it.  "arcgis" should be installable since it uses "shapely" if arcpy can't be found.

Install ArcPy—ArcGIS Pro | Documentation

Beginning with ArcGIS Pro 2.7, you can add ArcPy to an existing Python 3 environment, as long as its package versions are not in conflict. To add ArcPy, use conda to install ArcPy from the Esri channel on Anaconda Cloud. From the Python Command Prompt, run the following command with the appropriate release number:

conda install arcpy=2.8 -c esri


... sort of retired...
0 Kudos
ShaunWalbridge
Esri Regular Contributor

Hello @kkUSGS,

Best I can tell this is a bug with either the Python API or one of the packages it installs. Could you try breaking down the installation into two stages, first installing the Python API, then secondarily installing ArcPy? Because ArcPy has the Python API listed as a dependency, it ends up installing many packages all in one shot, and this may be sufficient to prevent whatever is failing from affecting the installation. See if running:

conda install -c esri arcgis

Succeeeds, then afterward run:

conda install -c esri arcpy=2.7

If either of those steps fail, I can suggest more in-depth approaches to addressing the issue.

kkUSGS
by
New Contributor II

Hey @ShaunWalbridge  thanks for the info! It worked!! 

I created a clean, new environment called "arcpro", which is associated with my separate (aka non-ESRI distributed) conda distribution.

After activating the conda environment called "arcpro" I ran: 

conda install -c esri arcgis

That installation worked!

I then ran: 

conda install -c esri arcpy=2.8

I opted for arcpy=2.8 based on @DanPatterson  reply. It wasn't clear to me if the arcpy version should match the ArcPro version (I have ArcPro 2.8 installed). If that is incorrect, I can repeat with arcpy=2.7 as the option.

But, those steps worked! And then I activated the arcpro environment, got into the Python interpreter, and tested with "import arcpy". Arcpy was able to import. Fantastic!

0 Kudos
kkUSGS
by
New Contributor II

Just a quick update... as seems to be so typical of working in the python path world, I may have spoken too soon that there was a full resolution.

My ArcPro is now broken (after getting arcpy to install in a conda env associated with the conda distribution that is separate from ESRI). The software just spins when I open it, and I see the "Failed to Initialize Python Interpreter" message. I'm looking at this tech article: https://support.esri.com/en/technical-article/000018812 to work on a solution. If I can't get it figured out, I'll open a new post with the new issue.

0 Kudos
kkUSGS
by
New Contributor II

Reinstall of ArcPro seems to have fixed it. Did the usual... reinstall software. Reboot machine.  So far with testing, ArcPro opens projects and seems fine. Arcpy loads into my arcpro env. Keep your fingers crossed for continued stability.

0 Kudos
CoMAGOL_ADMINISTRATOR
Occasional Contributor

Hi @kkUSGS 

The error you got happens for 2.7 and 2.8, and it seems to be logical order of install. I have found sometimes when I ran

 

conda install -c esri arcpy=2.7 arcgis=1.9.0

 

it works perfectly, but occasionally it fails with your error, but if I run it again - worked fine

In our workflow at work, I normally have it installed on PCs as follows (as suggested by @ShaunWalbridge)

 

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.7 deep-learning-essentials=2.7

 

 

Note the installs need to be done with administrator permissions, otherwise arcgis pro dll links will fail

You should see something like this at the end of the install

Preparing transaction: done
Verifying transaction: done
Executing transaction: - Enabling notebook extension collapsible_headings/main...
- Validating: ok

/ Symbolically linked the ArcPy DLLs. This will keep your environment synced with the build automatically.

done

Our environment:

  • MiniConda: conda 4.10.3
  • pkgs_dirs - unc path
  • all conda installs are download
  • easy deployment then to PCs and Servers

 

0 Kudos