Search for 'catkin' in workspace failed

asked 2017-04-27 21:23:38 -0500

zhangyongwei93 gravatar image

updated 2017-04-28 03:26:29 -0500

gvdhoorn gravatar image

Hello,
When I run catkin_make in a ros workspace, it output:

CMake Error at CMakeLists.txt:20 (message): Search for 'catkin' in workspace failed (catkin_find_pkg catkin /home/ubuntu/workspace/05.usb_cam_calibrate/src): Traceback (most recent call last):

File "/usr/bin/catkin_find_pkg", line 5, in from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 72, in import packaging.requirements
File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")

TypeError: call() takes exactly 2 arguments (1 given)

-- Configuring incomplete, errors occurred!

I have remove ros by sudo apt-get remove ros-*, and reinstall ros jade, but the problem is not resolved, the error is same.

Can you know how to fix it ?
Thanks a lot


Edit: The CMakeLists.txt is here, @Geoff

cmake_minimum_required(VERSION 2.8.3)
project(usb_cam)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS image_transport roscpp std_msgs std_srvs sensor_msgs camera_info_manager)

## pkg-config libraries
find_package(PkgConfig REQUIRED)
pkg_check_modules(avcodec libavcodec REQUIRED)
pkg_check_modules(swscale libswscale REQUIRED)

###################################################
## Declare things to be passed to other projects ##
###################################################

## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
)

###########
## Build ##
###########

include_directories(include
  ${catkin_INCLUDE_DIRS}
  ${avcodec_INCLUDE_DIRS}
  ${swscale_INCLUDE_DIRS}
)

## Build the USB camera library
add_library(${PROJECT_NAME} src/usb_cam.cpp)
target_link_libraries(${PROJECT_NAME}
  ${avcodec_LIBRARIES}
  ${swscale_LIBRARIES}
  ${catkin_LIBRARIES}
)

## Declare a cpp executable
add_executable(${PROJECT_NAME}_node nodes/usb_cam_node.cpp)
target_link_libraries(${PROJECT_NAME}_node
  ${PROJECT_NAME}
  ${avcodec_LIBRARIES}
  ${swscale_LIBRARIES}
  ${catkin_LIBRARIES}
)

#############
## Install ##
#############

## Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)

## Copy launch files
install(DIRECTORY launch/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
  FILES_MATCHING PATTERN "*.launch"
)

install(DIRECTORY include/${PROJECT_NAME}/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
   FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
) 
edit retag flag offensive close merge delete

Comments

Please post your CMakeLists.txt.

Geoff gravatar image Geoff  ( 2017-04-28 01:02:03 -0500 )edit

Looks like there is something funky with your python install; catkin_pkg is running from /usr/bin but using libraries from /usr/local/lib, which may be too new. If you're using a non-standard python (Anaconda?) or have upgraded packages via pip, you may want to try uninstalling the custom packages

ahendrix gravatar image ahendrix  ( 2017-04-28 02:59:52 -0500 )edit

do echo $ROS_PACKAGE_PATH if there is no output do source /opt/ros/ROS_VERSION/setup.bash in the same terminal build your workspace then source devel/setup.bash and add it in your bashrc. If there is ROS_PACKAGE_PATH please post it for more info

angeltop gravatar image angeltop  ( 2017-04-28 03:43:13 -0500 )edit

@angeltop do echo $ROS_PACKAGE_PATH, it output
/opt/ros/jade/share:/opt/ros/jade/stacks

zhangyongwei93 gravatar image zhangyongwei93  ( 2017-04-28 03:48:58 -0500 )edit

ROS_PACKAGE_PATH looks good for finding catkin. Sorry I don't have any other ideas...

angeltop gravatar image angeltop  ( 2017-04-28 03:56:08 -0500 )edit