libipopt.so.1 cannot be found while importing cyipopt.
Can be tested using poisson-topology.py, which throws an error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/ipopt.py", line 11, in <module>
import cyipopt # noqa: F401
ImportError: libipopt.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/project/box/box.py", line 132, in <module>
solver = IPOPTSolver(problem, parameters=parameters)
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/optimization/ipopt_solver.py", line 31, in __init__
self.__build_ipopt_problem()
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/optimization/ipopt_solver.py", line 37, in __build_ipopt_problem
from pyadjoint.ipopt import cyipopt
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/ipopt.py", line 13, in <module>
raise ImportError("You need to install cyipopt. It is recommended to install IPOPT with HSL support!")
ImportError: You need to install cyipopt. It is recommended to install IPOPT with HSL support!
Docker command used:
docker run -ti -v $(pwd):/home/fenics/shared quay.io/dolfinadjoint/pyadjoint:latest
try to change “latest” to “master”:
… quay.io/dolfinadjoint/pyadjoint:master
it is also reproducible on the “master” image
strangely enough, in the master image, importing ipopt in bash:
$ python3 -c "from pyadjoint import ipopt"
gives another error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/ipopt.py", line 11, in <module>
import cyipopt # noqa: F401
ImportError: /usr/local/lib/libipopt.so.1: undefined symbol: MPI_Comm_rank
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/pyadjoint/ipopt.py", line 13, in <module>
raise ImportError("You need to install cyipopt. It is recommended to install IPOPT with HSL support!")
ImportError: You need to install cyipopt. It is recommended to install IPOPT with HSL support!
while giving the same error from the original post when run in PyCharm
see on this page if something can help you:
1 Like
Hi Jafar,
I have the same problem when I install it on Ubuntu or Mac systems. Could you fix it? I’ll appreciate it if you can help me to make Ipopt work.
Thanks,
Milad
As far as I can remember, I ran the commands in the Dockerfile as Rafael_Ferro recommended, and it ended up working.
Although now I use Docker and no longer use a local installation. I recommend doing the same for a quick fix.
Thanks, Jafar for your reply. You mean I follow the following instructions:
run docker run -ti -v $(pwd):/home/fenics/shared Quay
Then in docker file type:USER root
RUN apt-get -qq update &&
apt-get -y install libjsoncpp-dev &&
apt-get -y install python-dev graphviz libgraphviz-dev &&
apt-get clean &&
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN /bin/bash -l -c “pip3 install --no-cache --ignore-installed scipy”
COPY --chown=fenics dolfin-adjoint.conf $FENICS_HOME/dolfin-adjoint.conf
ARG IPOPT_VER=3.12.9
RUN /bin/bash -l -c “source $FENICS_HOME/dolfin-adjoint.conf &&
update_ipopt &&
update_pyipopt”
ARG MOOLA_BRANCH=“master”
RUN /bin/bash -l -c “pip3 install --no-cache git+git://github.com/funsim/moola.git@${MOOLA_BRANCH}”
ARG DOLFIN_ADJOINT_BRANCH=“2019.1.0”
RUN /bin/bash -l -c “pip3 install --no-cache git+https://github.com/dolfin-adjoint/pyadjoint.git@${DOLFIN_ADJOINT_BRANCH}”
USER fenics
COPY --chown=fenics WELCOME $FENICS_HOME/WELCOME
RUN echo “source $FENICS_HOME/dolfin-adjoint.conf” >> $FENICS_HOME/.bash_profile
RUN /bin/bash -l -c “python3 -c “import fenics_adjoint””
RUN /bin/bash -l -c “python3 -c “import dolfin; import pyadjoint.ipopt””
USER root