简体   繁体   中英

How to install DBT CLI on GCP?

I've installed DBT CLI on GCP cloud shell using pip install dbt after that I had added the path to dbt in my.profile file too -

.profile file -

if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$HOME/.local/lib/python3.9/site-packages:$PATH"
fi

export $PATH

After the above steps, now when I test the commands like - dbt --version it gives below error -

my_name@cloudshell:~$ dbt --init
Traceback (most recent call last):
  File "/home/my_name/.local/bin/dbt", line 5, in <module>
    from dbt.main import main
  File "/home/my_name/.local/lib/python3.9/site-packages/dbt/main.py", line 11, in <module>
    import dbt.version
  File "/home/my_name/.local/lib/python3.9/site-packages/dbt/version.py", line 11, in <module>
    import dbt.semver
  File "/home/my_name/.local/lib/python3.9/site-packages/dbt/semver.py", line 8, in <module>
    import dbt.utils
  File "/home/my_name/.local/lib/python3.9/site-packages/dbt/utils.py", line 9, in <module>
    import jinja2
  File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.9/dist-packages/markupsafe/__init__.py)

Where have I failed? Can anyone please correct me?

Try pip install dbt-[adapter] (eg dbt-bigquery ) which will install the latest version of dbt, rather than the pre-1.0 version you're getting now (which has become broken due to an issue with a dependency).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM