Select to view content in your preferred language

Issue with pydantic

120
3
Monday
HamzaMerini
Occasional Contributor

Hi everyone,

I'm migrating from ArcGIS Pro 3.1 to 3.4 and updating my code from `arcgis.mapping.WebMap` to `arcgis.map.Map` accordingly.

**Environment:**
- ArcGIS Pro 3.4
- arcgis 2.4.0
- arcgis-mapping 4.30.0
- Python 3.11 (conda env)
- Windows 10

**The issue:**
When instantiating `Map(item=webmap_item)`, I get the following error:

```
TypeError: 'MockValSer' object is not an instance of 'SchemaSerializer'
File "...arcgis\map\map_widget.py", line 488, in _update_source
self._webmap_dict = self._webmap.dict()
File "...arcgis\map\_dataclasses\_webmap_spec.py", line 73, in dict
d = super().model_dump(
File "...pydantic\main.py", line 475, in model_dump
return self.__pydantic_serializer__.to_python(
```

This seems to be a conflict between `arcgis-mapping 4.30.0` and pydantic v2. I've tried multiple pydantic v2 versions (2.4.0, 2.5.0, 2.13.4) with their matching `pydantic-core` versions, reinstalling from both pip and conda-forge, but the error persists.

Has anyone successfully used `arcgis.map.Map` on Windows with ArcGIS Pro 3.4? If so, what exact version of pydantic are you running?

Thanks!

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

2.4.2 according to the package release by version document

arcpy/docs/ArcGIS-Pro-Python-Distribution-By-Release.pdf at main · Esri/arcpy


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

I updated pydantic to 2.4.2 but still have an issue 

HamzaMerini_0-1781011022929.png

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

sounds like an issue with what you are using whatever MockValSer is.

Tech Support would be your best bet, especially since you have the correct version of pydantic installed for your version of Pro.  Perhaps other issues have been seen that are addressed in more recent versions of Pro.

Good luck


... sort of retired...
0 Kudos