krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
377 stars 96 forks source link

Segmentation fault when importing Klampt installed from PyPi on Python 3.10 #152

Closed smeng9 closed 12 months ago

smeng9 commented 2 years ago

Hi Professor, we tried to upgrade our Python version from 3.9 to 3.10 recently and we encountered a segmentation fault issue on Python 3.10, but not on 3.9

Steps to reproduce:

$ docker run -it python:3.9 bash # pip install klampt # apt update # apt install libglu1-mesa-dev # python -c "import klampt"

When changing the above image from python:3.9 to python:3.10, it throws segmentation fault issue. The same segmentation fault happens on Python 3.10 with Ubuntu 22.04.

GDB trace:

(gdb) run
Starting program: /usr/bin/python3 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import klampt

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff383efd2 in __glDispatchInit ()
   from /home/motion/.local/lib/python3.10/site-packages/klampt/../Klampt.libs/libGLdispatch-dcc1ca97.so.0.0.0
#2  0x00007ffff5a3f74f in ?? () from /lib/x86_64-linux-gnu/libGLX.so.0
#3  0x00007ffff7fc947e in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe148, env=env@entry=0x7fffffffe158)
    at ./elf/dl-init.c:70
#4  0x00007ffff7fc9568 in call_init (env=0x7fffffffe158, argv=0x7fffffffe148, argc=1, l=<optimized out>) at ./elf/dl-init.c:33
#5  _dl_init (main_map=0x555555c8dab0, argc=1, argv=0x7fffffffe148, env=0x7fffffffe158) at ./elf/dl-init.c:117
#6  0x00007ffff7dc2c85 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:182
#7  0x00007ffff7fd0ff6 in dl_open_worker (a=0x7fffffffa4f0) at ./elf/dl-open.c:808
#8  dl_open_worker (a=a@entry=0x7fffffffa4f0) at ./elf/dl-open.c:771
#9  0x00007ffff7dc2c28 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:208
#10 0x00007ffff7fd134e in _dl_open (file=<optimized out>, mode=-2147483646, caller_dlopen=0x5555557b873f, nsid=-2, argc=1, 
    argv=<optimized out>, env=0x7fffffffe158) at ./elf/dl-open.c:883
#11 0x00007ffff7cde6bc in dlopen_doit (a=a@entry=0x7fffffffa760) at ./dlfcn/dlopen.c:56
#12 0x00007ffff7dc2c28 in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffa6c0, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:208
#13 0x00007ffff7dc2cf3 in __GI__dl_catch_error (objname=0x7fffffffa718, errstring=0x7fffffffa720, mallocedp=0x7fffffffa717, 
    operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#14 0x00007ffff7cde1ae in _dlerror_run (operate=operate@entry=0x7ffff7cde660 <dlopen_doit>, args=args@entry=0x7fffffffa760)
    at ./dlfcn/dlerror.c:138
#15 0x00007ffff7cde748 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>)
    at ./dlfcn/dlopen.c:71
#16 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#17 0x00005555557b873f in ?? ()
#18 0x00005555557b6c37 in ?? ()
#19 0x00005555556b0219 in ?? ()
--Type <RET> for more, q to quit, c to continue without paging--Quit
smeng9 commented 2 years ago

Screenshot from 2022-09-10 21-19-57

Hi Professor @krishauser

After I compared with my colleague computer for the same Klampt setup, I discovered there are two version of Klampt 0.9.0 published for Python 3.10. One for manylinux2014 published on Feb 7, another for manylinux2010 published on Jan 19. Apparently my colleague installed during Jan 19 - Feb 7 period so he got a working copy.

Is it possible to unpublish the problematic Python 3 version for manylinux2014 so we can use pip to install it without a problem?

robodreamer commented 1 year ago

Hi Kris, I was trying out the latest version on my Ubuntu 22.04 machine with Python 3.10 and I encounter the same issue here. Would you be able to follow up on this?

smeng9 commented 1 year ago

As a temporary solution, download and install the whl file directly.


From: Andy Park @.> Sent: Monday, July 10, 2023 3:16 PM To: krishauser/Klampt @.> Cc: Meng, Shaoyu @.>; Author @.> Subject: Re: [krishauser/Klampt] Segmentation fault when importing Klampt installed from PyPi on Python 3.10 (Issue #152)

Hi Kris, I was trying out the latest version on my Ubuntu 22.04 machine with Python 3.10 and I encounter the same issue here, and asking for help.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/krishauser/Klampt/issues/152*issuecomment-1629670197__;Iw!!DZ3fjg!9acS06GQaTWL3DpkF2McUuD6xB1Oo8bXr6sSHwEvzyTiHhSjeUVfru90m00vxCvb3iW87FANmDHRTn7qiWnS85dGOIg$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJHAEC2ZWS5MVIBS35YXWKLXPRPKVANCNFSM6AAAAAAQIEV4FM__;!!DZ3fjg!9acS06GQaTWL3DpkF2McUuD6xB1Oo8bXr6sSHwEvzyTiHhSjeUVfru90m00vxCvb3iW87FANmDHRTn7qiWnSPdBFzbY$. You are receiving this because you authored the thread.Message ID: @.***>

joaomcm commented 1 year ago

I was able to reproduce the problem on an Ubuntu 22.04 fresh install - both from pip install and from source - currently looking more deeply into this.

@robodreamer,

As suggested by @smeng9, manually installing the manylinux 2010 wheel from here (https://pypi.org/project/Klampt/0.9.0/#files, i.e. , this one https://files.pythonhosted.org/packages/bf/2e/83a1d9b4d843979ea76ba2e5e81ef3f7712bb900762cd8c196e280ebf3df/Klampt-0.9.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl ) seems to solve the import problem. It should work while we address the bigger issue. Another alternative for now is to work on a python 3.9 virtual environment, as I can verify that pip installing klampt on a anaconda env with python 3.9 works as intended.

I'll let you know if I find what went wrong with the manylinux2014 wheel.

smeng9 commented 1 year ago

Hi Joao, did you eventually find what is going wrong with the manylinux2014 or you just used the bypass method?

krishauser commented 1 year ago

We haven’t gotten around to this. This will require some deep debugging of how the compile options in pip have changed. Hopefully we’ll have more time after the 15th.

krishauser commented 12 months ago

Resolved in version 0.9.1.