Skip to content
Latchkey

Poetry "The current project could not be installed: No file/folder found"

Poetry tried to install your project itself (not just its dependencies) and could not find the package directory implied by the project name. The [tool.poetry] name does not map to an importable folder Poetry can locate.

What this error means

poetry install fails with The current project could not be installed: No file/folder found for package <name>. It often appears in CI for an app (not a library) where there is no package matching the name, or with a src-layout Poetry was not told about.

poetry output
The current project could not be installed: No file/folder found for package my-service
If you do not want to install the current project use --no-root.
If you want to use Poetry only for dependency management ... set "package-mode = false".

Common causes

Package name does not match a folder

Poetry expects a directory matching the normalized project name (e.g. my_service/). If it does not exist - common for apps that are not packages - the install of the root fails.

src-layout or custom packages not declared

With a src/ layout or a differently named package, Poetry needs an explicit packages entry to find it.

How to fix it

Install dependencies only when the project is not a package

For an application you do not need to install itself, skip installing the root.

Terminal
poetry install --no-root
# or in pyproject.toml (Poetry 1.8+):
# [tool.poetry] package-mode = false

Declare the package location for src-layout

Tell Poetry where the importable package lives so it can install the root.

pyproject.toml
[tool.poetry]
name = "my-service"
packages = [{ include = "my_service", from = "src" }]

How to prevent it

  • Use --no-root/package-mode = false for applications that are not packages.
  • Declare packages for src-layout or non-matching package names.
  • Keep the project name and package folder consistent for libraries.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →