[KED-2110] kedro viz command fails when kedro plugin with automatic hook discovery is installed
See original GitHub issueDescription
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
git clone https://github.com/kaemo/kedro-minimal-plugin
git clone https://github.com/kaemo/kedro-minimal-project
cd kedro-minimal-plugin && make setup && make build
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
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:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top GitHub Comments
@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!
@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!