Arcgis Pro - Python 2.7 conflict ?

355
2
09-27-2021 02:57 AM
Arnaud_Leidgens
New Contributor III

Hi everyone,

I was used to work with ArcMap 10.6 and Python 2.7. At that time, I installed also Anaconda 3 to manage my environments and Spyder 4.1.5. I've just installed ArcGIS Pro 2.8.3 (including the last patch) on the same machine than ArcMap.

I cannot import arcpy in ArcGIS Pro. Here is below the traceback. The solution is probably easy but I'm a bit lost on how to proceed. I still have C:\Python27\ArcGIS10.6\Lib\site-packages path in my windows environment variables. Thank you in advance for your help.

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 149, in <module>
for arcpy_module in chain.from_iterable(module_paths):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\pathlib.py", line 1125, in glob
for p in selector.select_from(self):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\pathlib.py", line 490, in select_from
if not is_dir(parent_path):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\pathlib.py", line 1373, in is_dir
return S_ISDIR(self.stat().st_mode)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\pathlib.py", line 1183, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\NIGERIA_new\\SAKPONBA\\MXD\\ C:\\Python27\\ArcGIS10.6\\Lib\\site-packages'

Kind regards,

Arnaud

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

remove/uninstall python 2.7 if you have no need for ArcMap is the simplest solution, Pro uses python 3.7

Most python IDEs allow you to set/choose the python executable that they use as well (eg Spyder etc) if you must keep arcmap 


... sort of retired...
0 Kudos
Arnaud_Leidgens
New Contributor III

Thank you Dan for your help.

Solved : I've simply deleted PYTHONPATH in my system environment variables. Both Arcgis Pro and ArcMap are working well so far.

More information here : 

0 Kudos