Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'cvxpy.reductions.dcp2cone.atom_canonicalizers' #22

Closed
debackerl opened this issue Jan 19, 2024 · 4 comments
Closed

No module named 'cvxpy.reductions.dcp2cone.atom_canonicalizers' #22

debackerl opened this issue Jan 19, 2024 · 4 comments

Comments

@debackerl
Copy link

Hello,

Using both cvxpy-1.4.1 and cvxpy-1.4.2, trying to import dsp, I get this error:

File [~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/__init__.py:1](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/__init__.py:1)
----> [1](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/__init__.py:1) from dsp.cvxpy_integration import add_is_dsp, extend_cone_canon_methods
      [2](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/__init__.py:2) from dsp.local import LocalVariable
      [3](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/__init__.py:3) from dsp.problem import MinimizeMaximize, SaddlePointProblem, is_dsp

File [~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:2](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:2)
      [1](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:1) from cvxpy import Expression, Problem
----> [2](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:2) from cvxpy.reductions.dcp2cone.atom_canonicalizers import CANON_METHODS
      [4](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:4) from dsp.problem import is_dsp
      [5](https://vscode-remote+ssh-002dremote-002blaurent-002dworkstation-002elan-002eetive-002ecom.vscode-resource.vscode-cdn.net/home/laurent/code/market-downloader/~/mambaforge/envs/torch2/lib/python3.11/site-packages/dsp/cvxpy_integration.py:5) from dsp.saddle_extremum import conjugate, saddle_max, saddle_min

ModuleNotFoundError: No module named 'cvxpy.reductions.dcp2cone.atom_canonicalizers'

Looking at the code of CVXPY 1.3.2, I can indeed see the required symbol: https://github.com/cvxpy/cvxpy/blob/v1.3.2/cvxpy/reductions/dcp2cone/atom_canonicalizers/__init__.py

However, CVXPY 1.4.0, renamed it as https://github.com/cvxpy/cvxpy/blob/v1.4.0/cvxpy/reductions/dcp2cone/canonicalizers/__init__.py

@tonyjohnhhhh
Copy link

I think you'd better use cvxpy-1.3. Because I encountered this problem one month later. Although it seems that the writer had said that they solved this problem.
In cvxpy_integration.py. they tried to use this block so solve the problem
try:
from cvxpy.reductions.dcp2cone.canonicalizers import CANON_METHODS
except ModuleNotFoundError:
from cvxpy.reductions.dcp2cone.atom_canonicalizers import CANON_METHODS
I thought it is the right solution, but it did not work.

@phschiele
Copy link
Collaborator

Hi @debackerl @tonyjohnhhhh!
Thanks so much for raising this issue. We just released a new version to PyPI: https://pypi.org/project/dsp-cvxpy/
Can you try running pip install -U dsp-cvxpy to upgrade to version 0.2.0 and see if this fixes the issue?
Happy to answer other questions about the package!

@tonyjohnhhhh
Copy link

I think this new one works well! I am now using the cvxpy 1.4.2 and dsp-cvxpy 0.2.0, and it seems everything is fine. Thanks for your help!

@phschiele
Copy link
Collaborator

Great, closing this issue, feel free to open a new one if something comes up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants