-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running the python examples. #18
Comments
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
|
@mattking-smith Importing gpmp2 works without an error, either with the created conda environment or with the system python interpreter. |
Well this would imply that python-wrapped |
Yes, I'm able to run the example, but now I'm getting a segmentation fault error, as I indicated in this comment - #18 (comment) 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. 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
Inspecting it with GDB
leads to
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 I have writen a Chinese blog for installing I hope I can help to address this problem. |
Hey @CodingCatMountain, thanks for posting these instructions. In point 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 |
@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 |
@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. @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?
The text was updated successfully, but these errors were encountered: