background-agents icon indicating copy to clipboard operation
background-agents copied to clipboard

modal-infra requires pydantic, fastapi and pyjwt

Open vladgurovich opened this issue 9 months ago • 3 comments

It wasnt installed in my environment and i got the following during terraform apply

Error: local-exec provisioner error
│
│   with module.modal_app.null_resource.modal_deploy,
│   on ../../modules/modal-app/main.tf line 61, in resource "null_resource" "modal_deploy":
│   61:   provisioner "local-exec" {
│
│ Error running command '../../modules/modal-app/scripts/deploy.sh': exit status 1. Output: Deploying Modal app: open-inspect
│ Deploy path: ../../..//packages/modal-infra
│ Deploy module: deploy
...
...
ModuleNotFoundError: No module named 'pydantic'
│ Error: Modal deployment failed for open-inspect

per claude:

Pydantic isn't installed in your local Python environment. The deploy script imports it at module
   load time via the chain: deploy.py → src/__init__.py → functions.py → app.py → log_config.py →
  sandbox/__init__.py → types.py → pydantic.

  Fix it by installing the Modal infra dependencies:

  cd packages/modal-infra && pip install -e .

  Or if you just want the minimum:

  pip install pydantic

Might be worthwile adding to instructions

vladgurovich avatar Feb 22 '26 22:02 vladgurovich

apparently fastapi and pyjwt is also needed but is not in pyproject.toml

╷
│ Error: local-exec provisioner error
│
│   with module.modal_app.null_resource.modal_deploy,
│   on ../../modules/modal-app/main.tf line 61, in resource "null_resource" "modal_deploy":
│   61:   provisioner "local-exec" {
│
│ Error running command '../../modules/modal-app/scripts/deploy.sh': exit status 1. Output: Deploying Modal app: open-inspect
│ Deploy path: ../../..//packages/modal-infra
│ Deploy module: deploy
...
...
ModuleNotFoundError: No module named 'fastapi'
│ Error: Modal deployment failed for open-inspect

vladgurovich avatar Feb 22 '26 22:02 vladgurovich

Thanks for reporting this — I confirmed this is a real issue.\n\n currently does not include or , but the code imports both ( imports , and imports ). Since imports at module import time, missing causes deploy/import failures in the local Terraform / environment.\n\n installs these packages into the Modal runtime image, but that does not satisfy local Python dependencies required during deployment.\n\nSo yes — this is valid and should be fixed by adding the missing dependencies to .

open-inspect avatar Feb 23 '26 01:02 open-inspect

Formatting fix for my previous comment: I confirmed this is a real issue.

packages/modal-infra/pyproject.toml currently does not include fastapi or PyJWT, but the code imports both (src/web_api.py imports fastapi, and src/auth/github_app.py imports jwt). Since src/__init__.py imports web_api at module import time, missing fastapi causes deploy/import failures in the local Terraform local-exec / modal deploy environment.

src/app.py installs these packages into the Modal runtime image, but that does not satisfy local Python dependencies required during deployment.

So yes — this is valid and should be fixed by adding the missing dependencies to pyproject.toml.

open-inspect avatar Feb 23 '26 01:02 open-inspect