Skip to content

Issue with the "Run a FastAPI app" doc: poetry shell is no longer available #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
noamraph opened this issue Apr 18, 2025 · 1 comment

Comments

@noamraph
Copy link

I found an issue with this document.

Title: Run a FastAPI app
Location: https://fly.io/docs/python/frameworks/fastapi/
Source: https://github.com/superfly/docs/blob/main/python/frameworks/fastapi.html.markerb

Describe the issue

I install poetry using pipx install poetry. The page instructs to use poetry shell. However, when I run poetry shell, I get:

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  - the new env activate command (recommended); or
  - the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

Addtional info

I followed https://github.com/python-poetry/poetry-plugin-shell to install the poetry shell plugin. But now, when running fly launch (In https://fly.io/docs/python/frameworks/fastapi/#deploy-a-fastapi-app-from-scratch), I get:

❯ fly launch
Scanning source code
INFO Detected Poetry project
Error: No dependencies found in pyproject.toml

Even though the pyproject.toml file contains the fastapi dependency:

❯ cat pyproject.toml
[project]
name = "fastapi-app"
version = "0.1.0"
description = ""
authors = [
    {name = "Noam Raphael",email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "fastapi[standard] (>=0.115.12,<0.116.0)"
]

[tool.poetry]
packages = [{include = "fastapi_app", from = "src"}]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
@noamraph
Copy link
Author

I now tried to install an older poetry version, with

pipx install poetry==1.8.4

But now deplyment failed with:

3.227 Installing /app/.venv/bin/fastapi over existing file
3.240
3.240 Installing the current project: fastapi-app (0.1.0)
3.241
3.241 Error: The current project could not be installed: Readme path `/app/README.md` does not exist.
3.241 If you do not want to install the current project use --no-root.
3.241 If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file.
3.241 If you did intend to install the current project, you may need to set `packages` in your pyproject.toml file.
3.241
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c poetry install" did not complete successfully: exit code: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant