I am using distutil
to install my python code using
python setup.py install
I run into problems when I want to install an older branch of my code over a new one: setup.py install
won't overwrite older files. A work around is touching (touch <filename>
) all files so they are forced to be newer than those installed, but this is pretty ugly.
What I am looking for is an option to force overwriting of all files, eg. something like
python setup.py --force install
Any Ideas?
py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. I found a very detailed write-up explaining this issue: "Why you shouldn't invoke setup.py directly" (October 2021).
install_requires is a setuptools setup.py keyword that should be used to specify what a project minimally needs to run correctly. When the project is installed by pip, this is the specification that is used to install its dependencies. Additionally, it's best practice to indicate any known lower or upper bounds.
package_dir = {'': 'lib'} in your setup script. The keys to this dictionary are package names, and an empty package name stands for the root package. The values are directory names relative to your distribution root.
For installing packages in “editable” mode (pip install --editable), pip will invoke setup.py develop , which will use setuptools' mechanisms to perform an editable/development installation.
The Python developers had the same idea, they just put the option after the command:
python setup.py install --force
The distutils documentation doesn't mention the --force
option specifically, but you can find it by using the --help
option:
python setup.py --help install
Go to the setup.py
directory and I simply use:
pip install .
It works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With