I am using ArcGIS Pro version 2.8.1 and the Wetland Identification Model process that is part of the ArcHydro toolbox. I have been following the steps within the documentation, and have successfully worked through the entire process. However, in a new iteration, when adding an additional predictor variable, I am getting this error:
('line 242', 'c:\\program files\\arcgis\\pro\\Resources\\ArcToolbox\\Scripts\\archydro\\trainrandomtrees.py', "ModuleNotFoundError: No module named 'sklearn'")
The project python environment clearly shows that sckikit-learn is installed.
I have tried recloning the default python and installing scikit-learn package to the new clone, but it still results in that error.
I am at a loss as to what to try next.
Solved! Go to Solution.
This turned out to be a known bug with the ArcGIS Pro 2.8.1 update. BUG-000141015 - ArcGIS Pro 2.8.1 does not honor the active environment set through Python Package Manager, and causes the active environment to be reset to the base arcgispro-py3. This will be fixed in a future release.
this was the workaround that fixed the issue:
5. After the file has been pasted there, reopen ArcGIS Pro & attempt to use the cloned environment.
Were you following this document for the install Caroline?
Arc Hydro - Wetland Identification Model.pdf (esri.com)
Yes, that is the document I followed to install the package.
That is what I was checking. If it is installed in your clone are you running the analysis from that environment? Your error line looks like it is the base/main environment
Well yes, but I'm uncertain why every time I reopen the project, it returns to the default instead of the cloned environment.
I am still getting the error, despite double-checking that it is the cloned environment with scikit-learn installed.
Hi @CarolineChanEEC. Scikit-learn may be included in Pro 2.8.1 by default. Can you try the following and let me know the results?
-open the command prompt
- enter: proswap arcgispro-py3
- open pro
- open python window
- enter: import sklearn
- respond here with the output, it will either return an error or execute successfully
If that process does not return any errors, try executing the WIM process again in the open session of Pro. I'm thinking maybe sklearn already existed in your pro environment and by installing it "again" you could have changed the version of sklearn which may conflict with another library.
This turned out to be a known bug with the ArcGIS Pro 2.8.1 update. BUG-000141015 - ArcGIS Pro 2.8.1 does not honor the active environment set through Python Package Manager, and causes the active environment to be reset to the base arcgispro-py3. This will be fixed in a future release.
this was the workaround that fixed the issue:
5. After the file has been pasted there, reopen ArcGIS Pro & attempt to use the cloned environment.
Thanks for sharing that! Did the WIM tool work as expected after that workaround?