pythonpipsetuptoolssetup.pypython-packaging

What's the difference between 'pip3 install -e .' and 'python3 setup.py develop'


When installing a Python package locally in editable mode, both 'pip3 install -e .', and 'python3 setup.py develop', will both install the package locally in editable mode. I know that 'pip3 install -e .' is recommended over 'python3 setup.py develop', but I am unclear as to why and what the differences are between the two.

This answer for a separate question (https://stackoverflow.com/a/19048754/8903959) seems to indicate that it's because it's more difficult to uninstall when using python3 setup.py develop. Why is that the case?

Additionally, the answer (https://stackoverflow.com/a/19048754/8903959) says that dependencies are managed differently and incorrectly. What are the specific differences surrounding dependencies and why do they exist, especially if 'python3 setup.py develop' manages them incorrectly?

Apologies if this is a trivial question, but try as I might I could not find the answer or documentation for this reasoning elsewhere.


Solution

  • At this point in time, trying to get an accurate description of the differences between python setup.py install and python -m pip install seems rather pointless.

    python setup.py develop and python setup.py install originate from a time before pip existed. The behavior of these commands has not been kept up to date with all the latest standards while pip's behavior has. setuptools' place and role in the Python packaging ecosystem has shifted, it is now simply a "build back-end". setup.py should now be considered as a configuration file only, not as an executable script.

    I recommend reading this article for a lot of historical and technical background on the topic: Why you shouldn't invoke setup.py directly.

    Also this article on the Python packaging user guide: Is setup.py deprecated?