roipoussiere / cadquery-server

A web server used to render 3d models from CadQuery code loaded dynamically.
MIT License
57 stars 17 forks source link

(In `cadquery/cadquery-server` Docker image): Crash when trying to call `assembly.solve()`: "Plugin 'ipopt' is not found" #69

Open iansan5653 opened 2 years ago

iansan5653 commented 2 years ago

This issue is copied from https://github.com/CadQuery/cadquery/issues/1181. The issue appears not to be specifically with cadquery-server (given that it appears when I run python example.py) but rather with the Docker image itself.


👋 Hello! I'm new to CadQuery and still learning, so it's very possible this is due to user error and not a bug. I'm assuming I just need to install something, though I am not sure what to install / why it wasn't included in the Docker container I'm using.

I am usually able to build models, sketches, assemblies, etc without any issues. But whenever I try to call solve() on an assembly instance, my part fails.

To Reproduce

It appears that any assembly will trigger this, no matter how complex. Here's a sample:

import cadquery as cq

def cone():
  result: cq.Workplane = cq.Workplane("XY").add(cq.Solid.makeCone(1, 0, 2))
  result.faces("<Z").tag("bottom")
  return result

assy = cq.Assembly()
assy.add(cone(), name="cone1")
assy.add(cone(), name="cone2")

assy.constrain("cone1?bottom", "cone2?bottom", "Point").solve()

Backtrace

CasADi - 2022-10-16 22:45:12 WARNING(".../casadi/core/plugin_interface.hpp:322: Assertion "handle!=nullptr" 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/python3.10/site-packages/casadi' :
    Error code: libgfortran.so.5: cannot open shared object file: No such file or directory
  Tried '' :
    Error code: libgfortran.so.5: 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") [.../casadi/core/plugin_interface.hpp:171]
Traceback (most recent call last):
  File "/workspaces/cadquery-template/box.py", line 41, in <module>
    assy.solve()
  File "/usr/local/lib/python3.10/site-packages/cadquery/assembly.py", line 417, in solve
    locs_new, self._solve_result = solver.solve()
  File "/usr/local/lib/python3.10/site-packages/cadquery/occ_impl/solver.py", line 717, in solve
    sol = opti.solve_limited()
  File "/usr/local/lib/python3.10/site-packages/casadi/casadi.py", line 27621, in solve_limited
    return _casadi.Opti_solve_limited(self, *args)
RuntimeError: Error in Opti::solve [OptiNode] at .../casadi/core/optistack.cpp:167:
.../casadi/core/plugin_interface.hpp:417: Plugin 'ipopt' is not found.

Environment

I am working in an environment built from the cadquery/cadquery-server Docker image. More specifically, I am running CadQuery in a GitHub Codespaces remote environment (created from this template).