添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Describe the Bug

Currently trying to install https://docs.getdbt.com/dbt-cli/install/pip

after install I run dbt --version

Followed by saying the bz2 module is not found

Steps to Reproduce

install dbt

run $ dbt --version

Expected Behaviour

Output of the current version of dbt

Actual Behaviour

Error after running

dbt --version

ile "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/task/build.py", line 1, in
from .run import RunTask, ModelRunner as run_model_runner
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/task/run.py", line 8, in
from .compile import CompileRunner, CompileTask
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/task/compile.py", line 3, in
from .runnable import GraphRunnableTask
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/task/runnable.py", line 17, in
from dbt.task.base import ConfiguredTask
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/task/base.py", line 47, in
from dbt.adapters.factory import register_adapter
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/adapters/factory.py", line 14, in
from dbt.adapters.protocol import (
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/adapters/protocol.py", line 27, in
from dbt.graph import Graph
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/graph/ init .py", line 1, in
from .selector_spec import ( # noqa: F401
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/graph/selector_spec.py", line 8, in
from .graph import UniqueId
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/dbt/graph/graph.py", line 3, in
import networkx as nx # type: ignore
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/networkx/ init .py", line 59, in
from networkx import utils
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/networkx/utils/ init .py", line 2, in
from networkx.utils.decorators import *
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/networkx/utils/decorators.py", line 11, in
import re, gzip, bz2
File "/home/andres/.asdf/installs/python/3.10.4/lib/python3.10/bz2.py", line 17, in
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

Environment

inux LAPTOP-S5TPKH13 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
SHELL:
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ASDF VERSION:
v0.9.0-9ee24a3
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/home/andres/.asdf
ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master b2d06a7
php                          https://github.com/asdf-community/asdf-php.git master ab86d61
python                       https://github.com/danhper/asdf-python.git master 57ef777
rust                         https://github.com/code-lever/asdf-rust.git master 0c88f99

asdf plugins affected (if relevant)

No response

I can gather 2 pieces of information from your initial error:

  • dbt is resolving to an asdf version of python . This is good.
  • the Python lib bz2.py is expecting a module named _bz2 but couldn't find it.
  • Point 2 sounds like a missing system dependency. asdf doesn't manage dependencies, you have to follow instructions from the plugin repo for dependencies.

    A quick Google of point 2s error returns this SO Q.&A . The result of which is you need a new system dependency libbz2-dev . This lib is mentioned in #570 and as stated there, is not an issue with asdf , but that a Python lib you are using requires a system dependency you are missing.

    I am closing this as the method to "install python normally" that "operate optimally" likely installs this system dependency for you that were not manually installed during the asdf-python install.

    asdf-python uses python-build which in turn is a pyenv plugin which itself suggests installing common system libraries Python libraries use. This pyenv list of tools is shared in #570 .