ArcGIS Pro not importing installed Python modules

5527
15
Jump to solution
08-03-2021 08:19 AM
MollyMoore
Occasional Contributor

I have installed packages in a cloned environment using the Python Package Manager within ArcGIS Pro. The modules are showing up in the 'Installed Packages' section and everything looks fine: 

MollyMoore_0-1628003273321.png

However, it's not finding the modules when I try to import in Pro:

 

import pyodbc
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pyodbc'

 

This is happening with all installed packages. They used to work fine before upgrading Pro. I have restarted Pro, double-checked that the correct cloned environment is initialized, and tried installing the packages in a new cloned environment after upgrading Pro.

Anyone else having this issue? Anything I can do to fix this?

0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor

The issue causing the environment to fall back to arcgispro-py3 should be addressed in the Pro 2.8.2 patch. Alternatively, if you have an environment which is otherwise good, you can copy <Pro install>\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgisscripting\_arcgiscripting.pyd into the environment location at the <env>\Lib\site-packages\arcgisscripting\_arcgisscripting.pyd and things should work as expected.

View solution in original post

15 Replies
RobertHolliday
New Contributor III

I am seeing the same behavior after upgrading to 2.8.1. Script tools fail on importing pyodbc and the Python environment reverts back to the default environment. The tool script executes successfully when run from within VS Code.

0 Kudos
MollyMoore
Occasional Contributor

Thanks @RobertHolliday. Good to know this is a bug and likely not something specific on my end. 

0 Kudos
JoeBorgione
MVP Emeritus

...using the Python Package Manager within ArcGIS Pro

I haven't upgraded to 2.8.1 but I wonder if this ^ is your problem.  Try using a conda install instead and see if it works for you.  I've avoided the package manager for several versions.

That should just about do it....
0 Kudos
RobertHolliday
New Contributor III

I did a conda install after verifying that pyodbc did not install using the package manager. I have opened a support case. As soon as I know something I will update the thread.

JoeBorgione
MVP Emeritus

Thanks for doing that!  

That should just about do it....
0 Kudos
Tim_McGinnes
Occasional Contributor III

There is a known bug that causes the default environment to be activated instead of the cloned one. More details and a solution that worked for me are in this post: https://community.esri.com/t5/water-resources-questions/archydro-wetland-identification-model-scikit... 

ShaunWalbridge
Esri Regular Contributor

The issue causing the environment to fall back to arcgispro-py3 should be addressed in the Pro 2.8.2 patch. Alternatively, if you have an environment which is otherwise good, you can copy <Pro install>\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgisscripting\_arcgiscripting.pyd into the environment location at the <env>\Lib\site-packages\arcgisscripting\_arcgisscripting.pyd and things should work as expected.

JoeBorgione
MVP Emeritus

@RobertHolliday did you get anywhere with tech support?  I ask because I had an unrelated case case open and discussed this topic with the analyst. He then provided the same solution @ShaunWalbridge does above but he told me the actual bug fix won’t be until 2.9. 
 
Can we get a definitive answer from ESRI ? @KoryKramer  

That should just about do it....
0 Kudos
KoryKramer
Esri Community Moderator

This issue was submitted as a bug with technical support and as Shaun commented, is fixed with the 2.8.2 patch.  See https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDE0MTAxNQ==

KoryKramer_0-1629117605939.png

It looks like Support was seeing this as fixed in 2.9, but it has since been corrected in the system to show as fixed with the patch.  Please install Patch 2 for Pro 2.8 for the fix.

Thank you!