Closed
Description
Traceback (most recent call last):
File "C:\Users\micro\miniconda3\envs\test\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\micro\miniconda3\envs\test\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\micro\miniconda3\envs\test\lib\site-packages\llama_cpp\server\__main__.py", line 29, in <module>
from llama_cpp.server.app import create_app, Settings
File "C:\Users\micro\miniconda3\envs\test\lib\site-packages\llama_cpp\server\app.py", line 15, in <module>
from pydantic import BaseModel, BaseSettings, Field, create_model_from_typeddict
File "C:\Users\micro\miniconda3\envs\test\lib\site-packages\pydantic\__init__.py", line 206, in __getattr__
return _getattr_migration(attr_name)
File "C:\Users\micro\miniconda3\envs\test\lib\site-packages\pydantic\_migration.py", line 279, in wrapper
raise PydanticImportError(
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.0.2/migration/#basesettings-has-moved-to-pydantic-settings for more details.
For further information visit https://errors.pydantic.dev/2.0.2/u/import-error
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
IgnacioFDM commentedon Jul 9, 2023
Same, solved it downgrading pydantic
pip install pydantic==1.10.11
dillfrescott commentedon Jul 9, 2023
Oh. Thank you for the info!
AbhinasRegmi commentedon Jul 9, 2023
In the pydantic v2 the BaseSettings has been moved to a different package. First install pydantic-settings by
pip install pydantic-settings
and replace
from pydantic import BaseSettings
with
from pydantic_settings import BaseSettings
It should work after that.
Calandiel commentedon Jul 9, 2023
Glad to see it's nothing more complex but this really ought to be fixed on the repo
[-]Error[/-][+]PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package[/+]Calandiel commentedon Jul 9, 2023
There's some additional issues related to this as far as I can tell --
type
no longer exists on FieldInfo (seems to be called annotation now?) which makes the server fail.abetlen commentedon Jul 9, 2023
@dillfrescott was this on a pip install or via git?
FastAPI recently upgraded to pydantic v2 which should be much faster however it does introduce some breaking changes. Can you try upgrading to the new
v0.1.69
version I just published?uogbuji commentedon Jul 9, 2023
@abetlen On v0.1.69 I got past the OP issue with
pip install -U pydantic pydantic-settings fastapi
but I'm now running into a related error:uogbuji commentedon Jul 10, 2023
FYI the 0.1.70 release fixed this error.
Alberoyang commentedon Jul 10, 2023
Hi~ sames as me.


And if I set pydantic to 1.10.11, will be
I can't satisfy all.
snxraven commentedon Jul 10, 2023
I am also seeing this issue within my docker builds, not sure how to fix it, I am seeing it on all recent versions
snxraven commentedon Jul 14, 2023
Latest release 0.1.71 fixed this issue for me.
amj commentedon Jul 19, 2023
not currently working on 0.1.73
larrycai commentedon Oct 14, 2023
now llama_cpp_python is 0.2.11, this change doesn't work
DLesmes commentedon Apr 10, 2024
it is not resolved, why did you close it @abetlen ❓
despite to do this:
pip install pydantic-settings
and run this:
from pydantic_settings import BaseSettings
it doesn’t work for many libraries and it's dependencies 🐍
Srajangpt1 commentedon Apr 13, 2024
I am running into similar error
abetlen commentedon Apr 14, 2024
@DLesmes it should be resolved with the
pydantic-settings
dependency inpyproject.toml
. If you run trypython3 -m pip install pydantic-settings
thenpython3 -c "from pydantic_settings import BaseSettings"
does that still cause issues? It may be a mismatch between your pip and python intepreter.aguennoune commentedon Jun 1, 2024
pip install pydantic==1.10.11
It works!
streamlit_pydantic
won't work without thispydantic
version downgradeHarshad046 commentedon Jul 11, 2024
I used your solution but I am still getting the same message as I am trying to use pandas_profiling or streamlit_pandas_profiling, can you help with the fix ?
medsouza commentedon Jul 27, 2024
@Harshad046, pandas_profiling has been deprecated. Use ydata_profiling instead. Uninstall everything and follow the instructions in the link below:
https://github.com/ydataai/ydata-profiling