synapse icon indicating copy to clipboard operation
synapse copied to clipboard

"Argument 'bases' has incorrect type" from Pydantic on startup

Open lukeg32 opened this issue 3 years ago • 4 comments

Description

I have been Installing as a Python module from PyPI
and after installing as the tutorial suggested, when I run

python -m synapse.app.homeserver \  
    --server-name my.domain.name \  
    --config-path homeserver.yaml \  
    --generate-config \  
    --report-stats=no

I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/app/homeserver.py", line 28, in <module>
    from synapse.api.urls import (
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/api/urls.py", line 22, in <module>
    from synapse.config.homeserver import HomeServerConfig
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/config/homeserver.py", line 55, in <module>
    from .workers import WorkerConfig
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/config/workers.py", line 97, in <module>
    class InstanceTcpLocationConfig(ConfigModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)

I am running this on a PI 4, latest rasbian version

Steps to reproduce

  • list the steps
  • follow all steps in Installing as a Python module from PyPI
  • mkdir -p ~/synapse
  • virtualenv -p python3 ~/synapse/env
  • source ~/synapse/env/bin/activate
  • pip install --upgrade pip
  • pip install --upgrade setuptools
  • pip install matrix-synapse
  • cd ~/synapse
  • python -m synapse.app.homeserver --server-name my.domain.name --config-path homeserver.yaml --generate-config --report-stats=no

Homeserver

other

Synapse Version

1.93

Installation Method

pip (from PyPI)

Database

psql

Workers

Single process

Platform

Raspberry Pi 4 cat /etc/os-release

NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

works on my Ubuntu 22.04.3 LTS server

Configuration

No response

Relevant log output

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/app/homeserver.py", line 28, in <module>
    from synapse.api.urls import (
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/api/urls.py", line 22, in <module>
    from synapse.config.homeserver import HomeServerConfig
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/config/homeserver.py", line 55, in <module>
    from .workers import WorkerConfig
  File "/home/pi/synapse/env/lib/python3.9/site-packages/synapse/config/workers.py", line 97, in <module>
    class InstanceTcpLocationConfig(ConfigModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)

Anything else that would be useful to know?

No response

lukeg32 avatar Oct 05 '23 17:10 lukeg32

if I run

pip uninstall pydantic
pip install pydantic==1.10.12
python -m synapse.app.homeserver --server-name my.name --config-path homeserver.yaml --generate-config 

it works, though not sure if this is a good solution

lukeg32 avatar Oct 05 '23 19:10 lukeg32

Thanks for the report. Unfortunately, I can't reproduce this myself on Python 3.11, 3.9 or 3.8.

It seems that others have seen this against Pydantic: https://github.com/pydantic/pydantic/issues/7689 roughly a week ago. Eyeballing the discussion in that issue, it looks like this is a problem with the way some of their binaries were built.

pip install pydantic==1.10.12 it works, though not sure if this is a good solution

Good idea---this seems like the right thing to do here.

I don't think there's much the Synapse team can do to prevent this specific issue, so I'm going to close. It's worth mentioning however that this is a recurring theme: see https://github.com/matrix-org/synapse/issues/13315

DMRobertson avatar Oct 05 '23 20:10 DMRobertson

@lukeg32 one more thought occurs to me, though: when you did your initial install, what version of pydantic (pip list pydantic) got installed? I'm assuming it was 1.10.13 given the issue I linked, but it would be good to confirm.

DMRobertson avatar Oct 05 '23 20:10 DMRobertson

a fresh install gets pydantic 1.10.13

lukeg32 avatar Oct 05 '23 20:10 lukeg32