import distutils.command.bdist_wininst as orig

530 views Asked by At

Everything went well while I was trying to create a ros 2 package in Ubuntu 22.04 by following the ros2 documentation, however when I got to the colcon build step, it failed for python packages even though it works for cMake packages.

colcon build --packages-select mypkgpython
...
import distutils.command.bdist_wininst as orig
ModuleNotFoundError: No module named 'distutils.command.bdist_wininst'

knowing that my python version is:

python3 --version
Python 3.10.6

i have tried: sudo apt-get install python3-distutils:

python3-distutils is already the newest version (3.10.6-1~22.04).

sudo apt-get install python3-apt:

python3-apt is already the newest version (2.4.0).

sudo apt install python3-colcon-common-extensions

python3-colcon-common-extensions is already the newest version(0.3.0-1)

how can i solve this problem?

i expected when i build my python package using

colcon build package

it will be successfully build, so i could work with

2

There are 2 answers

0
ma r On BEST ANSWER

The bdist_wininst format was deprecated in Python 3.8, and the documentation for this format has been removed in Python 3.9. The recommended way to distribute Python packages now is the Wheel format.

you can overcome this error by JUST updating the setuptools

pip install --upgrade setuptools

Note that: Setuptools version 58.2.0 is the last version that works with ROS 2 python packages without any warnings because it is the last version that supports the old installation method, "python setup.py install." This method has been deprecated and replaced by newer, standards-based tools, such as pip and ament.

pip install setuptools==58.2.0
0
nux On

The bdist_wininst command was deprecated in Python 3.8 and you are using python 3.10

Its no more found in python3-distutils package .

use bdist_wheel (wheel packages) instead

or

if you want to run your code as it is downgrade your python to < 3.8