Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'dbt.adapters.factory' #49

Closed
alittlesliceoftom opened this issue Jun 11, 2024 · 9 comments
Closed

Comments

@alittlesliceoftom
Copy link

Likely lack of pegging release to specific versions of dbt?

My versions to get above error after doing a straight pip install:
dbt-adapters 1.2.1
dbt-common 1.3.0
dbt-core 1.8.2
dbt-extractor 0.5.1
dbt-score 0.1.3
dbt-semantic-interfaces 0.5.1
dbt-sqlserver 1.4.3
dbt-synapse 1.4.0

@alittlesliceoftom
Copy link
Author

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\projects\dbt_clones\dbtenv\Scripts\dbt-score.exe_main
.py", line 4, in
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt_score_init
.py", line 3, in
from dbt_score.models import Model
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt_score\models.py", line 11, in
from dbt_score.dbt_utils import dbt_ls
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt_score\dbt_utils.py", line 8, in
from dbt.cli.main import dbtRunner, dbtRunnerResult
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt\cli_init_.py", line 1, in
from .main import cli as dbt_cli # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt\cli\main.py", line 14, in
from dbt.cli import requires, params as p
File "C:\projects\dbt_clones\dbtenv\Lib\site-packages\dbt\cli\requires.py", line 10, in
from dbt.adapters.factory import adapter_management, register_adapter, get_adapter
ModuleNotFoundError: No module named 'dbt.adapters.factory'

@matthieucan
Copy link
Contributor

Thanks for the report. It's odd that, looking at the stacktrace, the failure seems to happen in imports only within the dbt-core source code.
Can you share your setup in terms of Python installation? Are you using a virtual environment?

@alittlesliceoftom
Copy link
Author

alittlesliceoftom commented Jun 11, 2024 via email

@matthieucan
Copy link
Contributor

Does dbt work in that environment? I would suspect it also has import issues?

@druzhinin-kirill
Copy link
Contributor

Hey! I was able to reproduce this issue on 3.11 with tox :

ImportError while loading conftest '.../dbt-score/tests/conftest.py'.
tests/conftest.py:7: in <module>
    from dbt_score import Model, Rule, RuleViolation, Severity, rule
.tox/py310/lib/python3.10/site-packages/dbt_score/__init__.py:3: in <module>
    from dbt_score.models import Model
.tox/py310/lib/python3.10/site-packages/dbt_score/models.py:11: in <module>
    from dbt_score.dbt_utils import dbt_ls
.tox/py310/lib/python3.10/site-packages/dbt_score/dbt_utils.py:8: in <module>
    from dbt.cli.main import dbtRunner, dbtRunnerResult
.tox/py310/lib/python3.10/site-packages/dbt/cli/__init__.py:1: in <module>
    from .main import cli as dbt_cli  # noqa
.tox/py310/lib/python3.10/site-packages/dbt/cli/main.py:14: in <module>
    from dbt.cli import requires, params as p
.tox/py310/lib/python3.10/site-packages/dbt/cli/requires.py:10: in <module>
    from dbt.adapters.factory import adapter_management, register_adapter, get_adapter
E   ModuleNotFoundError: No module named 'dbt.adapters.factory'

I believe we are affected by this dbt-labs/dbt-core#10135

As restricting to <1.8 resolves it:

"dbt-core>=1.5, <1.8"

@druzhinin-kirill
Copy link
Contributor

@alittlesliceoftom could you try out some of the suggestions made in the related dbt-core issue thread and see if it helps you?

@druzhinin-kirill
Copy link
Contributor

Hey! I'll close the issue as it's probably caused by the upstream issue in the dbt-core.
Try out some of the suggestions mentioned there and see if it helps you 🙌
If you continue experiencing the problem or need more information or context, feel free to reopen this issue 👍

@mirimgtec
Copy link

I am experiencing same issue when trying to use dbt-core 1.8.4 with dbt-metricflow 0.206.0. I am also using dbt-snowflake adapter.

@matthieucan
Copy link
Contributor

I am experiencing same issue when trying to use dbt-core 1.8.4 with dbt-metricflow 0.206.0. I am also using dbt-snowflake adapter.

Any chance the hints in dbt-labs/dbt-core#10135 can help?

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

No branches or pull requests

4 participants