great_expectations init reports ModuleNotFoundError: No module named 'black'

Created on 19 Oct 2020  路  4Comments  路  Source: great-expectations/great_expectations

Describe the bug
When running great_expectations init in a clean python virtual environment, I'm met with the ModuleNotFoundEror: No module named 'black'. Haven't looked into the source code yet to see why black is needed in the production code... Easy fix was to simply install black, then it worked!

To Reproduce
Steps to reproduce the behavior:

  1. Run great_expectations init
  2. Output:
Traceback (most recent call last):
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/bin/great_expectations", line 5, in <module>
    from great_expectations.cli import main
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/__init__.py", line 7, in <module>
    from great_expectations.data_context import DataContext
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/data_context/__init__.py", line 1, in <module>
    from .data_context import BaseDataContext, DataContext, ExplorerDataContext
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/data_context/data_context.py", line 28, in <module>
    from great_expectations.core.usage_statistics.usage_statistics import (
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/core/usage_statistics/usage_statistics.py", line 17, in <module>
    from great_expectations.core.usage_statistics.anonymizers.anonymizer import Anonymizer
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/core/usage_statistics/anonymizers/anonymizer.py", line 4, in <module>
    from great_expectations.util import load_class
  File "/Users/hugohjerten/Documents/kday/great_expectations/.venv/lib/python3.8/site-packages/great_expectations/util.py", line 12, in <module>
    import black
ModuleNotFoundError: No module named 'black'

Expected behavior
Not to crash.

Environment (please complete the following information):

  • OS: MacOs Catalina 10.15.7
  • python: 3.8.5 (using pyenv)
  • poetry version: 1.1.3
  • GE Version: 0.12.5

Trying out the library for the first time; I'm excited and have high hopes! :)

bug core-team-priority stale

Most helpful comment

@eugmandel I strongly recommend that you use poetry to manage your project dependencies, as well as for publishing your project. Using poetry would eliminate the possibility of publishing a new version with an incomplete requirements.txt...

All 4 comments

Thank you for reporting this, @hugohjerten! We will add black (code linter) into the requirements in the next minor release. It is used to make the auto-generated code prettier. In the meantime, you can pip install black in your environment.

@eugmandel -
The black package is only used in one function in utils and that function is only used in 2 locations.

Black creates a lot of log noise when starting up and is a pretty heavy package to use for just linting. It should be made an optional import in utils

Since the import is in the utils file, anything that accesses anything in utils ends up importing it.

@eugmandel I strongly recommend that you use poetry to manage your project dependencies, as well as for publishing your project. Using poetry would eliminate the possibility of publishing a new version with an incomplete requirements.txt...

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?\n\nThis issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings