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

Python3.7 system installation raises: ImportError: cannot import name 'SerializableEncoder' from 'mashumaro.types' #3143

Closed
czardien opened this issue Mar 3, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@czardien
Copy link

czardien commented Mar 3, 2021

Describe the bug

After installation from source guide: https://docs.getdbt.com/dbt-cli/installation#install-from-source, running dbt --help raises:

Traceback (most recent call last):
  File "/home/adrien/.local/bin/dbt", line 11, in <module>
    load_entry_point('dbt-core==0.19.0', 'console_scripts', 'dbt')()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2862, in load_entry_point
    return ep.load()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2462, in load
    return self.resolve()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2468, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/main.py", line 2, in <module>
    from dbt.logger import GLOBAL_LOGGER as logger, log_cache_events, log_manager
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/logger.py", line 16, in <module>
    from dbt.dataclass_schema import dbtClassMixin
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/dataclass_schema.py", line 13, in <module>
    from mashumaro.types import SerializableEncoder, SerializableType
ImportError: cannot import name 'SerializableEncoder' from 'mashumaro.types' (/home/adrien/.local/lib/python3.7/site-packages/mashumaro/types.py)

Steps To Reproduce

With a python3.7 package, follow installation from source guide at: https://docs.getdbt.com/dbt-cli/installation#install-from-source:

$ cd /tmp
$ git clone https://github.com/fishtown-analytics/dbt
$ cd dbt
$ python3.7 -m ensurepip && python3.7 -m pip install --upgrade pip
$ python3.7 -m pip install -r requirements.txt
$ dbt --help

... should raise the above error.

Expected behavior

dbt --help

... shouldn't raise an error.

Screenshots and log output

The operating system you're using:
Linux host 5.11.2-arch1-1 #1 SMP PREEMPT Fri, 26 Feb 2021 18:26:41 +0000 x86_64 GNU/Linux

The output of python --version: python 3.7.9

Additional context

I'm not using a virtual environment as advised in the docs because I don't mind but I didn't think it would be a problem. From a virtual environment and install dbt directly everything is fine:

$ python3.7 -m venv venv
$ venv/bin/pip install dbt 
$ venv/bin/dbt --version
installed version: 0.19.0
   latest version: 0.19.0

Up to date!

Plugins:
  - bigquery: 0.19.0
  - snowflake: 0.19.0
  - postgres: 0.19.0
  - redshift: 0.19.0

Another point is that I couldn't find the class SerializableEncoder imported at: dataclass_schema.py in mashumaro.types.py, with:

$ python3.7 -m pip show mashumaro
Name: mashumaro
Version: 2.0
Summary: Fast serialization framework on top of dataclasses
Home-page: https://github.com/Fatal1ty/mashumaro
Author: Alexander Tikhonov
Author-email: random.gauss@gmail.com
License: Apache License, Version 2.0
Location: /home/adrien/.local/lib/python3.7/site-packages
Requires: msgpack, pyyaml, typing-extensions
Required-by:
@czardien czardien added bug Something isn't working triage labels Mar 3, 2021
@czardien czardien changed the title Python3.7 installation from source raises: ImportError: cannot import name 'SerializableEncoder' from 'mashumaro.types' Python3.7 system installation raises: ImportError: cannot import name 'SerializableEncoder' from 'mashumaro.types' Mar 3, 2021
@czardien
Copy link
Author

czardien commented Mar 3, 2021

Just pointing out that I also get the error from a regular system-wide pip install with python3.7, i.e. not from the source:

$ python3.7 -m ensurepip && python3.7 -m pip install dbt
$ dbt --help
Traceback (most recent call last):
  File "/home/adrien/.local/bin/dbt", line 11, in <module>
    load_entry_point('dbt-core==0.19.0', 'console_scripts', 'dbt')()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2862, in load_entry_point
    return ep.load()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2462, in load
    return self.resolve()
  File "/home/adrien/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2468, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/main.py", line 2, in <module>
    from dbt.logger import GLOBAL_LOGGER as logger, log_cache_events, log_manager
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/logger.py", line 16, in <module>
    from dbt.dataclass_schema import dbtClassMixin
  File "/home/adrien/.local/lib/python3.7/site-packages/dbt/dataclass_schema.py", line 13, in <module>
    from mashumaro.types import SerializableEncoder, SerializableType
ImportError: cannot import name 'SerializableEncoder' from 'mashumaro.types' (/home/adrien/.local/lib/python3.7/site-packages/mashumaro/types.py)

@kwigley
Copy link
Contributor

kwigley commented Mar 3, 2021

hey @czardien, sorry about this. The develop branch of dbt, which is also set as the default branch, is unstable at the moment and it is unable to be installed from source without also installing the dependencies listed in dev_requirements.txt (pip install -r dev_requirements.txt). We are aware of this and will be resolved once #3138 is merged. (which should hopefully be soon!)

As for #3143 (comment), I believe this is related to the previous attempt to install dbt from source. Please uninstall dbt completely first or pass --force-reinstall (python3.7 -m pip install dbt --force-reinstall) Hope this helps! Closing this issue for now, as #3138 should resolve this.

@kwigley kwigley closed this as completed Mar 3, 2021
@kwigley kwigley removed the triage label Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants