How to run the IPython shell in your uv project
Running uv run ipython fails when IPython isn’t installed in the project environment:
$ uv run ipython
error: Failed to spawn: `ipython`
Caused by: No such file or directory (os error 2)Use IPython for one session
Add IPython for one session without modifying project dependencies:
uv run --with ipython ipythonuv run executes the command inside the project’s virtual environment, ensuring all dependencies are installed first. The --with flag adds IPython for this invocation only. Both pyproject.toml and the lockfile stay unchanged.
Add IPython as a development dependency
The --dev flag marks IPython as a development dependencyA package needed during development (testing, linting, formatting) that is not shipped to users of your project. Installed with the --dev flag.
, keeping it out of production installs:
uv add --dev ipython
uv run ipythonInstall IPython globally with uv tool
Install it as a uv tool for access across all projects:
uv tool install ipythonWarning
A globally installed IPython runs in its own isolated environment and cannot import your project’s dependencies.