question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[KED-2110] kedro viz command fails when kedro plugin with automatic hook discovery is installed

See original GitHub issue

Description

As per title, kedro viz command fails when kedro plugin with automatic hook discovery (kedro.hooks entry point) is installed (see traceback below).

Context

During the kedro viz the kedro_viz/server.py in _call_viz is getting the project context (context = get_project_context("context", env=env), line 511). This function in core Kedro is returning a deep copy of the context. Deep copy fails when calling __reduce_ex__ that’s being getattr-ed from Pluggy’s DistFacade class. DistFacade is overwriting the __getattr__ and __dir__ dunders to include _dist in it’s dictionary and I think this is where the problem lies, but I don’t know how or where to fix this or even if I’m submitting an issue in the right place. kedro viz is failing due to this issue hence I’m submitting a bug report here, but it might be as well a bug in Kedro Core or Pluggy.

I created a minimal kedro plugin and a minimal kedro project which you can use to investigate.

Steps to Reproduce

  1. git clone https://github.com/kaemo/kedro-minimal-plugin
  2. git clone https://github.com/kaemo/kedro-minimal-project
  3. cd kedro-minimal-plugin && make setup && make build
  4. cd ../kedro-minimal-project && python -m venv .venv && source .venv/bin/activate && python -m pip install kedro && kedro install && python -m pip install ../kedro-minimal-plugin/dist/kedro_minimal_plugin-0.0.1-py3-none-any.whl
  5. kedro viz

Expected Result

A web app should start and Kedro Viz app should be open in a web browser.

Actual Result

❯ kedro viz
2020-09-03 13:20:15,688 - root - INFO - Registered hooks from 1 installed plugin(s): kedro-minimal-plugin-0.0.1
Traceback (most recent call last):
  File "/Users/olszewk2/dev/kedro-minimal-project/.venv/lib/python3.8/site-packages/kedro_viz/server.py", line 468, in viz
    _call_viz(host, port, browser, load_file, save_file, pipeline, env)
  File "/Users/olszewk2/dev/kedro-minimal-project/.venv/lib/python3.8/site-packages/kedro_viz/server.py", line 511, in _call_viz
    context = get_project_context("context", env=env)
  File "/Users/olszewk2/dev/kedro-minimal-project/.venv/lib/python3.8/site-packages/kedro/framework/cli/cli.py", line 663, in get_project_context
    return deepcopy(value)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 205, in _deepcopy_list
    append(deepcopy(a, memo))
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 210, in _deepcopy_tuple
    y = [deepcopy(a, memo) for a in x]
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 210, in <listcomp>
    y = [deepcopy(a, memo) for a in x]
  File "/Users/olszewk2/miniconda3/lib/python3.8/copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: 'NoneType' object is not callable
Error: 'NoneType' object is not callable

Your Environment

  • macOS Mojave 10.14.6
  • zsh 5.8
  • Python 3.8.5
  • kedro 0.16.4
  • kedro-viz 3.4.0
  • pluggy 0.13.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
richardwestenracommented, Sep 17, 2020

@kaemo Hey sorry for the delay in responding, looks like this fell through the cracks! I’ve created a JIRA ticket to ensure that it’s escalated, and I’m going to see if we can assign this to one of our python devs to take a look at asap. Thanks for reporting!

1reaction
rodra-gocommented, Feb 5, 2021

@921kiyo , thank you for your reply! The problem was being caused by my Dockerfile, so I could fix it and now everything works fine. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[KED-2110] kedro viz command fails when kedro plugin with ...
This bug will break kedro-viz whenever there's another plugin installed that's using automatic hook discovery functionality.
Read more >
Kedro plugins — Kedro 0.18.4 documentation
Kedro plugins allow you to create new features for Kedro and inject additional commands ... You can develop hook implementations and have them...
Read more >
kedro-viz - PyPI
This will install kedro as a dependency, and add kedro viz as an additional CLI command. Kedro CLI command. To visualise your pipeline, ......
Read more >
Kedro Static Viz 0.3.0 is out with Hooks Support - Waylon Walker
Kedro viz is a fantastic kedro plugin that allows you to visualize your data pipeline. Kedro allows you to quickly build production-ready ...
Read more >
Reimagining and Rebuilding Kedro-viz for ... - YouTube
Kedro is an open-source framework for creating portable pipelines through modular data science code, and provides a powerful interactive ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found