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

Pydantic + Python 3.11 crash #7541

Closed
avibrazil opened this issue Oct 5, 2022 · 3 comments
Closed

Pydantic + Python 3.11 crash #7541

avibrazil opened this issue Oct 5, 2022 · 3 comments
Labels
Install Problems with installation Question Questions - will be closed after some period of inactivity.

Comments

@avibrazil
Copy link

It's me again and now it crashes in a new OS.

Describe your environment

  • Operating system: Fedora 37
  • Python Version: 3.11.0
$ pip list -v | egrep "pydantic|freqtrade|fastapi|ccxt"
ccxt                  1.95.11     /home/aviram/.local/lib/python3.11/site-packages pip
fastapi               0.85.0      /home/aviram/.local/lib/python3.11/site-packages pip
freqtrade             2022.9.1    /home/aviram/.local/lib/python3.11/site-packages pip
pydantic              1.9.1       /usr/lib/python3.11/site-packages

The crash

$ freqtrade trade $dryrun $cnfs -s $strategy
2022-10-05 23:55:15,115 - freqtrade - INFO - freqtrade 2022.9.1
2022-10-05 23:55:15,279 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/main.py", line 39, in main
    return_code = args['func'](args)
                  ^^^^^^^^^^^^^^^^^^
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/commands/trade_commands.py", line 13, in start_trading
    from freqtrade.worker import Worker
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/worker.py", line 17, in <module>
    from freqtrade.freqtradebot import FreqtradeBot
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/freqtradebot.py", line 32, in <module>
    from freqtrade.rpc.external_message_consumer import ExternalMessageConsumer
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/rpc/external_message_consumer.py", line 19, in <module>
    from freqtrade.rpc.api_server.ws import WebSocketChannel
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/rpc/api_server/__init__.py", line 2, in <module>
    from .webserver import ApiServer
  File "/home/aviram/.local/lib/python3.11/site-packages/freqtrade/rpc/api_server/webserver.py", line 9, in <module>
    from fastapi import Depends, FastAPI
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/applications.py", line 15, in <module>
    from fastapi import routing
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/routing.py", line 23, in <module>
    from fastapi.dependencies.models import Dependant
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/dependencies/models.py", line 3, in <module>
    from fastapi.security.base import SecurityBase
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/security/__init__.py", line 1, in <module>
    from .api_key import APIKeyCookie as APIKeyCookie
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/security/api_key.py", line 3, in <module>
    from fastapi.openapi.models import APIKey, APIKeyIn
  File "/home/aviram/.local/lib/python3.11/site-packages/fastapi/openapi/models.py", line 103, in <module>
    class Schema(BaseModel):
  File "/usr/lib/python3.11/site-packages/pydantic/main.py", line 292, in __new__
    cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/utils.py", line 258, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/usr/lib64/python3.11/inspect.py", line 2715, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'not' is not a valid parameter name
@avibrazil avibrazil added the Triage Needed Issues yet to verify label Oct 5, 2022
@xmatthias xmatthias added Question Questions - will be closed after some period of inactivity. and removed Triage Needed Issues yet to verify labels Oct 6, 2022
@xmatthias
Copy link
Member

xmatthias commented Oct 6, 2022

python 3.11 is not a stable version yet. your version will therefore not be 3.11.0 - but 3.11.0rc2 (or rc1).

The stable release of 3.11 is planned for the end of the month.
Based on experience from the 3.10 update, we will add support for python 3.11 a few weeks after this (once most libraries catch up with having wheels ready) - potentially months after this if there's problems with some dependencies.

until then, please stick to the supported python versions (3.8, 3.9 and 3.10).


It's also strange that you're on an outdated pydantic version (again) - which suggests that it's not a new environment - but an existing (older) version of 3.11.

pydantic added support for 3.11 in their 1.10 release - so that's most likely the culprit.

@xmatthias xmatthias added the Install Problems with installation label Oct 6, 2022
@avibrazil
Copy link
Author

avibrazil commented Oct 6, 2022

Thanks @xmatthias !
Indeed it works after updating pydantic to latest (1.10.2).

@marcelloexp386
Copy link

I had a similar problem when I tried to (re)install SpaCy with Python3.11. Since I upgraded to Python3.11 in January, I think that the problem is really with old versions of Pydantic. When I read this thread and upgraded pydantic, it all worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Install Problems with installation Question Questions - will be closed after some period of inactivity.
Projects
None yet
Development

No branches or pull requests

3 participants