Ask Your Question
2

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

asked 2022-02-19 07:41:35 -0500

Hairy ass gravatar image

I am trying to create a package called helloworld that print out a message

cd ~/ro2_ws/src
ros2 pkg create --build-type ament_python helloworld

Inside helloworld/helloworld/nodefile.py

def main():
    print('Hello world')

Inside helloworld/setup.py

from setuptools import setup

package_name = 'helloworld'

setup(
    name=package_name,
    version='0.0.0',
    packages=[package_name],
    data_files=[
        ('share/ament_index/resource_index/packages',
                ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer='TODO',
    maintainer_email='TODO',
    description='TODO: Package description',
    license='TODO: License declaration',
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'nodefile = helloworld.nodefile:main'
        ],
    },
)

I try to compile it

colcon build --packages-select helloworld

I get

--- stderr: helloworld
/usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

warnings.warn(

Finished <<< helloworld [0.76s]

Summary: 1 package finished [0.93s] 1 package had stderr output: helloworld

So what is going on

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
4

answered 2022-05-04 01:19:00 -0500

noshluk2 gravatar image

Solved it. Problem is because of a package utilized by ros2 python packages -> setuptools

Solution

  • python version 3.8
  • setup tools version 58.2.0 ( last version to work with ros2 python packages without any warnings)

1 - find out your setup tools version

  • In terminal start python

image description

if it is above 58.2.0 then down grade it

  • pip install setuptools==58.2.0 ( all above versions do not work )

now colcon build it .

2 - Make sure you have underscores in setup.cfg file and not the '-' .

edit flag offensive delete link more
4

answered 2022-03-31 01:37:16 -0500

ijnek gravatar image

updated 2022-03-31 02:15:11 -0500

This issue seems to be coming from ROS2 directly calling setup.py when building your package (which became deprecated in Python3.10).

The transition to Python3.10 for ROS2 Rolling happened only recently, and this is probably one of the issues that arose from it (but has not been fixed yet). Even if this does get fixed, it is unlikely the changes will be ported back to Foxy because the target platform for Foxy is Ubuntu20.04 which uses Python3.8 by default.

/usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Your error message indicates that you're using Python3.10 to compile a ROS2 Foxy package. For this to happen, you must have manually installed Python3.10, installed a very recent version of Ubuntu (eg. 22.04), OR you're using a non-Ubuntu OS.

The recommended easy fix would be to revert to Python3.8 if you intend to use ROS2 Foxy.

I have raised an issue about this in ament_cmake

edit flag offensive delete link more
0

answered 2022-03-16 08:56:44 -0500

hi, you can simply remove the line install_requires=['setuptools'], from the file setup.py and also add --allow-overriding to rebuild your hello world.

edit flag offensive delete link more

Comments

This did not work for me. :/

nagda9 gravatar image nagda9  ( 2022-03-28 13:17:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

4 followers

Stats

Asked: 2022-02-19 07:41:35 -0500

Seen: 5,791 times

Last updated: May 04