GithubHelp home page GithubHelp logo

python3 compatability issue about geometry2 HOT 6 CLOSED

ros avatar ros commented on July 19, 2024
python3 compatability issue

from geometry2.

Comments (6)

allenh1 avatar allenh1 commented on July 19, 2024

Just wondering if there was any progress on this. As you know, I've been working on the Gentoo installation for some time now. Desktop_Full is failing on package 182 of 230, tf2_py, and this is the error I am getting. I'm almost 100% sure this is a python 3 compatibility issue (I'm running Python-3.3.6, and every single problem I've run into with compiling the source is python related... Am I supposed to be using 2.7?). @tfoote

<== Finished processing package [181 of 230]: 'smach_ros'

==> Processing catkin package: 'tf2_py'
==> Building with env: '/opt/ros/jade/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/allenh1/catkin_ws/build_isolated/tf2_py'
-- Using CATKIN_DEVEL_PREFIX: /home/allenh1/catkin_ws/devel_isolated/tf2_py
-- Using CMAKE_PREFIX_PATH: /opt/ros/jade
-- This workspace overlays: /opt/ros/jade
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using default Python package layout
-- Using empy: /usr/lib64/python3.3/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/allenh1/catkin_ws/build_isolated/tf2_py/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-3.3
-- catkin 0.6.14
-- Using these message generators: gencpp;geneus;genlisp;genpy
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:95 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

The dependency target "tf2_msgs_gencpp" of target "tf2_py" does not exist.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/allenh1/catkin_ws/build_isolated/tf2_py
==> make -j8 -l8 in '/home/allenh1/catkin_ws/build_isolated/tf2_py'
Scanning dependencies of target tf2_py
[100%] Building CXX object CMakeFiles/tf2_py.dir/src/tf2_py.cpp.o
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:62:1: error: invalid conversion from ‘const char_’ to ‘Py_ssize_t {aka long int}’ [-fpermissive]
};
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘PyObject_ transform_converter(const TransformStamped_)’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:109:103error: ‘PyString_FromString’ was not declared in this scope
PyObject_SetAttrString(pheader, "frame_id", PyString_FromString((transform->header.frame_id).c_str()));
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘PyObject_ allFramesAsYAML(PyObject_, PyObject_)’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:186:59:error: ‘PyString_FromString’ was not declared in this scope
return PyString_FromString(bc->allFramesAsYAML().c_str());
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘PyObject* allFramesAsString(PyObject_, PyObject_)’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:192:61:error: ‘PyString_FromString’ was not declared in this scope
return PyString_FromString(bc->allFramesAsString().c_str());
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘PyObject* setTransform(PyObject_, PyObject_)’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:388:105error: ‘PyString_AsString’ was not declared in this scope
transform.child_frame_id = PyString_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘PyObject* setTransformStatic(PyObject_, PyObject_)’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:419:105error: ‘PyString_AsString’ was not declared in this scope
transform.child_frame_id = PyString_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp: In function ‘void init_tf2()’:
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:512:67:error: ‘PyString_FromString’ was not declared in this scope
pModulerospy = PyImport_Import(item= PyString_FromString("rospy")); Py_DECREF(item);
^
/home/allenh1/catkin_ws/src/geometry_experimental/tf2_py/src/tf2_py.cpp:529:43:error: ‘Py_InitModule’ was not declared in this scope
m = Py_InitModule("_tf2", module_methods);
^
CMakeFiles/tf2_py.dir/build.make:54: recipe for target 'CMakeFiles/tf2_py.dir/src/tf2_py.cpp.o' failed
make[2]: *** [CMakeFiles/tf2_py.dir/src/tf2_py.cpp.o] Error 1
CMakeFiles/Makefile2:711: recipe for target 'CMakeFiles/tf2_py.dir/all' failed
make[1]: *** [CMakeFiles/tf2_py.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'tf2_py':
Command '['/opt/ros/jade/env.sh', 'make', '-j8', '-l8']' returned non-zero exit status 2

Reproduce this error by running:
==> cd /home/allenh1/catkin_ws/build_isolated/tf2_py && /opt/ros/jade/env.sh make -j8 -l8

Command failed, exiting.

from geometry2.

allenh1 avatar allenh1 commented on July 19, 2024

Update: everything builds if I use Python-2.7.

from geometry2.

spaghetti- avatar spaghetti- commented on July 19, 2024

We still need to fix this though.

from geometry2.

allenh1 avatar allenh1 commented on July 19, 2024

Ya - that would be good. Let me know if I can do anything.

from geometry2.

benureau avatar benureau commented on July 19, 2024

So I checked, and indeed, tf2_py.cpp is using the Python 2 C API, which is incompatible with Python 3. From there, there are two choices:

  • Making the code compatible with Python 3, for instance by using py3c.
  • Rewriting the extension in cython, which would make it easier to understand and maintain, and immediately compatible with both versions of Python.

I don't know enough about the ins and outs of this extension to know which way is better. Anyone knowledgeable has any input on this?

from geometry2.

tfoote avatar tfoote commented on July 19, 2024

Thanks to @de-vri-es I just merged #173 which adds python3 compatibility. From his testing this is fixed. If anyone else has time to test this before I make the next release that would be appreciated.

from geometry2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.