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

ImportError: cannot import name 'sa' from 'simulated_annealing' #57

Open
revquiet opened this issue Dec 13, 2024 · 2 comments
Open

ImportError: cannot import name 'sa' from 'simulated_annealing' #57

revquiet opened this issue Dec 13, 2024 · 2 comments

Comments

@revquiet
Copy link

revquiet commented Dec 13, 2024

I encountered an issue when trying to import sa from the simulated_annealing module in tools/sysid/sysid.py. The import statement fails so i installed the module using pip:

pip install simulated-annealing

the following error arises:

cannot import name 'sa' from 'simulated_annealing' (/home/test/miniconda3/envs/simpler_env/lib/python3.10/site-packages/simulated_annealing/__init__.py) 
  File "/home/test/Code/git_repo/SimplerEnv/tools/sysid/sysid.py", line 11, in <module>
    from simulated_annealing import sa
ImportError: cannot import name 'sa' from 'simulated_annealing' (/home/test/miniconda3/envs/simpler_env/lib/python3.10/site-packages/simulated_annealing/__init__.py)

I am using version 0.4.0 of simulated-annealing, Upon inspecting the init.py file in the installed module directory, I noticed there is no reference to sa, nor any indication of its availability. If sa is not part of the package, it would be very helpful if the documentation could clarify its usage or provide a module of sa to guide me on how to achieve similar functionality.

Thank you for your help and guidance!

@revquiet
Copy link
Author

revquiet commented Dec 13, 2024

When I modified the code as follows:

import simulated_annealing as sa

I encountered an error indicating that the sa module does not have the minimize() method. How can I correctly import this module and perform the corresponding system identification?

Screenshot from 2024-12-13 17-41-10

Could you please advise on the appropriate steps to resolve this issue?

@xuanlinli17
Copy link
Collaborator

xuanlinli17 commented Dec 13, 2024

Did you pip install git+https://github.com/nathanrooy/simulated-annealing, not pip install simulated-annealing?

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

2 participants