Installing PyIpopt

Dear,

I’m trying to install PyIpopt to run Ipopt’s dependencies within Dolfin Adjoint. I’m using Mac Os.

After everything is installed, and using a Jupyter Notebook, I try to test the file hs071.py on the page https://github.com/xuy/pyipopt/tree/master/examples.

I import the modules below separately and everything works:

import pyipopt
from numpy import *

Then when I run the rest of the code in another cell, the following error appears:

File “/Users/userxyz/my-project/hs071.py”, line 90, in
nlp = pyipopt.create (nvar, x_L, x_U, ncon, g_L, g_U, nnzj, nnzh, eval_f, eval_grad_f, eval_g, eval_jac_g)

AttributeError: module ‘pyipopt’ has no attribute ‘create’

Can anybody help me?

Dolfin-adjoint does no longer use pyipopt, it uses IPOPT from pypi. Please consider switching to this dependency, see: https://github.com/matthias-k/cyipopt

Dear Docker,

Thank you very much for your return.

However, when I use some code that uses the IPOPTSolver function, that function calls code from the pyadjoint / optimization / ipopt_solver.py folder and generates the following error:

File “/Users/userxyz/opt/anaconda3/envs/fenicsproject/lib/python3.8/site-packages/pyadjoint/optimization/ipopt_solver.py”, line 27, in __build_pyipopt_problem
import pyipopt
ModuleNotFoundError: No module named ‘pyipopt’

How to change to cyipopt?

You are using an outdated version of pyadjoint. The current version uses another version (introduced in this commit, as can be seen in the master branch files

Dear Dokken,

Thank you! Everything worked!