dynamicslab / pysindy

A package for the sparse identification of nonlinear dynamical systems from data
https://pysindy.readthedocs.io/en/latest/
Other
1.36k stars 304 forks source link

[BUG]Cannot use TrappingSR3 #432

Closed SimonYYS closed 7 months ago

SimonYYS commented 7 months ago

TrappingSR3 is not working, even in the example you provided '8_trapping_sindy_paper_examples': https://pysindy.readthedocs.io/en/latest/examples/8_trapping_sindy_paper_examples/example.html

Other optimizers I tried works fine..

Error message:

AttributeError: module 'pysindy' has no attribute 'TrappingSR3'

Python 3.11.5

Jacob-Stevens-Haas commented 7 months ago

Please share pysindy version. Also, based on relevant info, what are your cvxpy, osqp, and scs versions?

SimonYYS commented 7 months ago

Please share pysindy version. Also, based on relevant info, what are your cvxpy, osqp, and scs versions?

Thanks for the reply.

pysindy ver 1.7.5 osqp ver 0.6.3 cvxpy ver 1.4.1 scs ver 3.2.4.post1

Jacob-Stevens-Haas commented 7 months ago

Thanks. Let's get a bit more diagnostic error. Can you try to directly import the trapping_sr3.py module?

import pysindy.optimizers.trapping_sr3
SimonYYS commented 7 months ago

Thanks. Let's get a bit more diagnostic error. Can you try to directly import the trapping_sr3.py module?

import pysindy.optimizers.trapping_sr3

Now it works magically. That's cool.

Jacob-Stevens-Haas commented 7 months ago

Glad to hear. For context pysindy skips importing TrappingSR3 from pysindy/optimizers/trapping_sr3.py if the latter runs into an error importing CVXPY. So it looks like something about your CVXPY install was updated or fixed between your first error and the last attempt.