Noticed an interesting issue when was trying to add a python environment, post it out to see any insights.
My ArcGIS pro was installed in D:\Program Files\.... when I using the default python environment arcgispro-py3, things are doing correctly, specifically when I ran print(sys.path) in Terminal that the library paths are pointing to the D drive, for e.g : d:\Program files\arcgis pro\resource\arcpy
That means, arcpy can be found when importing into scripts
however, when cloning an environment or adding an existing one through ArcGIS Pro environment management, print(sys.path) in Terminal again that library paths are pointing to C drive rather than D, e.g C:\Program files\arcgis pro\resource\arcpy. As the ArcGIS Pro actually installed on D, so ArcPy can't be found in the script, causing issues like "No module named ArcPy"
ArcGIS Pro 2.5.1 is used in this case and python 3.6.9. tried to reset those paths but failed. after dig out a bit seems the conda has the problem with python 3.6
Are you switching to the cloned environment through Pro or by using proswap.bat before you do this?
Thanks Dan. Cloned environment through Pro.
I have Pro 2.6.1 installed in E:\ArcGIS, and I can't replicate what you are seeing. It may, may, be a 2.5.1 issue, so it wouldn't hurt to upgrade to the latest version and patch. If you still see the issue afterwards, you will have to share more specifics about your steps to clone/add an environment and activate it.
thanks.. unfortunately, I can't update the ArcGIS Pro in this case. This issue was finally resolved by re-install the ArcGIS Pro in C:\ as a workaround.