'setup.py install is deprecated' warning shows up every time I open a terminal in VSCode

Question:

Every time I boot up terminal on VSCode, I get the following prompt. This does not happen on Terminal.app.

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

How do I resolve this?

Asked By: ric.row

||

Answers:

Install the setuptools 58.2.0 version using the following command

pip install setuptools==58.2.0
Answered By: JialeDu

I assume you stumbled across this issue when you was building your .whl-file doing something like python Setup.py bdist_wheel --dist-dir .. (If not: This answer probably not applies to your problem.)
The warning you see wants to say that calling python Setup.py ... is obsolete now.

Solution, in short:

Replace setup.py with pyproject.toml. In pyproject.toml you enter all values from setup.py in an INI-file-like-structure. Then you create your .whl-file using the command python -m build.

Further information about python-packages and pyproject.toml: https://packaging.python.org/en/latest/tutorials/packaging-projects/

Further information about how to use pyproject.toml using setuptools:
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

Answered By: anion

Upgrade the setuptools. The versions greater than 58.2.0 is not showing the deprecation warning as of Oct 18, 2022.

pip install -U setuptools

Note, there are many ways to package Python. You will want to evaluate where your target deployment is. Working with the TOML files is a trend that allows better integration with many software languages. Reference: Overview of Packaging for Python

Answered By: zerocog

Install the setuptools 58.2.0 version using the following command

pip install setuptools==58.2.0

Don’t upgrade the setuptools. Only the version 58.2.0 worked for me. Though I tried upgrading the version to 65.5.0 but it was showing the deprecation warning.

Answered By: Mansi

I was having same issue for my data science project. I got same error while running pip install -r requirements.txt. This Worked for me.

Answered By: Matin

Calling setup.py directly is being deprecated, as explained here.

I did as the message told me and now build the wheel using pip (it still calls setup.py internally):

pip wheel --no-deps -w dist .

This replaced my old equivalent code:

python setup.py bdist_wheel

Note that the pip wheel command creates the wheel into your current directory by default, which is why I specify -w/--wheel_dir to match the old behavior of using the ./dist directory.

I also specify --no-deps so pip does not download the wheel files of all dependencies.

Answered By: xjcl
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.