Node fails to import Python package during isolated test run
Hello, everybody,
I have encountered an unusual problem.
I have a ROS package (with CMakeLists.txt and setup.py) that contains Python package inside (with __init__.py).
There is a launch file that starts one working node and one test node. If I do this during isolated build
(catkin_make_isolated --make-args run_tests
), working node fails to import Python package.
During regular build everything is OK. Moreover, if one touches CMakeLists.txt (touch CMakeLists.txt
),
problem disappears and tests work even in isolated environment.
Please, explain me if I'm doing something wrong.
Output:
sergii@s-strelkovskyi-d:/tmp/test$ catkin_make_isolated
Base path: /tmp/test
Source space: /tmp/test/src
Build space: /tmp/test/build_isolated
Devel space: /tmp/test/devel_isolated
Install space: /tmp/test/install_isolated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~ traversing 1 packages in topological order:
~~ - pkg1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The packages or cmake arguments have changed, forcing cmake invocation
==> Processing catkin package: 'pkg1'
==> Creating build directory: 'build_isolated/pkg1'
==> cmake /tmp/test/src/pkg1 -DCATKIN_DEVEL_PREFIX=/tmp/test/devel_isolated/pkg1 -DCMAKE_INSTALL_PREFIX=/tmp/test/install_isolated -G Unix Makefiles in '/tmp/test/build_isolated/pkg1'
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /tmp/test/devel_isolated/pkg1
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.12")
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /tmp/test/build_isolated/pkg1/test_results
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.8
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build_isolated/pkg1
==> make -j8 -l8 in '/tmp/test/build_isolated/pkg1'
<== Finished processing package [1 of 1]: 'pkg1'
sergii@s-strelkovskyi-d:/tmp/test$ catkin_make_isolated --make-args run_tests
Base path: /tmp/test
Source space: /tmp/test/src
Build space: /tmp/test/build_isolated
Devel space: /tmp/test/devel_isolated
Install space: /tmp/test/install_isolated
Additional make Arguments: run_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~ traversing 1 packages in topological order:
~~ - pkg1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> Processing catkin package: 'pkg1'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/tmp/test/build_isolated/pkg1'
==> make run_tests -j8 -l8 in '/tmp/test/build_isolated/pkg1'
Scanning dependencies of target clean_test_results_pkg1
Scanning dependencies of target tests
Built target tests
Removing test result files from '/tmp/test/build_isolated/pkg1/test_results ...
IIRC, test targets are not part of the dependencies of the
run_tests
make target. I don't completely follow your description, but does it 'always' work if you first build the tests and then run them?Test is written in Python as well, so I don't have any actual rules to build, only to run
There actually is: Python Catkin packages also need to be built (you can see this in your output after you
touch
theCMakeLists.txt
. Can you try withcatkin_make_isolated --make-args tests
and then run the tests?See catkin documentation - Installing Python scripts and modules for some background.
Tried. Didn't help. 'tests' target is built successfully, but during run_tests ImportError remains
@Sergii Strelkovskyi instead of linking to a
zip
file located in a Dropbox account, can you create a GitHub (or similar) repo instead? Many people (myself included) don't want to download and extractzip
files.