[QGIS-Developer] sklearn error

Tyler Veinot tylerkveinot at gmail.com
Thu May 26 06:49:06 PDT 2022


I am trying to use sklearn in QGIS python console, it is showing up as
installed and I can import modules from it but when I run script I get the
error message
"Traceback (most recent call last):
  File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 6, in <module>
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\cluster\__init__.py",
line 6, in <module>
    from ._spectral import spectral_clustering, SpectralClustering
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\cluster\_spectral.py",
line 15, in <module>
    from ..metrics.pairwise import pairwise_kernels
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\metrics\__init__.py",
line 37, in <module>
    from . import cluster
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\metrics\cluster\__init__.py",
line 8, in <module>
    from ._supervised import adjusted_mutual_info_score
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\metrics\cluster\_supervised.py",
line 24, in <module>
    from ._expected_mutual_info_fast import expected_mutual_information
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
_import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named
'sklearn.metrics.cluster._expected_mutual_info_fast'"
Has anyone had this issue and devised a work around?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220526/3225a387/attachment.htm>


More information about the QGIS-Developer mailing list