pip
package management
Python
development
editable installation

What does pip install -e do? Editable installs explained

Codemia Knowledge Hub ·

pip install -e is for package development. It installs a project in editable mode, so the environment imports your current source tree directly and you can change the code and test it without reinstalling after every edit.

What editable mode means

A normal pip install . builds the package and installs it into the environment. Editable mode still counts as installed from pip's point of view, but imports point back to your working source directory.

Typical usage:

bash
python -m pip install -e .

After that, every new Python process sees your edits to the project's modules immediately. That fast iteration loop is the core use case.

Who benefits

Editable installs help most when:

  • you are building a library
  • you are testing a local package from an application
  • you are working in a monorepo with multiple Python packages

Without editable mode, each source change often turns into a cycle of editing the code, reinstalling the package and rerunning the tests. Editable installs remove the reinstall step for most ordinary source changes.

Example with a local package

Given this layout:

text
1my_package/
2  pyproject.toml
3  src/
4    my_package/
5      __init__.py
6      core.py

From the project root:

bash
python -m pip install -e .
python -c "import my_package; print(my_package)"

If you then edit core.py, test runs and REPL imports use the updated source without another install.

Using a local library from another project

Editable mode also helps when one local project depends on another. If application A depends on library B and you are editing B, installing B with -e lets A use the updated code immediately. That is often the cleanest workflow.

Changes that still need a reinstall

Editable mode covers source code changes. You still need to reinstall after:

  • dependency changes
  • package metadata changes
  • console script entry point changes
  • packaging configuration changes

Why not to use it in production

Editable installs are usually the wrong choice for production or locked-down CI images, because they point at a mutable working tree. Production systems usually want pinned versions, immutable artifacts and reproducible installs. Editable mode trades immutability for flexibility.

Editable installs with pyproject.toml

Editable installs used to be tied to setup.py workflows. Modern Python packaging supports them through current build backends that implement the right hooks. In practice the behavior is the same: the environment imports your live source tree while treating the project as an installed package.

Common mistakes

  • Using editable mode in production, where reproducibility matters more than convenience.
  • Assuming packaging metadata changes never need a reinstall.
  • Running the command outside the project root that contains the packaging metadata.
  • Thinking an editable install means no installation happened.
  • Doing a normal install while actively developing the package, then wondering why edits do not show up.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms