dolfin-adjoint / pyadjoint

The algorithmic differentation tool pyadjoint and add-ons.
GNU Lesser General Public License v3.0
91 stars 37 forks source link

Import Error in: from pyadjoint import ipopt # noqa: F401 in examples/poisson-topology.py #140

Open MrOpine opened 8 months ago

MrOpine commented 8 months ago

Running demo code poisson-topology.py with VS code in Ubuntu 20.04 system, the following error occurs at from pyadjoint import ipopt # noqa: F401,

Exception has occurred: ImportError You need to install cyipopt. It is recommended to install IPOPT with HSL support! ModuleNotFoundError: No module named 'cyipopt'

During handling of the above exception, another exception occurred:

File "/home/***/Documents/Fenics/demo/heat_conduction_TopOpt.py", line 5, in from pyadjoint import ipopt # noqa: F401 ImportError: You need to install cyipopt. It is recommended to install IPOPT with HSL support!

I've tried to install IPOPT and cyipopt packages from Coin-HSL and following the instructions of https://github.com/coin-or/Ipopt and https://github.com/mechmotum/cyipopt, not working yet.

BTW, I did not use conda to install the packages. No error is found running python3 -c "import cyipopt" in terminal, but the ipopt source may not be included in the path. An error occurred if I directly run /usr/local/bin/ipopt,

/usr/local/bin/ipopt: error while loading shared libraries: libipoptamplinterface.so.3: cannot open shared object file: No such file or directory

, while it is resolved if I run LD_LIBRARY_PATH=/usr/local/lib first.

Anyone know what going on?

jorgensd commented 8 months ago

I would suggest having a look at the dolfin-adjoint docker file, as it contains the installation instructions we use in our images https://github.com/dolfin-adjoint/dolfin-adjoint/blob/main/docker/Dockerfile#L22