setup.py is deprecated
RalfJung opened this issue · comments
Seems like what we are doing with setup.py
is deprecated. I see warnings like this when running setup.py install
:
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: /opt/tunneldigger/lib/python3.7/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: !!
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: ********************************************************************************
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: Please avoid running ``setup.py`` directly.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: Instead, use pypa/build, pypa/installer or other
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: standards-based tools.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: ********************************************************************************
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: !!
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: self.initialize_options()
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: /opt/tunneldigger/lib/python3.7/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: !!
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: ********************************************************************************
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: Please avoid running ``setup.py`` and ``easy_install``.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: Instead, use pypa/build, pypa/installer or other
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: standards-based tools.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: See https://github.com/pypa/setuptools/issues/917 for details.
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: ********************************************************************************
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: !!
Aug 15 20:55:51 gw1.saar.freifunk.net tunneldigger[98775]: self.initialize_options()
Strangely I only see them on the server with Python 3.7. The server with Python 3.9 shows no warning...
Also the deprecation warning doesn't tell me what to do instead. :/ python setup.py install
got replaced by... what?
According to https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html we should use pip install
. How do you pip install
a local package though? This deprecation is handled frustratingly bad. :/
pip install ./broker
just shows an error message here
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.
So... I guess we'll just keep using setup.py install
because it is the only thing that works. 🤷
Is this inside CI? So you should probably create venv: https://docs.python.org/3/library/venv.html
That's just on my host. I've always found venvs to be too annoying in everyday life to want to deal with them... Rust gives me per-project isolation without me having to manually "activate" anything. :/