首页 > 解决方案 > great_expectations 和scrapy

问题描述

当我使用一个带有great_expectations 和scrapy 的项目时,似乎有一些错误会以某种方式发生冲突。

当我卸载这两个库中的任何一个时,一切正常,但同时使用这两个库时会出现一些错误。

这是我的堆栈跟踪,但我无法弄清楚根本原因是什么,任何帮助都会很棒:

Retrieving local flow... Error
  Traceback (most recent call last):
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/prefect/cli/run.py", line 75, in try_error_done
    yield
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/prefect/cli/run.py", line 564, in run
    flow = get_flow_from_path_or_module(path=path, module=module, name=name)
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/prefect/cli/run.py", line 173, in get_flow_from_path_or_module
    flows = load_flows_from_script(path) if path else load_flows_from_module(module)
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/prefect/cli/run.py", line 121, in load_flows_from_script
    namespace = runpy.run_path(path, run_name="<flow>")
    File "/usr/local/Caskroom/miniconda/base/lib/python3.8/runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
    File "/usr/local/Caskroom/miniconda/base/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
    File "/usr/local/Caskroom/miniconda/base/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
    File "flows/greyhound_recorder/dog_gender_scraper_flow.py", line 3, in <module>
    from flows.greyhound_recorder.tasks import (
    File "/Users/user/code/es-scraping-flows/flows/greyhound_recorder/tasks.py", line 3, in <module>
    from flows.greyhound_recorder.functions import (
    File "/Users/user/code/es-scraping-flows/flows/greyhound_recorder/functions.py", line 3, in <module>
    from flows.common.functions import query_db_for_df
    File "/Users/user/code/es-scraping-flows/flows/common/functions.py", line 6, in <module>
    from python.data_validation.expectations import Expectations
    File "/Users/user/code/es-scraping-flows/python/data_validation/expectations.py", line 3, in <module>
    import great_expectations as ge
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/__init__.py", line 7, in <module>
    from great_expectations.data_context import DataContext
    File "/Users/user/code/es-scraping-flows/.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/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/data_context/data_context.py", line 38, in <module>
    from great_expectations.core.usage_statistics.usage_statistics import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/core/usage_statistics/usage_statistics.py", line 21, in <module>
    from great_expectations.core.usage_statistics.anonymizers.data_docs_site_anonymizer import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/core/usage_statistics/anonymizers/data_docs_site_anonymizer.py", line 2, in <module>
    from great_expectations.core.usage_statistics.anonymizers.site_builder_anonymizer import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/core/usage_statistics/anonymizers/site_builder_anonymizer.py", line 2, in <module>
    from great_expectations.render.renderer.site_builder import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/render/renderer/__init__.py", line 2, in <module>
    from .column_section_renderer import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/render/renderer/column_section_renderer.py", line 15, in <module>
    from great_expectations.expectations.core.expect_column_kl_divergence_to_be_less_than import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/expectations/core/__init__.py", line 1, in <module>
    from .expect_column_distinct_values_to_be_in_set import (
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/expectations/core/expect_column_distinct_values_to_be_in_set.py", line 16, in <module>
    from ..expectation import ColumnExpectation, InvalidExpectationConfigurationError
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/expectations/expectation.py", line 1042, in <module>
    class TableExpectation(Expectation, ABC):
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/expectations/expectation.py", line 76, in __new__
    newclass._register_renderer_functions()
    File "/Users/user/code/es-scraping-flows/.venv/lib/python3.8/site-packages/great_expectations/expectations/expectation.py", line 151, in _register_renderer_functions
    attr_obj = getattr(cls, candidate_renderer_fn_name)
  AttributeError: __provides__

标签: pythonscrapygreat-expectations

解决方案


推荐阅读