twitchslam icon indicating copy to clipboard operation
twitchslam copied to clipboard

how to import the lib

Open masterchop opened this issue 5 years ago • 7 comments

How to import the .so libraries?

masterchop avatar Jul 24 '19 05:07 masterchop

i compile pingolin but the same thing happen: Traceback (most recent call last): File "fakeslam.py", line 13, in from slam import SLAM File "/home/chop/Scripts/SLAM/twitchslam/slam.py", line 10, in from display import Display2D, Display3D File "/home/chop/Scripts/SLAM/twitchslam/display.py", line 26, in import pangolin ImportError: No module named 'pangolin'

masterchop avatar Jul 24 '19 05:07 masterchop

How to import the .so libraries?

You will find them on build websites.

i compile pingolin but the same thing happen: Traceback (most recent call last): File "fakeslam.py", line 13, in from slam import SLAM File "/home/chop/Scripts/SLAM/twitchslam/slam.py", line 10, in from display import Display2D, Display3D File "/home/chop/Scripts/SLAM/twitchslam/display.py", line 26, in import pangolin ImportError: No module named 'pangolin'

!pip install --upgrade pangolin worked ?

ucalyptus avatar Jan 07 '20 10:01 ucalyptus

from frame import Frame, match_frames

I guess you have to manually build and install the package pangolin

Try doing

git clone https://github.com/uoip/pangolin.git cd pangolin mkdir build cd build cmake .. make -j8 cd .. python setup.py install

Make sure you have the dependencies installed beforehand which are PyOpenGL and Numpy

worthless443 avatar Mar 05 '20 11:03 worthless443

This is how I got it to work for python3.8 on OSX Catalina. From my understanding, the Pangolin that's included is for Python 3.6.

sudo python -mpip install numpy pyopengl Pillow pybind11 git clone https://github.com/stevenlovegrove/Pangolin.git cd Pangolin git submodule init && git submodule update mkdir build cd build cmake .. -DPYTHON_LIBRARIES=/usr/local/bin/python3 -DBUILD_SHARED_LIBS=OFF cmake --build .

Then copy this back into the lib/macosx folder. You also need to change all the imports of pangolin to pypangolin

i.e. import pypangolin as pangolin to work with existing code.

zanussbaum avatar Sep 01 '20 04:09 zanussbaum

This is how I got it to work for python3.8 on OSX Catalina. From my understanding, the Pangolin that's included is for Python 3.6.

sudo python -mpip install numpy pyopengl Pillow pybind11 git clone https://github.com/stevenlovegrove/Pangolin.git cd Pangolin git submodule init && git submodule update mkdir build cd build cmake .. -DPYTHON_LIBRARIES=/usr/local/bin/python3 -DBUILD_SHARED_LIBS=OFF cmake --build .

Then copy this back into the lib/macosx folder. You also need to change all the imports of pangolin to pypangolin

i.e. import pypangolin as pangolin to work with existing code.

But if I import pangolin this way, DrawCameras() does not work because it is not implemented in the original repo.

kir486680 avatar Dec 21 '20 10:12 kir486680

should be the same fix as in https://github.com/geohot/twitchslam/issues/11

chbGSmCm avatar Feb 23 '21 22:02 chbGSmCm

When you do sys.path.append, you cannot do relative paths. it must be the full path of the folder linux or macos. This is how I did it.

#! /usr/bin/env python3.6

import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(path + "/lib/linux")
import pangolin
import g2o

I struggled with this for days!

exellentcoin26 avatar May 25 '21 19:05 exellentcoin26