Select to view content in your preferred language

ArcGIS Pro Notebook error

2841
5
Jump to solution
03-11-2022 01:17 PM
MartyRyan
Occasional Contributor

I am attempting to classify an image with a trained deep learning model that appeared to successfully work before. I enter the following as the first line in the Notebook: 

from arcgis.learn import prepare_data, UnetClassifier

Instead of the next cell opening, I get this message:

ImportError Traceback (most recent call last)
In [4]:
Line 1: from arcgis.learn import prepare_data, UnetClassifier

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\__init__.py, in <module>:
Line 4: from . import features, geoanalytics, geocoding, geometry

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\__init__.py, in <module>:
Line 26: from .feature import Feature, FeatureSet, FeatureCollection

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\feature.py, in <module>:
Line 25: from arcgis.gis import Layer

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in <module>:
Line 34: from cachetools import cached, TTLCache

ImportError: cannot import name 'cached' from 'cachetools' (unknown location)

I cannot find any information on this Import Error (I am not proficient in Python) - what is missing, or how to fix it. Can anyone help?

I am working in ArcGIS Pro 2.9.2 and have installed the Deep Learning Libraries for 2.9 

Thanks 

 

 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

could be an install issue

C:\...Your_install_folder ...\bin\Python\envs\arcgispro-py3\Lib\site-packages\cachetools

try 

from cachetools import cache

from your environment, it is installed with Pro 2.9

A related issue was noted previously

No module named 'cachetools' · Issue #36 · Esri/deep-learning-frameworks (github.com)

 


... sort of retired...

View solution in original post

0 Kudos
5 Replies
DanPatterson
MVP Esteemed Contributor

could be an install issue

C:\...Your_install_folder ...\bin\Python\envs\arcgispro-py3\Lib\site-packages\cachetools

try 

from cachetools import cache

from your environment, it is installed with Pro 2.9

A related issue was noted previously

No module named 'cachetools' · Issue #36 · Esri/deep-learning-frameworks (github.com)

 


... sort of retired...
0 Kudos
MartyRyan
Occasional Contributor

Dan, Thank you for responding - I was hopeful but I am still not getting beyond this error: I tried entering "from cachetools import cache" and still get an error:

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
In [1]:
Line 1: from cachetools import cache

ImportError: cannot import name 'cache' from 'cachetools' (unknown location)

I've tried other import functions and each one generates the same error. In some cases, instead of saying it cannot impart name "cache", it says cannot import name "cached" - this makes it even more confusing. 

I am considering uninstalling the 2.9 DL Libraries for the second time and reinstalling them. 

0 Kudos
DanPatterson
MVP Esteemed Contributor

Are you running the script from a cloned environment?  If so, it looks like your clone doesn't contain all the necessary elements and/or the DL package was not installed with the correct version or something went wrong.  

Just in case

Esri/deep-learning-frameworks: Installation support for Deep Learning Frameworks for the ArcGIS Syst...


... sort of retired...
0 Kudos
MartyRyan
Occasional Contributor

Dan,

Thanks again - I just had a conference with my manager and the import functions work fine in his setup. We confirmed that I am not working in a cloned environment and my Python setup is fine -

His suggestion: Reinstall the 2.9 Libraries and if that doesn't work, do a new install of Pro 2.9 - 

I'm uninstalling the libraries now and will see how it goes - thanks again

0 Kudos
ÅsaBlomberg
Occasional Contributor

Hi @MartyRyan ! Did you solve this? I have the same issue. Thanks!

0 Kudos