python-poetry/poetry · error · PoetryError
Failed to install {path}
Error message
Failed to install {path} What it means
pip_install wraps environment.run_pip(*args) in try/except EnvCommandError and re-raises as PoetryError('Failed to install {path}') chaining the original EnvCommandError as __cause__. It means the underlying `pip install` invocation exited non-zero for the given path.
Source
Thrown at src/poetry/utils/pip.py:58
if upgrade:
args.append("--upgrade")
if not deps:
args.append("--no-deps")
if editable:
if not path.is_dir():
raise PoetryError(
"Cannot install non directory dependencies in editable mode"
)
args.append("-e")
args.append(str(path))
try:
return environment.run_pip(*args)
except EnvCommandError as e:
raise PoetryError(f"Failed to install {path}") from e
View on GitHub (pinned to 92b74dcfe3)
Solutions
- Inspect the chained EnvCommandError (the __cause__) for pip's actual stderr/stdout to find the real reason.
- Confirm the path exists and is a valid package/wheel for the target interpreter.
- Check write permissions on environment.path and available disk.
- If deps=True, resolve the underlying dependency conflicts or install with --no-deps where appropriate.
Example fix
# before
try:
pip_install(path, env)
except PoetryError:
pass # original pip stderr is lost
# after - surface the real cause
try:
pip_install(path, env)
except PoetryError as e:
raise RuntimeError(f'pip failed: {e.__cause__}') from e Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
def installable(path: Path, env) -> bool:
return path.exists() and env.path.exists() and os.access(env.path, os.W_OK) Try / catch
from poetry.exceptions import PoetryError
try:
pip_install(path, environment)
except PoetryError as e:
cause = e.__cause__ # the underlying EnvCommandError with pip's stderr
print('pip stderr:', getattr(cause, 'output', cause))
raise Prevention
- Read the chained EnvCommandError to see pip's real error.
- Confirm the path is a valid package for the target interpreter.
- Verify write permissions and disk space on the env prefix.
When it happens
Trigger: Any pip_install where pip fails: dependency conflict, incompatible/unsupported wheel for the interpreter, permission denied on the env prefix, network failure fetching deps (when deps=True), or a corrupt package.
Common situations: Installing a wheel built for a different Python/ABI/platform; permission errors writing into the environment prefix; pip resolver conflict when deps are not suppressed; transient network errors.
Related errors
- Cannot install non directory dependencies in editable mode
- Could not find a matching version of package {name}
- Invalid package definition.
- The following packages were not found: {', '.join(sorted(not
- Failed to install required Poetry plugins
AI-assisted analysis of python-poetry/poetry@92b74dcfe3 (2026-08-04).
Data as JSON: /data/errors/a5da19538ebf4e4b.json.
Report an issue: GitHub.