Skip to content

Make fastapi install optional and relax pinning from setup.py requirements #4361

@jmahlik

Description

@jmahlik

Describe the bug
68ff700#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R67-R72 introduced pinned dependencies in the setup.py.

These will inevitably conflict with downstream users ability to install sagemaker alongside fastapi or uvcorn. Relax the restrictions on the deps.

** edit **
On second thought, why are fastapi and uvicorn listed as dependencies? I don't see any references to them in the codebase on the current master/v2.203.0. These should either be removed or set as optional extra installs.

Not imported anywhere? Only shows in the setup.py.

git grep --ignore-case -e 'fastapi'
setup.py:    "fastapi==0.95.2",

Using pipdeptree shows these packages bring in other transitive deps which increases the install load if they aren't used or only used for a niche feature.

pipdeptree  -p fastapi,uvicorn
fastapi==0.95.2
├── pydantic [required: >=1.6.2,<2.0.0,!=1.8.1,!=1.8,!=1.7.3,!=1.7.2,!=1.7.1,!=1.7, installed: 1.10.13]
│   └── typing-extensions [required: >=4.2.0, installed: 4.9.0]
└── starlette [required: >=0.27.0,<0.28.0, installed: 0.27.0]
    └── anyio [required: >=3.4.0,<5, installed: 4.2.0]
        ├── idna [required: >=2.8, installed: 3.6]
        └── sniffio [required: >=1.1, installed: 1.3.0]
uvicorn==0.22.0
├── click [required: >=7.0, installed: 8.1.7]
│   └── colorama [required: Any, installed: 0.4.6]
└── h11 [required: >=0.8, installed: 0.14.0]

To reproduce
This was introduced in release 2.199.0.

python -m pip install sagemaker==2.203.0 results in unresolvable deps if fastapi is pinned in a users requirements.

Expected behavior
Install to resolve without restricting the version of fastapi.

Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 2.203.0
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): n/a
  • Framework version: n/a
  • Python version: 3.12/3.11/3.10/3.9
  • CPU or GPU: cpu
  • Custom Docker image (Y/N): N

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions