Skip to content
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

Bug: Can't install with pyndantic >2.0 (despite documentation saying otherwise) #3601

Closed
xaviernogueira opened this issue Jan 6, 2024 · 10 comments
Assignees
Labels
not-a-bug parser Parser (Pydantic) utility

Comments

@xaviernogueira
Copy link

Expected Behaviour

I was expecting to be able to install the Python parser extension of the powertools despite needing pydantic 2.0 after reading the docs here.

Current Behaviour

I am blocked from installing due to conflicting dependencies. The source of the issue is pyproject.toml.

If this is unintentional behavior, can you update the pyproject.toml requirements, otherwise you should correct the documentation. I may make a PR.

Code snippet

ERROR: Cannot install -r requirements-runtime.txt (line 4), aws-lambda-powertools[all]==2.31.0 and pydantic>=2.0.3 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested pydantic>=2.0.3
    geojson-pydantic 1.0.1 depends on pydantic~=2.0
    aws-lambda-powertools[all] 2.31.0 depends on pydantic<2.0.0 and >=1.8.2; extra == "parser" or extra == "all"

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

Possible Solution

No response

Steps to Reproduce

pydantic>=2.0.3
aws_lambda_powertools[all]==2.31.0
boto3==1.26.19
geojson-pydantic==1.0.1

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.10

Packaging format used

PyPi

Debugging logs

No response

@xaviernogueira xaviernogueira added bug Something isn't working triage Pending triage from maintainers labels Jan 6, 2024
Copy link

boring-cyborg bot commented Jan 6, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@leandrodamascena
Copy link
Contributor

Hey @xaviernogueira! Thanks for opening this issue! The reason you can't install Pydantic 2+ is because you are using aws_lambda_powertools[all] and Pydantic v1 is the default version in Powertools.

Pls update your requirements.txt to use aws_lambda_powertools[aws-xray-sdk, fastjsonschema] and then you can bring Pydanticv2.

Pls let me know if this works.

Thanks

@leandrodamascena leandrodamascena added parser Parser (Pydantic) utility not-a-bug and removed bug Something isn't working triage Pending triage from maintainers labels Jan 8, 2024
@leandrodamascena leandrodamascena self-assigned this Jan 8, 2024
@leandrodamascena
Copy link
Contributor

I'm closing this issue and feel free to reopen it if necessary @xaviernogueira!

Thanks

Copy link
Contributor

github-actions bot commented Jan 9, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@xaviernogueira
Copy link
Author

@leandrodamascena

So I tried your solution and got the warning:

WARNING: aws-lambda-powertools 2.31.0 does not provide the extra 'aws-xray-sdk'
WARNING: aws-lambda-powertools 2.31.0 does not provide the extra 'fastjsonschema'

I can't tell if those extras are installed, but it did allow me to resolve the environment!

That said you guys should consider supporting pydantic 2.0, I may look into making a PR.

@leandrodamascena
Copy link
Contributor

Hello @xaviernogueira! My apologies here, I wrote the wrong command! You can try: pip install "aws_lambda_powertools[validation,tracer]"

We support Pydantic v2, but we do not make Pydantic v2 our default version because we can break customers who already use Powertools in their apps, and have not yet migrated their code from Pydantic v1 to v2.

We will drop support for Pydanticv1 and make Pydanticv2 the default version in Powertools V3 (we don't have a release estimate yet).

Thanks

@github-project-automation github-project-automation bot moved this from Coming soon to Pending review in Powertools for AWS Lambda (Python) Jan 19, 2024
@xaviernogueira
Copy link
Author

@leandrodamascena Thanks for the quick response! I'll let you know how it goes.

@xaviernogueira
Copy link
Author

Worked!

@github-project-automation github-project-automation bot moved this from Pending review to Coming soon in Powertools for AWS Lambda (Python) Jan 19, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@leandrodamascena
Copy link
Contributor

Thanks for letting me know @xaviernogueira! Feel free to ping us or open issues whenever you need!

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-a-bug parser Parser (Pydantic) utility
Projects
Status: Shipped
Development

No branches or pull requests

2 participants