What is the difference between a "pip wheel -e" and "pip install -e"?

Question:

Building a C-extension library to python, I noticed that building it with with wheel (and then install the *.whl) versus a direct install, gives very different results and build artifacts.

Building with: pip install -e .

  • We get an entry for Editable project location in the pip list results
  • The buildi atrifacts are few, but contains *.egg-info folder.
# pip install -e . --no-cache-dir
# pip list

Package            Version     Editable project location
------------------ ----------- -----------------------------------------------
black-scholes      0.0.1       C:path-tofbs

# tree -L 3
.
├── docs
├── examples
│   └── fbs_test.py
├── src
│   ├── black_scholes
│   │   ├── __init__.py
│   │   └── fbs.pyd
│   ├── black_scholes.egg-info
│   │   ├── PKG-INFO
│   │   ├── SOURCES.txt
│   │   ├── dependency_links.txt
│   │   └── top_level.txt
│   └── lib
│       ├── Makefile
│       └── fbs.c
├── .gitignore
├── LICENSE.md
├── README.md
├── pyproject.toml
└── setup.py

Building with: pip wheel -e .

However, when first building with wheel and then installing, we get a very different result.

  • We get an entire build directory with lots of artifacts.
  • Editable project location is empty
# pip wheel -e . --no-cache-dir
# pip install black_scholes-0.0.1-cp310-cp310-win_amd64.whl

# tree -L 6
.
├── build
│   ├── bdist.win-amd64
│   ├── lib.win-amd64-cpython-310
│   │   ├── black_scholes
│   │   │   ├── __init__.py
│   │   │   └── fbs.pyd
│   │   └── lib
│   │       └── fbs.c
│   └── temp.win-amd64-cpython-310
│       └── Release
│           └── src
│               └── lib
│                   ├── fbs.exp
│                   ├── fbs.lib
│                   └── fbs.obj
├── docs
├── examples
│   └── fbs_test.py
├── src
│   ├── black_scholes
│   │   └── __init__.py
│   ├── black_scholes.egg-info
│   │   ├── PKG-INFO
│   │   ├── SOURCES.txt
│   │   ├── dependency_links.txt
│   │   └── top_level.txt
│   └── lib
│       ├── Makefile
│       └── fbs.c
├── .gitignore
├── LICENSE.md
├── README.md
├── black_scholes-0.0.1-cp310-cp310-win_amd64.whl
├── pyproject.toml
└── setup.py

Q: What’s going on, and how is pip doing this differently?

(Is there a way to do the pip install, step-by-step?)

References:

  • This SOA – But still not very clear as it just refers back to setuptools docs
Asked By: not2qubit

||

Answers:

So in summary:

  • pip install -e . makes your installed (live) package Editable, by pointing and using the local (package project) directory for all it’s files. This way you can edit the package files and see the results immediately.
  • pip wheel -e . ignores the -e flag because it only builds the wheel, (in your local directory) and does not install the package. Therefore the -e is redundant.

PS. I am not 100% on the ignoring part, but I cannot see any difference from not using it. It could have additional functionalities not documented.

Answered By: not2qubit
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.