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

I cannot import any solver - For example SLSQP or NSGA2. Attribute does not exists #10

Open
tjlca opened this issue Sep 8, 2020 · 4 comments

Comments

@tjlca
Copy link

tjlca commented Sep 8, 2020

from pyOpt import NSGA2
ImportError: cannot import name 'NSGA2' from 'pyOpt' (/Users/tghosh/Downloads/pyOpt-master/pyOpt/__init__.py)

File "<ipython-input-26-0efd7093218e>", line 1, in <module>
from pyOpt import SLSQP
ImportError: cannot import name 'SLSQP' from 'pyOpt' (/Users/tghosh/Downloads/pyOpt-master/pyOpt/__init__.py)
from pyOpt import pySLSQP
This works but object created using pySLSQP does not take an optimization problem as a parameter.


slsqp = pyOpt.pySLSQP
[fstr, xstr, inform] = slsqp(opt_prob,sens_type='FD')

TypeError: 'module' object is not callable

@madebr
Copy link
Owner

madebr commented Sep 9, 2020

pyOpt.pySLSQP is the name of the module.
You want to use pyOpt.SLSQP instead.

Have you built the modules?
You should run python setup.py build_ext prior to using and installing pyOpt.

@TimSuter
Copy link

TimSuter commented Jun 16, 2021

I have a similar issue. I managed to install pyOpt on my system (Ubuntu 20.04, python 3.8.5, gcc9) without errors and I ran python setup.py build_ext as suggested above before installing pyOpt by running python setup.py install.
However when I want to run the example tp037.py I get the following error:

Traceback (most recent call last):
  File "tp037.py", line 98, in <module>
    from pyOpt import ALGENCAN
ImportError: cannot import name 'ALGENCAN' from 'pyOpt' (/home/tim/Downloads/Fit-TDS-master/py3-env/lib/python3.8/site-packages/pyOpt/__init__.py)

Do you have any advice?

@e-dub
Copy link

e-dub commented Jun 24, 2021

Looks like it was not installed correctly. Check for errors on your build.

@zzhya
Copy link

zzhya commented Jun 1, 2024

Did you fix it?

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

5 participants