DBT CLI messed up

The problem I’m having

My dbt stopped working in VS Code all of a sudden. This is the error message I’m getting

The context of why I’m trying to do this

What I’ve already tried

Some example code or error messages

Put code inside backticks
  to preserve indentation
    which is especially important 
      for Python and YAML! 

This doesn’t look like the full error/stack trace - the bottom line is cut off at least. Please post the whole error as text inside of backticks, not as an image

1 Like
PS C:\Users\xxxxx\source\Snowflake\dbt\ccbcc_dbt> dbt --version
Traceback (most recent call last):
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\Scripts\dbt.exe\__main__.py", line 4, in <module>
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\main.py", line 23, in <module>
    import dbt.task.build as build_task
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\task\build.py", line 1, in <module>
    from .run import RunTask, ModelRunner as run_model_runner
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\task\run.py", line 8, in <module>
    from .compile import CompileRunner, CompileTask
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\task\compile.py", line 3, in <module>
    from .runnable import GraphRunnableTask
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\task\runnable.py", line 17, in <module>
    from dbt.task.base import ConfiguredTask
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\task\base.py", line 47, in <module>
    from dbt.adapters.factory import register_adapter
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\adapters\factory.py", line 14, in <module>
    from dbt.adapters.protocol import (
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\adapters\protocol.py", line 27, in <module>
    from dbt.graph import Graph
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\graph\__init__.py", line 1, in <module>
    from .selector_spec import (  # noqa: F401
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\graph\selector_spec.py", line 8, in <module>
    from .graph import UniqueId
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\dbt\graph\graph.py", line 3, in <module>
    import networkx as nx  # type: ignore
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\networkx\__init__.py", line 115, in <module>
    import networkx.readwrite
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\networkx\readwrite\__init__.py", line 15, in <module>
    from networkx.readwrite.graphml import *
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\networkx\readwrite\graphml.py", line 314, in <module>
    class GraphML(object):
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\networkx\readwrite\graphml.py", line 346, in GraphML
    (np.int, "int"), (np.int8, "int"),
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
1 Like

Thank you! It’s odd that it’s a numpy error - just to be sure, you’re not trying to create a dbt Python model, right? That’s the only reason I could think that user-generated code would lead to a numpy error, and even that shouldn’t interfere with dbt --version.

Do you have dbt installed into a virtual environment? It doesn’t look like it, and I’m wondering whether you’ve installed a new version of numpy for a different project, and that’s led to conflicts.

I would encourage you to create a new virtual environment (aka venv) and install dbt into that, and use it when developing dbt code.

For help with this, check out What are the best practices for installing dbt Core with pip? | dbt Developer Hub

I initially created a virtual environment that uses Python 1.3 to run the python models, since my default dbt version was 1.1 (dbt cloud is also using version 1.1), that uses dbt non python models. However, I deleted the virtual environment and when I try to run the .sql files in my default environment i.e., Version 1.1 I’m getting an error as shared in my earlier message. Is there a way to fix my default version without even creating a virtual environment with 1.1 version?

Thanks for clarifying! The point of venvs is meant to be that changes in one project don’t impact the others, but it sounds as though maybe there has been some collateral damage.

I would suggest trying to create a venv with 1.1 and see what happens, as I think that’ll be the easiest way of working around the issue and I don’t know enough about Python internals to have a different idea :grimacing: