2

Ubuntu 20.04 LTS Python 3.8 ROS Noetic Desktop Full installed

Confirmed I do have the file /lib/libgdal.so.26

Performed pip3 install opencv-python already Performed sudo apt install --reinstall gdal-bin libgdal-dev python3-gdal already Performed sudo apt-get install ros-noetic-cv-bridge already -- Result of the above was that ros-noetic-cv-bridge is already at the newest version.

However when my code hits the line

from cv_bridge.boost.cv_bridge_boost import getCvType

I get

ImportError: /lib/libgdal.so.26: undefined symbol: sqlite3_column_table_name and am at a loss at how to deal with this

NOTE : I followed the instructions at Unable to use cv_bridge with ROS Kinetic and Python3

I tried replacing "kinetic" with "noetic" and replaced the version number with mine (1.15.0).

Doing catkin build cv_bridge as instructed ther went through but gave me a few strange outputs.

Warnings << cv_bridge:make /home/tdadmin/catkin_workspace/logs/cv_bridge/build.make.000.log
cc1plus: warning: /home/tdadmin/.local/bin/python3.6m: not a directory cc1plus: warning: /home/tdadmin/.local/bin/python3.6m: not a directory cc1plus: warning: /home/tdadmin/.local/bin/python3.6m: not a directory cc1plus: warning: /home/tdadmin/.local/bin/python3.6m: not a directory cd /home/tdadmin/catkin_workspace/build/cv_bridge; catkin build --get-env cv_bridge | catkin env -si /usr/bin/make --jobserver-auth=3,4; cd -

I'mnot sure why its looking at python3.6m for anything. I set the executable line as stated for 3.8.

E: Below is the ~/catkin_workspace/src/vision_opencv/cv_bridge/CMakeLists.txt content.

cmake_minimum_required(VERSION 3.0.2)
project(cv_bridge)

find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)

if(NOT ANDROID)
  find_package(PythonLibs)

  if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
    # Debian Buster
    find_package(Boost REQUIRED python37)
  else()
    # Ubuntu Focal
    find_package(Boost REQUIRED python)
  endif()
else()
find_package(Boost REQUIRED)
endif()

set(_opencv_version 4)
find_package(OpenCV 4 QUIET)
if(NOT OpenCV_FOUND)
  message(STATUS "Did not find OpenCV 4, trying OpenCV 3")
  set(_opencv_version 3)
endif()

find_package(OpenCV ${_opencv_version4} REQUIRED
  COMPONENTS
    opencv_core
    opencv_imgproc
    opencv_imgcodecs
  CONFIG
)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS rosconsole sensor_msgs
  DEPENDS OpenCV
  CFG_EXTRAS cv_bridge-extras.cmake
)
catkin_python_setup()

include_directories(include ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

if(NOT ANDROID)
add_subdirectory(python)
endif()
add_subdirectory(src)
if(CATKIN_ENABLE_TESTING)
  add_subdirectory(test)
endif()

# install the include folder
install(
  DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
          

                                                                                                                                                                 

That said there are plenty of other CMakeLists.txt in this very directory, including

./src/vision_opencv/cv_bridge/python, ./src/vision_opencv/cv_bridge/test, ./src/vision_opencv/cv_bridge/, ./src/vision_opencv/cv_bridge/src

E2 : These are the results from catkin build cv_bridge

catkin build cv_bridge
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/noetic
Workspace:                   /home/tdadmin/catkin_workspace
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Build Space:        [exists] /home/tdadmin/catkin_workspace/build
Devel Space:        [exists] /home/tdadmin/catkin_workspace/devel
Install Space:      [exists] /home/tdadmin/catkin_workspace/install
Log Space:          [exists] /home/tdadmin/catkin_workspace/logs
Source Space:       [exists] /home/tdadmin/catkin_workspace/src
DESTDIR:            [unused] None
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        merged
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Additional CMake Args:       -DPYTHON_EXECUTABLE=/usr/bin/python3.8 -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Workspace configuration appears valid.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[build] Found '4' packages in 0.0 seconds.                                                                                                                                                      
Starting  >>> cv_bridge                                                                                                                                                                         
Finished  <<< cv_bridge                [ 0.9 seconds ]                                                                                                                                          
[build] Summary: All 1 packages succeeded!                                                                                                                                                      
[build]   Ignored:   3 packages were skipped or are blacklisted.                                                                                                                                
[build]   Warnings:  None.                                                                                                                                                                      
[build]   Abandoned: None.                                                                                                                                                                      
[build]   Failed:    None.                                                                                                                                                                      
[build] Runtime: 0.9 seconds total.   
Jibril
  • 967
  • 2
  • 11
  • 29
  • Did you change the `DPYTHON_INCLUDE_DIR` and `DPYTHON_LIBRARY` flags, too? What's your `CMakeLists.txt` file look like? – BTables Sep 29 '21 at 17:14
  • have you compiled the opencv using python3.8 ? if not, try this then compile the cv_bridge in ros in python 3.8 – Dr Yuan Shenghai Sep 29 '21 at 19:10
  • @DrYuanShenghai I'm relatively new to this, I primarily just use Python. What do you mean by compiling it in ros in python? – Jibril Sep 29 '21 at 19:55
  • @BTables Yes, I updated those as well. CMakeLists.txt exists in dozens of places on my machine. Which one should I be telling you about? – Jibril Sep 29 '21 at 19:56
  • @Jibril each package has its own `CMakeLists.txt`, this is how `catkin` and `cmake` know what to do when building each package. I'm curious about the one in the `cv_bridge` package. `Catkin` builds all packages within a single context so I believe it's possible rules are getting overwritten somewhere if they aren't explicit in cv_bridge – BTables Sep 29 '21 at 20:02
  • @BTables Interesting. Well when I do `locate CMakeLists.txt | grep *noetic*` I get nothing. Same if I replace that with `cv_bridge` Tons of CMakeLists.txt but none that I can see for cv_bridge. – Jibril Sep 29 '21 at 20:16
  • @BTables Actually found one related nearby. I'll edit it into the post above. – Jibril Sep 29 '21 at 20:18

2 Answers2

1

I believe this is an issue with mixing paths and sourcing working directories. Right now you have two copies of the cv_bridge, one in your local workspace and one in /opt. If everything is installed correctly via apt you can open a new terminal and only source the installed packages: source /opt/ros/noetic/setup.bash then with the python command line just try from cv_bridge.boost.cv_bridge_boost import getCvType and it should work. If it doesn't you should uninstall and reinstall via sudo apt remove ros-noetic-cv-bridge. If that works, you should remove the local copy in your workspace.

BTables
  • 4,413
  • 2
  • 11
  • 30
  • Fresh terminal. Did the `source /opt/ros/noetic/setup.bash`, received same error. Exited Python3, did `sudo apt remove ros-noetic-cv-bridge`. Repeated the first step with Python3, got `No module named cv_bridge`. Exited Python. Did `sudo apt install ros-noetic-cv-bridge`. Opened Python3, same error as before. – Jibril Sep 29 '21 at 20:47
1

Worked from using plain noetic image rather using desktop full.

FROM ros:noetic

RUN apt-get update \
    && apt-get install -q -y openssh-client \
    && apt-get install -q -y python3-pip \
    && apt-get install -q -y ros-noetic-cv-bridge \
    && apt-get install -q -y python3-opencv
saumilsdk
  • 721
  • 1
  • 7
  • 17