I have an installation of ArcGIS Desktop on my Win 10 machine with its Python 2.7 installed as well as a previous Python 3.9 installation and would like to be able to use arcpy from python scripts and jupyter, preferably Python 3.
Importing arcpy with python 2.7 works fine. Jupyter however only has the original Python 3 kernel which does not have the arcpy package installed. I have also created a new conda environment with python 2.7 which unfortunately can't seem to install arcpy (conda install arcpy -c esri) and gives the error "Unable to locate a valid Pro or Server installation....".
How am I able to get a conda environment, preferably Python 3, with arcpy working?
currently arcpy for arcgis Pro uses python3.7, so your 3.9 environment won't work and jupyter support for it requires Arcgis pro
Is there a way to use arcpy with python 2.7 then in a conda environment and with jupyter? I can't seem to install the package.
I've had success using pip to install new packages into the ArcMap Python 2.7 environment. The best practice is to clone the environment first, because you're modifying the environment ArcMap depends on.
As far as I've seen there is no other way to port arcpy into a fresh conda env. If jupyter has an install for 2.7 then that might be possible using this method.
arcpy already exists with an ArcMap installation. If you want to use python 3, then install ArcGIS Pro, which comes with a valid license for Desktop. If you want to move to jupyter notebooks or jupyterlab, then this is the way to go, in fact notebooks are supported from with Pro.
PS arcpy will only work if it is installed on a machine with a valid Pro license ... it can't be installed separately on another machine in a conda environment with a valid desktop install (aka arcmap arcgispro)