[GRASS-dev] Addons: Python error when checking if package is installed - r.randomforest

Markus Neteler neteler at osgeo.org
Mon Jun 27 04:18:06 PDT 2016


Hi,

I was checking why r.randomforest is not showing up on the Web site:
The log file gives an error here:

https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.randomforest/r.randomforest.py#L158
        grass.fatal("Python package <%s> not installed
(python-sklearn). Exiting" % module_name)

but the sklearn package *is* installed.

Trying it manually on the server:

neteler at osgeo6:~$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24)
>>> import atexit, random, string, imp, re
>>> imp.find_module("sklearn")
(None, '/usr/lib/python2.7/dist-packages/sklearn', ('', '', 5))

... how come?

Checking if it is really installed:
neteler at osgeo6:~$ ls /usr/lib/python2.7/dist-packages/
antlr.py                       lxml/                       Pyste/
[...]
defusedxml-0.4.1.egg-info      PIL/                        six.pyc
dns/                           PILcompat/                  sklearn/

--> installed.

neteler at osgeo6:~$ ls /usr/lib/python2.7/dist-packages/sklearn/
base.py               feature_extraction/       lda.pyc          qda.py
base.pyc              feature_selection/        linear_model/    qda.pyc
[...]

What's wrong on the server? Or is the test wrong?
(I noted that various GRASS scripts use different ways for this check,
the test for 3rd party packages should be standardized.)

Thanks for any hints.

Markus


More information about the grass-dev mailing list