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?
6
Answers
Install the setuptools 58.2.0 version using the following command
I assume you stumbled across this issue when you was building your
.whl
-file doing something likepython 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
withpyproject.toml
. Inpyproject.toml
you enter all values fromsetup.py
in an INI-file-like-structure. Then you create your.whl
-file using the commandpython -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
usingsetuptools
:https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
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 PythonInstall the setuptools 58.2.0 version using the following command
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.
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.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):This replaced my old equivalent code:
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.