Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

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

Closed
lukeg32 opened this issue Oct 5, 2023 · 4 comments
Closed

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

lukeg32 opened this issue Oct 5, 2023 · 4 comments

Comments

@lukeg32
Copy link

lukeg32 commented Oct 5, 2023

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
Copy link
Author

lukeg32 commented Oct 5, 2023

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

@DMRobertson DMRobertson changed the title Can't generate homeserver.yaml "Argument 'bases' has incorrect type" from Pydantic on startup Oct 5, 2023
@DMRobertson
Copy link
Contributor

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: pydantic/pydantic#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 #13315

@DMRobertson
Copy link
Contributor

@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.

@lukeg32
Copy link
Author

lukeg32 commented Oct 5, 2023

a fresh install gets pydantic 1.10.13

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants