kedro-org / kedro

Kedro is a toolbox for production-ready data science. It uses software engineering best practices to help you create data engineering and data science pipelines that are reproducible, maintainable, and modular.
https://kedro.org
Apache License 2.0
9.92k stars 901 forks source link

[KED-882] Jupyterlab naming collision using text file tooltips #58

Closed marcusinthesky closed 5 years ago

marcusinthesky commented 5 years ago

Description

When editing .py text files with an attached console using kedro jupyter lab the kernel used by the console will continually restart when trying to autocompletion and tooltips, during spaceflight tutorial. This is because of the tutorial requiring creating an io module.

Context

I was trying to edit python text files and was wondering why the console attached to the file was constantly dying when I was trying to make use of tooltips (shift + tab). Having read up on the issues I believe its because

Steps to Reproduce

  1. Run kedro jupyter lab (jupyterlab==1.0.2)
  2. Open a .py text file
  3. Open console by right-clicking
  4. Try getting a tooltip for any arbitrary function like print() usign shift+tab

Expected Result

Tell us what should happen.

Actual Result

Tell us what happens instead.

`[I 19:34:54.854 LabApp] KernelRestarter: restarting kernel (4/5), new random ports
Fatal Python error: init_sys_streams: can't initialize sys standard streams
AttributeError: module 'io' has no attribute 'OpenWrapper'

Current thread 0x00007fd301fbe740 (most recent call first):
[W 19:34:57.874 LabApp] KernelRestarter: restart failed
[W 19:34:57.875 LabApp] Kernel c1a79a1c-6ec1-44fb-b5c4-f18e6156ee19 died, removing from map.

Your Environment

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

yetudada commented 5 years ago

@marcusinthesky Firstly, I'm super amped that you're at UCT 🇿🇦!

Secondly, I've placed this bug report onto our backlog to get addressed. In the meanwhile, you can check out a completed version of the tutorial project in kedro-examples.

And, thirdly, you should also check out kedro-viz and visualise the pipeline when you're ready.

Flid commented 5 years ago

Hi @marcusinthesky! I'm trying to reproduce the issue, no luck so far. But it really looks like the conflict between the original io module and something in kedro or your project. I can do just

touch io.py
kedro jupyter lab

And it fails to start with the same error.

Can you please check your code, is there a module called io anywhere?

What does python -c 'import io; print(io.__file__)' print?

lorenabalan commented 5 years ago

I've updated the PR title with our internal ticket number to keep track of this more easily. :)

921kiyo commented 5 years ago

@marcusinthesky It is likely that global io variable in ipython config file was causing the problem, which we deleted in https://github.com/quantumblacklabs/kedro/commit/571bb8009b930e67c073115c23ae2d03942f6499#diff-5e39d56e37d29581584e70f13c8c607fL14 with the replacement of context variable. I am closing this issue for now, but feel free to re-open it if you are still having the problem.