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:
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?
Solved! Go to Solution.
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.
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.
Thanks @RobertHolliday. Good to know this is a bug and likely not something specific on my end.
...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.
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.
Thanks for doing that!
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...
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.
@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
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==
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!