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

kedro visualisation won't work from within Jupyter #737

Closed
1 task
eepgwde opened this issue Feb 10, 2022 · 3 comments
Closed
1 task

kedro visualisation won't work from within Jupyter #737

eepgwde opened this issue Feb 10, 2022 · 3 comments
Assignees

Comments

@eepgwde
Copy link

eepgwde commented Feb 10, 2022

Description

From within jupyter

kedro jupyter lab

Context

Visualisation of pipelines. I can not use kedro viz from the command line, nor from within Jupyter.
Once I did manage to get it to run from within Jupyter, but I have not managed since then.

Steps to Reproduce

I'm stuck with a remote system. I have tried a demo version on my local machine.

  1. kedro jupyter lab - I'm able to use my forwarded port. I don't forward 4141 or 4142.
  2. Start a vkh kernel
  3. Try the line magic %run_viz

I have tried forwarding ports 4141 and 4142 but no difference.
There are no processes on 4141 and 4142

Expected Result

I hoping to see a visualisation appear in the web-browser

Actual Result

The following errors.

This appear within one second

/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro/framework/context/context.py:32: DeprecationWarning: Accessing package_name via the context will be deprecated in Kedro 0.18.0.
  warn(
Process Process-1:
Traceback (most recent call last):
  File "/home/share/conda/envs/vega/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/share/conda/envs/vega/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro_viz/server.py", line 75, in run_server
    catalog, pipelines, session_store_location = kedro_data_loader.load_data(
  File "/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro_viz/integrations/kedro/data_loader.py", line 59, in load_data
    with KedroSession.create(
  File "/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro/framework/session/session.py", line 282, in __enter__
    _activate_session(self)
  File "/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro/framework/session/session.py", line 57, in _activate_session
    raise RuntimeError(
RuntimeError: Cannot activate the session as another active session already exists.
---------------------------------------------------------------------------
WaitForException                          Traceback (most recent call last)
/var/tmp/ipykernel_2710/2501415936.py in <module>
----> 1 get_ipython().run_line_magic('run_viz', '')

/home/share/conda/envs/vega/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2346                 kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2347             with self.builtin_trap:
-> 2348                 result = fn(*args, **kwargs)
   2349             return result
   2350 

/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro_viz/launchers/jupyter.py in run_viz(port, line, local_ns)
    131     _VIZ_PROCESSES[port] = viz_process
    132 
--> 133     _wait_for(func=_check_viz_up, port=port)
    134 
    135     wrapper = """

/home/share/conda/envs/vega/lib/python3.8/site-packages/kedro_viz/launchers/jupyter.py in _wait_for(func, expected_result, timeout, print_error, sleep_for, **kwargs)
     65         sleep(sleep_for)
     66 
---> 67     raise WaitForException(
     68         f"func: {func}, didn't return {expected_result} within specified timeout: {timeout}"
     69     )

WaitForException: func: <function _check_viz_up at 0x7fcf58ed48b0>, didn't return True within specified timeout: 10

Your Environment

Include as many relevant details as possible about the environment you experienced the bug in:

  • Web browser system and version: Not applicable yet
  • Operating system and version:
    Linux ip-10-136-18-153.eu-west-1.compute.internal 4.14.256-197.484.amzn2.x86_64 Inclusion of Code of Conduct & Release Log #1 SMP Tue Nov 30 00:17:50 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • NodeJS version used (if relevant): n/a
  • Kedro version used (if relevant):
    2022-02-10 12:14:45,402 - kedro.framework.cli.hooks.manager - INFO - Registered CLI hooks from 1 installed plugin(s): kedro-telemetry-0.1.2
    kedro, version 0.17.6
  • Python version used (if relevant):
    which python
    /home/share/conda/envs/vega/bin/python
    (vega) walter-eaves@ip-10-136-18-153:/home/share/conda/envs/vega/lib/python3.8/site-packages
    1187$ python -V
    Python 3.8.12

pip

pip list --verbose | grep kedro
kedro 0.17.6 /home/share/conda/envs/vega/lib/python3.8/site-packages pip
kedro-telemetry 0.1.2 /home/share/conda/envs/vega/lib/python3.8/site-packages pip
kedro-viz 4.3.1 /home/share/conda/envs/vega/lib/python3.8/site-packages pip

Checklist

  • visualisation jupyter
@limdauto
Copy link
Collaborator

Hello, this is another symptom of #736 -- if you downgrade to kedro-viz==4.0.0 it should work. Will patch this in the next version.

@tynandebold
Copy link
Member

We'll assume the fix for #811 will solve this issue.

@antonymilne
Copy link
Contributor

Thanks for reporting this @eepgwde. I can confirm that this was actually a Kedro rather than Kedro-Viz bug, and it's fixed in 0.18.1. If for some reason you can't upgrade Kedro then calling session.close() in your Jupyter notebook before doing %run_viz will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants