promnesia
promnesia copied to clipboard
AttributeError: 'pydantic_core._pydantic_core.Url' object has no attribute 'strip'
When I run the demo with
promnesia demo https://github.com/karlicoss/exobrain
and then the browser extension tries to access /visits
, I get:
File "/home/user/.local/lib/python3.10/site-packages/promnesia/server.py", line 164, in search_common
original_url = url and url.strip()
I'm getting the same, with fresh install. Any ideas why?
I found this thread after encountering the same issue. This is most likely a result of some dependency tree update involving fastapi, under which it used to use pydantic 1.. but if you update everything to latest, you get 2... This is what I suspected after running pipdeptree
, which shows that fastapi is responsible for pulling in pydantic. Fastapi says it's compatible with all pydantic versions 1+ though.
tl,dr: downgrade pydantic. I have tested it with 1.10.16 (the latest in the 1.. versions) and the error goes away.
FWIW, I run promnesia inside a nix shell; swapping out pydantic within fastapi took a bit of head bashing, so if it helps any other nix users, you can reference my expression here: https://github.com/whacked/setup/blob/f46e7c85bcc2548f2fed831b0f2a20cbb0c7ccc7/nix/pkgs/misc/promnesia/default.nix
If you don't use nix you can probably just run pip install pydantic==1.10.16
but don't quote me :-)
also for reference, here's my current pipdeptree for my promnesia environment after fixing the error. It might not be minimal, but should be close.
beautifulsoup4==4.12.3
└── soupsieve [required: >1.2, installed: 2.5]
chardet==5.2.0
httptools==0.6.1
logzero==1.7.0
lxml==5.1.0
mistletoe==1.3.0
pipdeptree==2.22.0
├── packaging [required: >=23.1, installed: 24.0]
└── pip [required: >=23.1.2, installed: 24.0]
poetry-core==1.9.0
promnesia==1.2.20230515
├── appdirs [required: Any, installed: 1.4.4]
├── cachew [required: >=0.8.0, installed: 0.11.0]
│ ├── appdirs [required: Any, installed: 1.4.4]
│ └── SQLAlchemy [required: >=1.0, installed: 2.0.30]
│ ├── greenlet [required: !=0.4.17, installed: 3.0.3]
│ └── typing_extensions [required: >=4.6.0, installed: 4.11.0]
├── fastapi [required: Any, installed: 0.110.2]
│ ├── pydantic [required: >=1.7.4,<3.0.0,!=2.1.0,!=2.0.1,!=2.0.0,!=1.8.1,!=1.8, installed: 1.10.16]
│ │ └── typing_extensions [required: >=4.2.0, installed: 4.11.0]
│ ├── starlette [required: Any, installed: 0.37.2]
│ │ └── anyio [required: >=3.4.0,<5, installed: 4.3.0]
│ │ ├── idna [required: >=2.8, installed: 3.7]
│ │ └── sniffio [required: >=1.1, installed: 1.3.1]
│ └── typing_extensions [required: >=4.8.0, installed: 4.11.0]
├── more-itertools [required: Any, installed: 10.2.0]
├── pytz [required: Any, installed: 2024.1]
├── SQLAlchemy [required: Any, installed: 2.0.30]
│ ├── greenlet [required: !=0.4.17, installed: 3.0.3]
│ └── typing_extensions [required: >=4.6.0, installed: 4.11.0]
├── tzlocal [required: Any, installed: 5.2]
├── urlextract [required: Any, installed: 1.9.0]
│ ├── filelock [required: Any, installed: 3.13.4]
│ ├── idna [required: Any, installed: 3.7]
│ ├── platformdirs [required: Any, installed: 4.2.0]
│ └── uritools [required: Any, installed: 4.0.2]
└── uvicorn [required: Any, installed: 0.29.0]
├── click [required: >=7.0, installed: 8.1.7]
└── h11 [required: >=0.8, installed: 0.14.0]
python-dotenv==1.0.1
setuptools-scm==8.0.4
├── packaging [required: >=20, installed: 24.0]
├── setuptools [required: Any, installed: 69.5.1.post0]
└── typing_extensions [required: Any, installed: 4.11.0]
six==1.16.0
uvloop==0.19.0
watchfiles==0.21.0
└── anyio [required: >=3.0.0, installed: 4.3.0]
├── idna [required: >=2.8, installed: 3.7]
└── sniffio [required: >=1.1, installed: 1.3.1]
websockets==12.0