Skip to content

python: Replace deprecated setup.py with pypa/build+pip #5284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rtoax
Copy link
Contributor

@Rtoax Rtoax commented Apr 15, 2025

When setuptools>58.2.0 setup.py installation is a deprecated method, a warning message will be prompted [1]:

$ sudo make install
....
running install
/usr/lib/python3.13/site-packages/setuptools/_distutils/cmd.py:66:
SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/usr/lib/python3.13/site-packages/setuptools/_distutils/cmd.py:66:
EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()

Use the recommended solution [2] to replace setup.py with pypa/build and pip-install to completely solve the problem. It is worth noting that under Debian, you need to add the --break-system-packages parameter to pip-uninstall, as shown in the following prompt:

Debian12:~$ sudo pip3 uninstall bcc
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python
installation or OS distribution provider. You can override this, at the
risk of breaking your Python installation or OS, by passing
--break-system-packages.
hint: See PEP 668 for the detailed specification.

# Successfully uninstalled
Debian12:~$ sudo pip3 uninstall bcc --break-system-packages

Fix: #4586 [1]
Link: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html [2]

When setuptools>58.2.0 setup.py installation is a deprecated method, a warning
message will be prompted [1]:

    $ sudo make install
    ....
    running install
    /usr/lib/python3.13/site-packages/setuptools/_distutils/cmd.py:66:
    SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    /usr/lib/python3.13/site-packages/setuptools/_distutils/cmd.py:66:
    EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See pypa/setuptools#917 for details.
            ********************************************************************************

    !!
      self.initialize_options()

Use the recommended solution [2] to replace setup.py with pypa/build and
pip-install to completely solve the problem. It is worth noting that under
Debian, you need to add the --break-system-packages parameter to pip-uninstall,
as shown in the following prompt:

    Debian12:~$ sudo pip3 uninstall bcc
    error: externally-managed-environment

    × This environment is externally managed
    ╰─> To install Python packages system-wide, try apt install
        python3-xyz, where xyz is the package you are trying to
        install.

        If you wish to install a non-Debian-packaged Python package,
        create a virtual environment using python3 -m venv path/to/venv.
        Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
        sure you have python3-full installed.

        If you wish to install a non-Debian packaged Python application,
        it may be easiest to use pipx install xyz, which will manage a
        virtual environment for you. Make sure you have pipx installed.

        See /usr/share/doc/python3.11/README.venv for more information.

    note: If you believe this is a mistake, please contact your Python
    installation or OS distribution provider. You can override this, at the
    risk of breaking your Python installation or OS, by passing
    --break-system-packages.
    hint: See PEP 668 for the detailed specification.

    # Successfully uninstalled
    Debian12:~$ sudo pip3 uninstall bcc --break-system-packages

Fix: iovisor#4586 [1]
Link: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html [2]
Cc: Jerome Marchand <[email protected]>
Cc: Hengqi Chen <[email protected]>
Signed-off-by: Rong Tao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make install not support setuptools>58.2.0
1 participant