Open jacarvalho opened 1 year ago
I've been dealing with the same issue, I found that gtsam and gpmp2 had actually been installed to my core python (/bin/python3) rather than my virtual environment's python. Like I found them installed in /usr/local/lib/python3.8/dist-packages/. When I tried to run the example using the python interpreter outside of my virtual environment that error went away.
Thanks. That works partially since now I'm getting a Segmentation Fault error.
For reference, running
cd PATH_TO_GPMP2
cd ./python/examples
python pointRobot2FactorExample.py
produces
[0. 0.]
[0.85 0.7 ]
[1.7 1.4]
[2.55 2.1 ]
[3.4 2.8]
[4.25 3.5 ]
[5.1 4.2]
[5.95 4.9 ]
[6.8 5.6]
[7.65 6.3 ]
[8.5 7. ]
[9.35 7.7 ]
[10.2 8.4]
[11.05 9.1 ]
[11.9 9.8]
[12.75 10.5 ]
[13.6 11.2]
[14.45 11.9 ]
[15.3 12.6]
[16.15 13.3 ]
[17. 14.]
Segmentation fault (core dumped)
To debug, I did
gdb python
run pointRobot2FactorExample.py
And get
Starting program: /usr/bin/python pointRobot2FactorExample.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 180794]
[New Thread 0x7ffff3dc8700 (LWP 180795)]
[New Thread 0x7ffff35c7700 (LWP 180796)]
[New Thread 0x7ffff0dc6700 (LWP 180797)]
[New Thread 0x7fffee5c5700 (LWP 180798)]
[New Thread 0x7fffebdc4700 (LWP 180799)]
[New Thread 0x7fffe95c3700 (LWP 180800)]
[New Thread 0x7fffe4dc2700 (LWP 180801)]
[New Thread 0x7fffe45c1700 (LWP 180802)]
[New Thread 0x7fffdfdc0700 (LWP 180803)]
[New Thread 0x7fffdd5bf700 (LWP 180804)]
[New Thread 0x7fffdcdbe700 (LWP 180805)]
[New Thread 0x7fffd85bd700 (LWP 180806)]
[New Thread 0x7fffd5dbc700 (LWP 180807)]
[New Thread 0x7fffd35bb700 (LWP 180808)]
[New Thread 0x7fffd2dba700 (LWP 180809)]
[New Thread 0x7fffce5b9700 (LWP 180810)]
[New Thread 0x7fffcddb8700 (LWP 180811)]
[New Thread 0x7fffc95b7700 (LWP 180812)]
[New Thread 0x7fffc8db6700 (LWP 180813)]
[New Thread 0x7fffc65b5700 (LWP 180814)]
[New Thread 0x7fffc1db4700 (LWP 180815)]
[New Thread 0x7fffbf5b3700 (LWP 180816)]
[New Thread 0x7fffbcdb2700 (LWP 180817)]
[New Thread 0x7fffb42ab700 (LWP 180818)]
[New Thread 0x7fffb3aaa700 (LWP 180819)]
[New Thread 0x7fffb12a9700 (LWP 180820)]
[New Thread 0x7fffaeaa8700 (LWP 180821)]
[New Thread 0x7fffac2a7700 (LWP 180822)]
[New Thread 0x7fffa9aa6700 (LWP 180823)]
[New Thread 0x7fffa72a5700 (LWP 180824)]
[New Thread 0x7fffa4aa4700 (LWP 180825)]
[New Thread 0x7fffa02a3700 (LWP 180826)]
[New Thread 0x7fff9daa2700 (LWP 180827)]
[New Thread 0x7fff9b2a1700 (LWP 180828)]
[New Thread 0x7fff9aaa0700 (LWP 180829)]
[New Thread 0x7fff9629f700 (LWP 180830)]
[New Thread 0x7fff93a9e700 (LWP 180831)]
[New Thread 0x7fff9129d700 (LWP 180832)]
[New Thread 0x7fff90a9c700 (LWP 180833)]
[New Thread 0x7fff8c29b700 (LWP 180834)]
[New Thread 0x7fff8ba9a700 (LWP 180835)]
[New Thread 0x7fff87299700 (LWP 180836)]
[New Thread 0x7fff86a98700 (LWP 180837)]
[New Thread 0x7fff82297700 (LWP 180838)]
[New Thread 0x7fff7fa96700 (LWP 180839)]
[New Thread 0x7fff7f295700 (LWP 180840)]
[0. 0.]
[0.85 0.7 ]
[1.7 1.4]
[2.55 2.1 ]
[3.4 2.8]
[4.25 3.5 ]
[5.1 4.2]
[5.95 4.9 ]
[6.8 5.6]
[7.65 6.3 ]
[8.5 7. ]
[9.35 7.7 ]
[10.2 8.4]
[11.05 9.1 ]
[11.9 9.8]
[12.75 10.5 ]
[13.6 11.2]
[14.45 11.9 ]
[15.3 12.6]
[16.15 13.3 ]
[17. 14.]
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007fffb9791e26 in __dynamic_cast () from /lib/x86_64-linux-gnu/libstdc++.so.6
That's interesting I was also getting a Segmentation Fault error. For some reason this error went away when I installed in a fresh installation of Ubuntu 20.04 in a virtual box virtual machine on a Mac. I'm going to try setting up a fresh desktop Ubuntu environment to see if the segmentation fault goes away.
@jacarvalho for a simple debugging test, can you enter the python environment with something like ipython
and simply try and import the module:
import gpmp2
@mattking-smith Importing gpmp2 works without an error, either with the created conda environment or with the system python interpreter.
@mattking-smith Importing gpmp2 works without an error, either with the created co
Well this would imply that python-wrapped GPMP2
library is correctly installed on your setup. @jacarvalho are any of the examples in python working for you at this point?
Yes, I'm able to run the example, but now I'm getting a segmentation fault error, as I indicated in this comment - https://github.com/borglab/gpmp2/issues/18#issuecomment-1537878062
I can try to install it on another PC (or virtual machine) and report it back.
@mattking-smith Hi, mattking! Could you tell me where to find the c++ example about how to use gpmp2? cause I only find the python and matlab example. But I try to use gpmp2 in cpp.
@CodingCatMountain this question in this issue is not really appropriate in this issue, given that this is an issue in about python examples... but c++ examples are best seen in the test folders of the gpmp2 c++ files.
@jacarvalho Since you have no reported back on the success or failure of this issue, I will close it soon....
@mattking-smith Sorry for not answering back. I've set up a virtual machine with Ubuntu 20.04 and for the installation run the following commands.
sudo apt-get install cmake
sudo apt-get install libboost-all-dev
sudo apt install python-is-python3
sudo apt install python3-pip
sudo apt install git
git clone https://github.com/borglab/gtsam.git
cd gtsam
mkdir build && cd build
cmake -DGTSAM_ALLOW_DEPRECATED_SINCE_V42:=OFF ..
make -j4 check
sudo make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/share:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc
pip install cython numpy scipy matplotlib
git clone https://github.com/borglab/wrap.git
mkdir build && cd build
cmake ..
**sudo** make install
git clone https://github.com/borglab/gpmp2.git
cd gpmp2 && mkdir build && cd build
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX:=ON ..
make -j8
**sudo** make python-install
Importing gpmp2 works
python
import gpmp2
But, running the examples I still get a segmentation fault error.
cd python/examples
python Arm2FactorGraphExample.py
leads to
Segmentation fault (core dumped).
Inspecting it with GDB
gdb python
run Arm2FactorGraphExample.py
leads to
(gdb) run Arm2FactorGraphExample.py
Starting program: /usr/bin/python Arm2FactorGraphExample.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 27136]
[New Thread 0x7fffea31b700 (LWP 27137)]
[New Thread 0x7fffe9b1a700 (LWP 27138)]
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007ffff296fe26 in __dynamic_cast () from /lib/x86_64-linux-gnu/libstdc++.so.6
Even though I showed only the Arm2FactorGraphExample.py example, all other examples also lead to a segmentation fault error.
In summary, I still get the same issue as in my original system.
@jacarvalho @mattking-smith Hi, jacarvalho, mattking. Did you solve this issue? Actually, I have addressed this problem. I leave this comment in order to help other guys who meet this problem. I believe this issue comes from we installed GPMP2
and GTSAM
wrongly. In short, We should try to install GTSAM
in python3 following with this ReadMe
Note: Following the link to install GTSAM, we just install GTSAM in Python3. Therefore, we should install GTSAM with CMake following with the ReadMe in this repo.
I have writen a Chinese blog for installing GPMP2
in Ubuntu20.04.
I hope I can help to address this problem.
Hey @CodingCatMountain, thanks for posting these instructions. I followed everything in your blog, but I'm running into an issue.
In point 3. Download GPMP2 and install it
, after running sudo make install
, if I run
python3
import gtsam
I get the error
ImportError: /home/carvalho/.local/lib/python3.8/site-packages/gtsam/gtsam.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK5gtsam15NonlinearFactor5rekeyERKSt6vectorImSaImEE
This error does appear before the line sudo make install
. Did this error not appear to you?
@jacarvalho Hi. I have forgotten whether I have encountered this problem or not. I wander that is the GTSAM you installed lasted time have not been uninstalled successfully. So I will recommend you re-install the GTSAM again after uninstalling it with this command cd /to_the_path_of_gtsam_you_have_installed/build; xargs rm -rf < install_manifest.txt
I hope you can address this problem because I know the mood when we cannot install the package that we are very interested with. So, Good Luck! :)
@jacarvalho Try to uninstall GTSAM and install GTSAM-python first, then install GTSAM again. : )
Here's what worked for me installing from scratch in a virtual machine with Ubuntu 20.04. Following these instructions I could run the python examples.
@mattking-smith I think we can close this issue.
sudo apt install build-essential git vim
sudo apt install python-is-python3
sudo apt install python3-pip
pip install matplotlib
pip install scipy
cd ~
git clone https://github.com/borglab/gtsam.git
cd gtsam
mkdir build
cd build
cmake .. -DGTSAM_BUILD_PYTHON=1 -DGTSAM_PYTHON_VERSION=3.8.10 -DGTSAM_WITH_TBB=OFF
make
make python-install
cd ~
cd gstam
cd build
cmake -DGTSAM_ALLOW_DEPRECATED_SINCE_V42:=OFF ..
make -j 32 check
sudo make install
cd ~
echo 'export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/share:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc
cd ~
git clone https://github.com/borglab/gpmp2.git
cd gpmp2
mkdir build
cd build
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX:=ON ..
make -j 32
make python-install
cd ~
cd gpmp2/python/examples
python Arm2FactorGraphExample.py
I'm able to install gtsam and gpmp2 as in the README instructions, and able to import gpmp2 with
However, I get an import error when I try to run the examples. I run
and obtain the error
Do you also get this error?