The Python Oracle

"pip install --editable ./" vs "python setup.py develop"

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Ancient Construction

--

Chapters
00:00 Question
00:24 Accepted answer (Score 174)
00:58 Answer 2 (Score 88)
01:26 Answer 3 (Score 47)
02:05 Answer 4 (Score 6)
02:38 Thank you

--

Full question
https://stackoverflow.com/questions/3030...

Accepted answer links:
[docs]: https://pip.pypa.io/en/latest/cli/pip_in...
[docs]: http://setuptools.readthedocs.io/en/late...

Answer 2 links:
[python wheels]: http://pythonwheels.com/

Answer 4 links:
[CI log with pre-releases accidentally used]: https://travis-ci.com/github/Telecominfr...
[a fixed build here]: https://travis-ci.com/github/Telecominfr...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pip #setuptools #pythonpackaging

#avk47



ACCEPTED ANSWER

Score 179


Try to avoid calling setup.py directly, it will not properly tell pip that you've installed your package.

With pip install -e:

For local projects, the “SomeProject.egg-info” directory is created relative to the project path. This is one advantage over just using setup.py develop, which creates the “egg-info” directly relative the current working directory.

More: docs

Also read the setuptools' docs.




ANSWER 2

Score 87


One more difference: pip install -e uses wheel while python setup.py develop
doesn't use it.

With install, you could achieve the same behavior by using
pip install -e /path/to/package --no-use-wheel

More info on wheels : python wheels




ANSWER 3

Score 47


Another difference that may favor pip install -e is that if your project has dependencies in install_requires in setup.py, then pip install -e . installs dependencies with pip, while python setup.py develop can install with easy_install, and may cause problems re: 'egg-info' as mentioned above. When install-requires uses dependency_links with custom git URLs, with attached egg identifiers, this can be especially annoying.




ANSWER 4

Score 6


Yet another difference: when you run python setup.py develop for a version that is considered a pre-release (perhaps because you're running it from a git clone when not having checked out a release), then you will enable installation of pre-releases of your dependencies. On the other hand, with pip install --editable you would have to pass --pre explicitly if you want these pre-releases.

(See the CI log with pre-releases accidentally used and compare that to a fixed build here.)