dswah / pyGAM

[HELP REQUESTED] Generalized Additive Models in Python
https://pygam.readthedocs.io
Apache License 2.0
876 stars 160 forks source link

ValueError: cannot set WRITEABLE flag to True of this array #337

Open MMCMA opened 1 year ago

MMCMA commented 1 year ago

After installing sciki-sparse I get the following error when fitting a LinearGAM with pygam. Here is the relevant error trace:

  File "/opt/conda/envs/py310/lib/python3.10/site-packages/pygam/pygam.py", line 915, in fit
    self._pirls(X, y, weights)
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/pygam/pygam.py", line 753, in _pirls
    E = self._cholesky(S + P, sparse=False, verbose=self.verbose)
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/pygam/pygam.py", line 520, in _cholesky
    L = cholesky(A, **kwargs)
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/pygam/utils.py", line 59, in cholesky
    P[np.arange(len(p)), p] = 1
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/scipy/sparse/_lil.py", line 331, in __setitem__
    IndexMixin.__setitem__(self, key, x)
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/scipy/sparse/_index.py", line 118, in __setitem__
    i, j = _broadcast_arrays(row, col)
  File "/opt/conda/envs/py310/lib/python3.10/site-packages/scipy/sparse/_index.py", line 24, in _broadcast_arrays
    y.flags.writeable = b.flags.writeable
ValueError: cannot set WRITEABLE flag to True of this array

I use the following versions: pygam : 0.9.0

chenyangkang commented 6 months ago

I got the same issue

chenyangkang commented 6 months ago

conda uninstall scikit-sparse works