ArcGIS Pro, when initially released, included an incredibly powerful capability, the included Python environment is a Conda environment. This unlocks the extremely powerful and vast universe of installable packages available through Conda. Further, using Conda environments enables ensuring a project can be successfully moved to another machine, and successfully run by exporting to an
environment.yml file, and using this file to recreate the exact same environment on the new machine. This however, does not work perfectly when recreating environments dependent on the functionality of ArcPy.
There is, however, a pretty straightforward workaround you can use to still take advantage of the functionality offered by cloning environments, and still have access to ArcPy in this new environment. First, clone the default ArcGIS Pro environment,
arcgispro-py3 and then use
conda update -f environment.yml to install the requirements needed for your specific project.
Every time I install ArcGIS Pro on a new machine, I apply this paradigm using a
cmd script to create the new environment, install a few dependencies I regularly use, update a few packages I want to ensure are current (most notably,
arcgis), and also enable the map widget to work in the Jupyter Lab environment.
It is important to note, for the map widget to work correctly, the
arcgis version must match in both of these files. As of 31Oct2019, the version is 1.7.0, but as this incrementally increases, I will update this Gist.
Using this paradigm, you can follow the best practices to ensure your projects will work when moved from your machine using an
environment.yml file while not breaking ArcPy. Happy coding!