Select to view content in your preferred language

arcgis.layers module not working

163
5
a week ago
tad
by
Occasional Contributor

Hi,

I'm trying to add an image service to a map. I'm following documentation (https://developers.arcgis.com/python/latest/guide/using-imagery-layers/) that says to use the arcgis.layers module, but I get the following error: ModuleNotFoundError: No module named 'arcgis.layers'

I'm using ArcGIS Pro 3.2, I cloned and updated the active environment...still not found. Any suggestions would be appreciated.

Thanks.

0 Kudos
5 Replies
CodyPatterson
MVP Regular Contributor

Hey @tad 

Are you importing the arcgis.layers module?

CodyPatterson_0-1736273480116.png

Cody

 

0 Kudos
tad
by
Occasional Contributor

Yes, @CodyPatterson  that's what is causing the error I'm receiving. Sorry, I should have made that more clear...

0 Kudos
DanPatterson
MVP Esteemed Contributor

arcgis 2.4 requires python  >3.10 <3.13

doesn't Pro 3.2 use 3.9?

give this a try

import arcgis
arcgis.__version__
'2.4.0'

from arcgis import layers

dir(layers)
['BasemapService',
 'BasemapServices',
 'BuildingLayer',
 'CSVLayer',
 'EnterpriseMapImageLayerManager',
 'EnterpriseSceneLayerManager',
 'EnterpriseVectorTileLayerManager',
.... snip ...

maybe the clone installed a different versin and "layers" is now a separate module


... sort of retired...
0 Kudos
tad
by
Occasional Contributor

Thanks @DanPatterson. That still didn't work. If it's retired, is there a new (or different) way of adding an image web service?

0 Kudos
DanPatterson
MVP Esteemed Contributor

its npt retired ... I am

so you are aren't using Pro 3.4 and python 3.11 and the cloning of the environment wouldn't have installed the correct version of the arcgis module, and even if you did install it, you will have to check that is the correct version in the clone


... sort of retired...
0 Kudos