pythonimporterrorquadprog

Import Error undefined symbol: _Z7qpgen2_PdS_PiS0_S_S_S_S_S_S0_S0_S0_S0_S0_S0_S_S0_


I am running this repo: https://github.com/TUMFTM/global_racetrajectory_optimization on a WSL (alternatively I have tried it on multiple different machines like several Linux machines as well as an NVIDIA Jetson Orin Nano devkit).

But somehow, as I try to run the main script I am receiving an import error like below:

Traceback (most recent call last):
  File "main_globaltraj.py", line 1, in <module>
    import opt_mintime_traj
  File "/home/user/Raceline-Optimization/opt_mintime_traj/__init__.py", line 1, in <module>
    import opt_mintime_traj.src
  File "/home/user/Raceline-Optimization/opt_mintime_traj/src/__init__.py", line 1, in <module>
    import opt_mintime_traj.src.opt_mintime
  File "/home/user/Raceline-Optimization/opt_mintime_traj/src/opt_mintime.py", line 7, in <module>
    import trajectory_planning_helpers as tph
  File "/home/user/.local/lib/python3.7/site-packages/trajectory_planning_helpers/__init__.py", line 23, in <module>
    import trajectory_planning_helpers.opt_min_curv
  File "/home/user/.local/lib/python3.7/site-packages/trajectory_planning_helpers/opt_min_curv.py", line 3, in <module>
    import quadprog
ImportError: /home/user/.local/lib/python3.7/site-packages/quadprog.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _Z7qpgen2_PdS_PiS0_S_S_S_S_S_S0_S0_S0_S0_S0_S0_S_S0_

I followed all the steps as required, and the required packages I have, the environment I run the code on are the same as what's described inthe README and requirements.txt. I have tried different versions of required packages (e.g. most up-to-date ones, previous ones etc.), but that didn't solve the problem either. I tried isolating my environment by using Docker, Conda and python's venv. Clearly, there's a compatibility issue and I am unable to resolve it myself. I would highly appreciate it if someone could help me. Thanks!


Solution

  • All the packages and environment I was able to run the code on. So, I was able to resolve the issue by setting my environment in this random way (see the screenshot above in the hyperlink). Somehow, this combination worked out just well. I also realized that the quadprog repo doesn't really have 0.1.7 on their github page even though I was able to install the prebuilt one using pip. So I downloaded the quadprog with a specific tag 0.1.8 (oldest) and installed it from source; magically it worked unlike my previous tries. But it kept giving me the import error, so I pip installed the most recent quadprog. I also manually changed requirements.txt to address all this change (e.g., edited quadprog==0.1.7 as quadprog>=0.1.7 and so on).