meco-group / omg-tools

Optimal Motion Generation-tools: motion planning made easy
GNU Lesser General Public License v3.0
565 stars 98 forks source link

First installation problems #75

Closed keivanzavari closed 5 years ago

keivanzavari commented 5 years ago

Hi, I am trying to run omg-tools but I haven't had much luck. I think this repo can benefit from a better installation guide. I am happy to make one once I am able to run omg-tools. So far, these are the problems:

Dependency

python-tk is also a dependency. Otherwise loading omg-tools module gives an error of Tkinter.

Docker image is not working

It gives the same Tkinter error. Here you see the error:

docker run -it tmercy/omg-tools:firsttry
Building nlp ...  in 0.072868 s

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

----|------------|------------
 It |      t upd |       time 
----|------------|------------
  1 | 5.4448e-02 | 0.0000e+00 
Traceback (most recent call last):
  File "p2p_holonomic.py", line 51, in <module>
    simulator.run()
  File "/usr/local/lib/python2.7/site-packages/omgtools/execution/simulator.py", line 43, in run
    stop = self.update()
  File "/usr/local/lib/python2.7/site-packages/omgtools/execution/simulator.py", line 96, in update
    self.problem.simulate(self.current_time, self.update_time, self.sample_time)
  File "/usr/local/lib/python2.7/site-packages/omgtools/problems/point2point.py", line 244, in simulate
    Problem.simulate(self, current_time, simulation_time, sample_time)
  File "/usr/local/lib/python2.7/site-packages/omgtools/problems/problem.py", line 186, in simulate
    vehicle.simulate(simulation_time, sample_time)
  File "/usr/local/lib/python2.7/site-packages/omgtools/vehicles/vehicle.py", line 395, in simulate
    self.update_plots()
  File "/usr/local/lib/python2.7/site-packages/omgtools/execution/plotlayer.py", line 249, in update_plots
    self._init_plot(plot)
  File "/usr/local/lib/python2.7/site-packages/omgtools/execution/plotlayer.py", line 224, in _init_plot
    figure = plt.figure()
  File "/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 533, in figure
    **kwargs)
  File "/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/usr/local/lib/python2.7/site-packages/matplotlib/backends/_backend_tk.py", line 1046, in new_figure_manager_given_figure
    window = Tk.Tk(className="matplotlib")
  File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 1819, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":99"

custom docker image

I created my own docker image as a workaround and installed omg-tools (which pulls Casadi) and ipopt. But then Casadi complains about Ipopt installation. Installation of ipopt can also be tricky, and I expected casadi to come with some explanation there. This is the script that install ipopt:

mkdir -p /tmp/ipopt
cd /tmp/ipopt
cp -u /app/Ipopt-3.12.13.tar.gz .
tar -xvf Ipopt-3.12.13.tar.gz
export IPOPTDIR=/tmp/ipopt/Ipopt-3.12.13
cd $IPOPTDIR
mkdir -p build
cd $IPOPTDIR/build
../configure --prefix=/opt/ipopt
make clean
make
make install
echo "/opt/ipopt/lib" > /etc/ld.so.conf.d/ipopt.conf; ldconfig;
echo 'export IPOPTPATH="/opt/ipopt"' >> /etc/zsh/zshrc
echo 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$IPOPTPATH/lib/pkgconfig' >> /etc/zsh/zshrc
echo 'export PATH=$PATH:$IPOPTPATH/bin' >> /etc/zsh/zshrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPTPATH/lib' >> /etc/zsh/zshrc
source /etc/zsh/zshrc
cd /tmp
rm -rf ipopt
cd /app

inside the zipped Ipopt source, I have already included its dependencies like Blas. Inside the docker container however I still cannot run any of the examples. This time with Casadi error:

CasADi warning: "The assertion "handle!=0" on line 274 of file "/home/travis/build/casadi/binaries/casadi/casadi/core/function/plugin_interface.hpp" failed. 
PluginInterface::load_plugin: Cannot load shared library 'libcasadi_nlpsol_ipopt.so': 
   (
    Searched directories: 1. casadipath from GlobalOptions
                          2. CASADIPATH env var
                          3. PATH env var (Windows)
                          4. LD_LIBRARY_PATH env var (Linux)
                          5. DYLD_LIBRARY_PATH env var (osx)
    A library may be 'not found' even if the file exists:
          * library is not compatible (different compiler/bitness)
          * the dependencies are not found
   )
  Tried '/usr/local/lib/python2.7/dist-packages/casadi' :
    Error code: libgfortran.so.3: cannot open shared object file: No such file or directory
  Tried '' :
    Error code: libgfortran.so.3: cannot open shared object file: No such file or directory
  Tried '.' :
    Error code: ./libcasadi_nlpsol_ipopt.so: cannot open shared object file: No such file or directory
" issued  on line 137 of file "/home/travis/build/casadi/binaries/casadi/casadi/core/function/plugin_interface.hpp". 

...

RuntimeError:  on line 369 of file "/home/travis/build/casadi/binaries/casadi/casadi/core/function/plugin_interface.hpp"
Plugin 'ipopt' is not found.

LD_LIBRARY_PATH and PATH are already pointing to ipopt installation. Although the path /home/travis/build/... is rather strange to see inside docker container.

Conclusion

It seems that the docker image provided by @timmercy doesn't have Ipopt issue but suffers from python-tk. Maybe sharing your Dockerfile would solve the issue here.

jgillis commented 5 years ago

Casadi dev here. Concerning the custom docker image, libgfortran needs to be installed (via apt). I'm confused how ipopt bundled with casadi is failing for you. What is the error?

Unrelated, lack of Dockerfile shouldn't prevent you from creating a derived docker layer that just pulls python-tk...

keivanzavari commented 5 years ago

Hi Joris,

I install omg-tools via pip install. That's why I don't expect to see an error with Casadi. I have posted the error up here... I have installed gfortran.

I did pull from tmercy/omg-tools:firsttry and installed python-tk over it. That's OK. But I would like to have my own Docker script.

jgillis commented 5 years ago

It's libgfortran that is needed. This missing pip dependency was fixed in casadi 3.4, but omgtools is based on 3.3

keivanzavari commented 5 years ago

You're right. For future reference, it's libgfortran3 that is needed. If you like I can add the Dockerfile.