dbt-core: [Bug] "RecursionError: maximum recursion depth exceeded" in Python3.10
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When I run dbt run or dbt docs generate in Python 3.10, the standard output continues indefinitely. I think the program is in an infinite loop.
The following is an excerpt of some of the output.
RecursionError: maximum recursion depth exceeded
Logged from file /usr/local/lib/python3.10/site-packages/logbook/concurrency.py, line 141
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/logbook/handlers.py", line 216, in handle
self.emit(record)
File "/usr/local/lib/python3.10/site-packages/dbt/logger.py", line 467, in emit
super().emit(record)
File "/usr/local/lib/python3.10/site-packages/logbook/handlers.py", line 836, in emit
msg = self.format(record)
File "/usr/local/lib/python3.10/site-packages/dbt/logger.py", line 454, in format
msg = super().format(record)
File "/usr/local/lib/python3.10/site-packages/logbook/handlers.py", line 195, in format
return self.formatter(record, self)
File "/usr/local/lib/python3.10/site-packages/logbook/handlers.py", line 387, in __call__
line = self.format_record(record, handler)
File "/usr/local/lib/python3.10/site-packages/logbook/handlers.py", line 371, in format_record
return self._formatter.format(record=record, handler=handler)
File "/usr/local/lib/python3.10/site-packages/logbook/helpers.py", line 283, in __get__
value = self.func(obj)
File "/usr/local/lib/python3.10/site-packages/logbook/base.py", line 675, in thread_name
return thread_get_name()
File "/usr/local/lib/python3.10/site-packages/logbook/concurrency.py", line 141, in thread_get_name
return currentThread().getName()
File "/usr/local/lib/python3.10/threading.py", line 1442, in currentThread
warnings.warn('currentThread() is deprecated, use current_thread() instead',
RecursionError: maximum recursion depth exceeded
Logged from file /usr/local/lib/python3.10/site-packages/logbook/concurrency.py, line 141
Expected Behavior
dbt run is succeed.
By using the Python 3.9.9, I was able to confirm that the same configuration would be successful.
Steps To Reproduce
Environment: Python 3.10.1-slim in docker
$ docker run --interactive --tty --rm --volume $(pwd):/app --workdir /app python:3.10.1-slim bash
install and initialize dbt
# pip install dbt-bigquery
# dbt init test
# cd test/
run
# dbt run
Relevant log output
no log
# wc logs/dbt.log
0 0 0 logs/dbt.log
Environment
- OS: [Docker Python official image](https://hub.docker.com/_/python) python:3.10.1-slim debian 11.2
- Python:3.10.1
- dbt:1.0.1
What database are you using dbt with?
bigquery
Additional Context
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19 (6 by maintainers)
Hey @s2terminal, dbt does not support Python 3.10 (yet!) and as such the recommended action is what you have already done, downgrade to 3.9 until 3.10 is officially supported.
Looking at the error message it appears this is not caused by dbt but by the
Logbookmodule. In fact this module looks to no longer be updated. Logbook is defined as a dependency here.Correct - we’ve kept the “legacy logger” around to keep supporting some older integrations, but we disable it unless a specific env var is switched on:
https://github.com/dbt-labs/dbt-core/blob/7fbfd53c3e68d05577c4d73eb562e0c96ac83778/core/dbt/logger.py#L454-L455
We’re planning to remove it (finally) in dbt-core v1.7 (October):
I don’t think this bug is completed, as I presume dbt-core will at some point support python 3.10 and this is a problem still. logbook hasn’t received updates since 2019 so it might be worth migrating off it ASAP.
@pgoslatara Thanks for the answer, I will downgrade the python version to 3.9.