Errors with dependency installation and Deep Learning Tool model availability in Anaconda 3.8

3069
14
Jump to solution
02-13-2021 06:05 PM
JackCharde1
New Contributor III

Hey everyone (and @KarthikDutt, who asked me to post this here!)

I ran into an issue while using Jupyter Notebook and arcgis.learn for the first time while following this Esri Youtube Video

I found the github location for the workflow and tried following the documentation but ran into dependency installation issues and deep learning tool model existence in certain versions of Anaconda.

I could not get this to work in a Jupyter Notebook. Maybe someone might have some insight!

I downloaded Anaconda, version 3.8, and installed ArcGIS API for Python (arcgis) per the blog "Three Ways to Get Jupyter Notebooks and the ArcGIS API for Python".

With my data in a notebook, I tried according to the video at timestamp 2:07:

ln[1]: from arcgis.learn import prepare_data, MultiTaskRoadExtractor

ln[2]: data_path=..... <<(I selected the path where my image chips were stored)

ln[3]: data = prepare_data(data_path, chip_size=256, batch_size=135)

I received a traceback error on ln[3] saying I was missing a number of dependencies required to use MultiTaskRoadExtractor. So, I opened the Anaconda command prompt and tried installing them, only to be told that there were a bunch of conflicts that prevented install.

So I researched how to create new Anaconda environments, and created one for Python 3.6, because some forums said some dependencies like earlier versions better. I installed arcgis so I could access Jupyter Notebooks in Python 3.6. Also, in my Python 3.6 environment, the dependencies now installed without issue. But then when I tried the above code again in a 3.6 Notebook, ln[1] returned a traceback error saying:

"ImportError: cannot import name 'MultiTaskRoadExtractor' from 'arcgis.learn' (C:\Users\JohnC\anaconda3\envs\snakes\lib\site-packages\arcgis\learn\__init__.py)"

To see if there was a model existence issue, I compared the 'lib\site-packages\arcgis\learn\__init__.py" files between environments, and the Python 3.6 environment did not have the MultiTaskRoadExtractor model. Version 3.8 does.

So I tried creating another anaconda environment in Version 3.7 to see if I could install these model dependencies and see if the MultiTaskRoadExtractor model was available for import into a Notebook. It also was not. It seems only Version 3.8 has this model, but the dependencies also won't download to the 3.8 environment.

So I'm unsure what to do, and I've exhausted my level of knowledge with this stuff (which is next to nothing).

Do you have any suggestions? Is there more information you need from me to answer this? Let me know and thank you in advance.

0 Kudos
1 Solution

Accepted Solutions
SandeepKumar1
Esri Contributor

Hi @JackCharde1 

Can you replace the arcgis API version in the installation command and try again.

conda install -c esri -c fastai -c pytorch arcgis=1.8.4 scikit-image=0.15.0 pillow=6.2.2 libtiff=4.0.10 fastai=1.0.60 pytorch=1.4.0 torchvision=0.5.0 --no-pin

 

Thanks,

Sandeep

View solution in original post

0 Kudos
14 Replies
DanPatterson
MVP Esteemed Contributor

How Multi-Task Road Extractor works ? | ArcGIS for Developers

Did you check the following section in that link?

Setting up the environment

You might want to check out the github site as well

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


... sort of retired...
0 Kudos
JackCharde1
New Contributor III

@DanPatterson I did look at the first link, but I will look over it again (maybe something will click in my brain) and definitely check out the 2nd.

 

Thanks!

0 Kudos
JackCharde1
New Contributor III

So, I got it to work, but only when using a notebook within ArcGIS Pro. After installing the Deep Learning Frameworks to my ArcGIS Pro install, I was able to use the MultiTaskRoadExtractor model within the program, because all of the necessary libraries were finally available.

Trying to use the model in a Jupyter Notebook through a web browser tab, activated by my Anaconda Command Prompt still does not work, because of the weird dependency install issues.

0 Kudos
DanPatterson
MVP Esteemed Contributor

whatever environment is activated through your conda prompt would also have to have all the dependencies installed.

Deep learning .... makes you wonder sometimes ;)


... sort of retired...
0 Kudos
JackCharde1
New Contributor III

That was the issue. I tried installing the dependencies on three environments: default (v3.8), "rattler" (v3.6), and "snakes" (3.7). They installed on 3.6 and 3.7 without issue, but wouldn't install on 3.8. The arcgis package installed on each version without issue, but versions 3.6 and 3.7 didn't include the MultiTaskRoadExtractor model, so I couldn't use those versions to run a jupyter notebook. So my only option was my 3.8 environment, which wouldn't install the dependencies. 

Haha, deep learning indeed. Maybe one day it can deep learn my issues and solve 'em for me!  

0 Kudos
DanPatterson
MVP Esteemed Contributor

some of the deep learning packages aren't/weren't supported in python 3.8 (tensorflow is one if memory serves).

I suspect they have been slowing up arcpy upgrades which is why 3.7 is the version for arcgis pro 2.7.


... sort of retired...
0 Kudos
JackCharde1
New Contributor III

That definitely seems like the issue. Thanks for the help!

0 Kudos
SandeepKumar1
Esri Contributor

Hi Jack,

MultiTaskRoadExtractor model was added in ArcGIS Python API version 1.8.1, any subsequent release will have that. Can you also attach output of conda list from your env where it is not working.

 

Thanks,

Sandeep

0 Kudos
JackCharde1
New Contributor III

@SandeepKumar1 hopefully the attached photos are what you are asking for! I am so new to this, and constantly researching when I run into something new I've not done before.

 

0 Kudos