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.errors.PydanticImportError (pydantic v2.1.1) #13

Open
ddofborg opened this issue Jul 26, 2023 · 1 comment
Open

pydantic.errors.PydanticImportError (pydantic v2.1.1) #13

ddofborg opened this issue Jul 26, 2023 · 1 comment

Comments

@ddofborg
Copy link

I got this pydantic.errors.PydanticImportError exception when started litexpore. Uninstalling 2.x.x version and installing v1.10.12 with pip install pydantic==1.10.12 worked.

Traceback (most recent call last):
  File "/venv/bin/litexplore", line 5, in <module>
    from litexplore import __main__
  File "/venv/lib/python3.8/site-packages/litexplore/__main__.py", line 23, in <module>
    uvicorn.run(
  File "/venv/lib/python3.8/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/venv/lib/python3.8/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/venv/lib/python3.8/site-packages/uvicorn/server.py", line 68, in serve
    config.load()
  File "/venv/lib/python3.8/site-packages/uvicorn/config.py", line 467, in load
    self.loaded_app = import_from_string(self.app)
  File "/venv/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/venv/lib/python3.8/site-packages/litexplore/app.py", line 27, in <module>
    from pydantic import (
  File "/venv/lib/python3.8/site-packages/pydantic/__init__.py", line 210, in __getattr__
    return _getattr_migration(attr_name)
  File "/venv/lib/python3.8/site-packages/pydantic/_migration.py", line 289, in wrapper
    raise PydanticImportError(
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.1.1/migration/#basesettings-has-moved-to-pydantic-settings for more details.

For further information visit https://errors.pydantic.dev/2.1.1/u/import-error
@Samsam987
Copy link

You can fix that by replacing :

from pydantic import ...

by

from pydantic.v1 import ...

in the /venv/lib/python3.8/site-packages/litexplore/app.py file. Worked for me.

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

2 participants