[QGIS-Developer] Error trying to import linear_model from sklearn in Qgis

Xavier Corredor Llano xavier.corredor.llano at gmail.com
Fri Oct 25 09:29:35 PDT 2019


Thanks Akbar,

I see that it is a particular error of mine (instalacion, versions or
platform...), no idea what is happening, I need to check more.

Xavier

On Fri, 25 Oct 2019 at 00:39, Akbar Gumbira <akbargumbira at gmail.com> wrote:

> Even though it works fine on my local (QGIS 3.8.3, Mac, Python 3.7,
> sklearn 0.21.3), I often encountered that error, most of the time related
> to floats operation (e.g np.float32 not JSON serializable)
>
> Python Console
>
> Use iface to access QGIS API interface or Type help(iface) for more info
>
> Security warning: typing commands from an untrusted source can lead to
>> data loss and/or leak
>
> >> from sklearn import linear_model
>
> >> import numpy as np
>
> >> X = np.random.randint(10, size=(10, 2))
>
> >> Y = np.random.rand(10, 1)
>
> >> X.shape, Y.shape
>
> ((10, 2), (10, 1))
>
> >> reg = linear_model.LinearRegression().fit(X, Y)
>
>
>
>
> On Fri, Oct 25, 2019 at 12:30 AM Xavier Corredor Llano <
> xavier.corredor.llano at gmail.com> wrote:
>
>> Hello everyone,
>>
>> I don't know if this is a bug in Qgis or it happens only to me.
>>
>> The linear_model from sklearn works perfectly outside Qgis, but when I
>> try to import that library inside python shell in Qgis it's not possible:
>>
>> To reproduce the error is just when you import the library like this:
>> from sklearn import linear_model
>>
>> The error:
>> RecursionError: maximum recursion depth exceeded
>>
>> Does anyone have the same problem? any ideas?
>>
>> (using Qgis 3.8.3, sklearn 0.21.3, python 3.7.4 and Archlinux)
>>
>> Xavier
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> --
>
> *Akbar Gumbira *
> *www.akbargumbira.com <http://www.akbargumbira.com>*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20191025/3c4fa745/attachment-0001.html>


More information about the QGIS-Developer mailing list