I created a new kedro environment and ran kedro jupyter notebook to create a notebook.
Then I execute the %reload_kedro command which gave the following error:
2020-02-22 09:45:31,139 - root - ERROR - Kedro appears not to be installed in your current environment or your current IPython session was not started in a valid Kedro project.
I also executed the kedro ipython command to get the following error:
Traceback (most recent call last):
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/application/current.py", line 6, in
from contextvars import ContextVar
ModuleNotFoundError: No module named 'contextvars'
How has this bug affected you? What were you trying to accomplish?
i am unable to use jupyter notebook with kedro context
it should load the catalog entries
error
-- If you received an error, place it here.
ImportError Traceback (most recent call last)
----> 1 get_ipython().run_line_magic('reload_kedro', '')
/anaconda3/envs/python3/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2312 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2313 with self.builtin_trap:
-> 2314 result = fn(args, *kwargs)
2315 return result
2316
~/Desktop/personal/code/DataScience/kaggle_future_sales/future_sales/.ipython/profile_default/startup/00-kedro-init.py in reload_kedro(path, line)
20 try:
21 import kedro.config.default_logger
---> 22 from kedro.context import KEDRO_ENV_VAR, load_context
23 from kedro.cli.jupyter import collect_line_magic
24 except ImportError:
ImportError: cannot import name 'KEDRO_ENV_VAR' from 'kedro.context' (/anaconda3/envs/python3/lib/python3.7/site-packages/kedro/context/__init__.py)
-------------------------------------------------------------------------------
Starting a Kedro session with the following variables in scope
startup_error, context
Use the line magic %reload_kedro to refresh them
or to see the error message if they are undefined
-------------------------------------------------------------------------------
ipython
Traceback (most recent call last):
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/application/current.py", line 6, in <module>
from contextvars import ContextVar
ModuleNotFoundError: No module named 'contextvars'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/envs/future_sales/bin/ipython", line 5, in <module>
from IPython import start_ipython
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/IPython/__init__.py", line 56, in <module>
from .terminal.embed import embed
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 19, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/__init__.py", line 16, in <module>
from .application import Application
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/application/__init__.py", line 1, in <module>
from .application import Application
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 38, in <module>
from prompt_toolkit.buffer import Buffer
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/buffer.py", line 28, in <module>
from .application.current import get_app
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/application/current.py", line 8, in <module>
from prompt_toolkit.eventloop.dummy_contextvars import ContextVar # type: ignore
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/eventloop/__init__.py", line 1, in <module>
from .async_generator import generator_to_async_generator
File "/anaconda3/envs/future_sales/lib/python3.6/site-packages/prompt_toolkit/eventloop/async_generator.py", line 5, in <module>
from typing import AsyncGenerator, Callable, Iterable, TypeVar, Union
ImportError: cannot import name 'AsyncGenerator'
Include as many relevant details about the environment in which you experienced the bug:
kedro, version 0.15.5
pip show kedro or kedro -V):python -V): Python 3.6.0 :: Continuum Analytics, Inc.@madhao Are you still dealing with this issue? We're going to put it on our backlog to fix.
$ kedro ipython
In [1]: context.io.list()
Out[1]:
['example_iris_data',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
In [2]: catalog.list()
Out[2]:
['example_iris_data',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
Added a new dataset called new_dataset.
In [4]: %reload_kedro
2020-05-27 12:07:49,756 - root - INFO - ** Kedro project myproject
2020-05-27 12:07:49,756 - root - INFO - Defined global variable `context` and `catalog`
In [5]: context.io.list()
Out[5]:
['example_iris_data',
'new_dataset',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
In [6]: catalog.list()
Out[6]:
['example_iris_data',
'new_dataset',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
Using a new environment myenv.
$ kedro ipython --env myenv
In [1]: context.io.list()
...
Out[1]:
['iris_data',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
In [2]: catalog.list()
Out[2]:
['iris_data',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
Added my_dataset dataset:
In [8]: %reload_kedro
...
2020-05-27 12:26:17,647 - root - INFO - ** Kedro project myproject
2020-05-27 12:26:17,647 - root - INFO - Defined global variable `context` and `catalog`
In [9]: context.io.list()
...
Out[9]:
['iris_data',
'my_dataset',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
In [10]: catalog.list()
Out[10]:
['iris_data',
'my_dataset',
'parameters',
'params:example_test_data_ratio',
'params:example_num_train_iter',
'params:example_learning_rate']
@madhao
Do you still experience this issue?
Let me test
@madhao I also check it in jupyter notebook (running kedro jupyter notebook --env myenv) and it also works fine.
Hi I am also encountering this issue after updating Kedro from 0.15.9 to 0.16.1
I got the red line under KEDRO_ENV_VAR while opening in pycharm. Everything works fine before upgrading to 0.16.1.
I think my problem is simply I do not know how to find back the KEDRO_ENV_VAR after upgrading, may you please help to have a look? I have already google-ing for the solution for around 2 hours.
from kedro.context import KEDRO_ENV_VAR, load_context
Cannot find reference 'KEDRO_ENV_VAR' in '__init__.py'
btw sorry I'm quite new on GitHub, still improving my commenting skill.
@andrii-ivaniuk
@madhao
(kedro_env) myname@myname-MacBook-Pro introduction-kedro % kedro -version
/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/context/__init__.py:46: DeprecationWarning: All the modules in kedro.context have been moved to kedro.framework.context, and kedro.context will be removed in Kedro 0.17.0. Please update import paths from kedro.context to kedro.framework.context in your Kedro project.
DeprecationWarning,
/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/cli/__init__.py:44: DeprecationWarning: All the modules in kedro.cli have been moved to kedro.framework.cli, and kedro.cli will be removed in Kedro 0.17.0. Please update import paths from kedro.cli to kedro.framework.cli in your Kedro project.
DeprecationWarning,
Traceback (most recent call last):
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
File "
File "
File "
File "/Users/myname/Desktop/my projects ;D/introduction-kedro/kedro_cli.py", line 54, in
from kedro.context import KEDRO_ENV_VAR, load_context
ImportError: cannot import name 'KEDRO_ENV_VAR'
Traceback (most recent call last):
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
File "
File "
File "
File "/Users/myname/Desktop/my projects ;D/introduction-kedro/kedro_cli.py", line 54, in
from kedro.context import KEDRO_ENV_VAR, load_context
ImportError: cannot import name 'KEDRO_ENV_VAR'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/myname/anaconda3/envs/kedro_env/bin/kedro", line 8, in
sys.exit(main())
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 623, in main
_handle_exception(f"Cannot load commands from {kedro_cli_path}")
File "/Users/myname/anaconda3/envs/kedro_env/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 643, in _handle_exception
raise KedroCliError(msg)
kedro.framework.cli.utils.KedroCliError: Cannot load commands from /Users/myname/Desktop/my projects ;D/introduction-kedro/kedro_cli.py
alabaster 0.7.12 py36_0
anyconfig 0.9.11 pypi_0 pypi
appnope 0.1.0 pypi_0 pypi
arrow 0.15.6 pypi_0 pypi
atomicwrites 1.4.0 pypi_0 pypi
attrs 19.3.0 pypi_0 pypi
automat 20.2.0 pypi_0 pypi
azure-common 1.1.25 pypi_0 pypi
azure-storage-blob 1.5.0 pypi_0 pypi
azure-storage-common 1.4.2 pypi_0 pypi
azure-storage-file 1.4.0 pypi_0 pypi
azure-storage-queue 1.4.0 pypi_0 pypi
babel 2.8.0 py_0
backcall 0.1.0 pypi_0 pypi
binaryornot 0.4.4 pypi_0 pypi
bleach 3.1.5 pypi_0 pypi
boto3 1.13.9 pypi_0 pypi
botocore 1.16.9 pypi_0 pypi
ca-certificates 2020.1.1 0
cachetools 4.1.0 pypi_0 pypi
certifi 2020.4.5.1 py36_0
cffi 1.14.0 py36hc512035_1
chardet 3.0.4 py36_1003
click 7.1.2 pypi_0 pypi
commonmark 0.9.1 py_0
constantly 15.1.0 pypi_0 pypi
cookiecutter 1.6.0 pypi_0 pypi
coverage 5.1 pypi_0 pypi
cryptography 2.9.2 py36ha12b0ac_0
cssselect 1.1.0 pypi_0 pypi
cycler 0.10.0 pypi_0 pypi
decorator 4.4.2 pypi_0 pypi
defusedxml 0.6.0 pypi_0 pypi
docutils 0.15.2 pypi_0 pypi
entrypoints 0.3 pypi_0 pypi
flask 1.1.2 pypi_0 pypi
fsspec 0.6.3 pypi_0 pypi
future 0.18.2 py36_0
google-api-core 1.17.0 pypi_0 pypi
google-auth 1.14.3 pypi_0 pypi
google-auth-oauthlib 0.4.1 pypi_0 pypi
google-cloud-bigquery 1.24.0 pypi_0 pypi
google-cloud-core 1.3.0 pypi_0 pypi
google-resumable-media 0.5.0 pypi_0 pypi
googleapis-common-protos 1.51.0 pypi_0 pypi
hyperlink 19.0.0 pypi_0 pypi
idna 2.9 py_1
imagesize 1.2.0 py_0
importlib-metadata 1.6.0 pypi_0 pypi
incremental 17.5.0 pypi_0 pypi
ipykernel 5.2.1 pypi_0 pypi
ipython 7.14.0 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
ipywidgets 7.5.1 pypi_0 pypi
itsdangerous 1.1.0 pypi_0 pypi
jedi 0.17.0 pypi_0 pypi
jinja2 2.11.2 py_0
jinja2-time 0.2.0 pypi_0 pypi
jmespath 0.10.0 pypi_0 pypi
jsonschema 3.2.0 pypi_0 pypi
jupyter 1.0.0 pypi_0 pypi
jupyter-client 5.3.4 pypi_0 pypi
jupyter-console 6.1.0 pypi_0 pypi
jupyter-core 4.6.3 pypi_0 pypi
jupyterlab 0.31.1 pypi_0 pypi
jupyterlab-launcher 0.10.5 pypi_0 pypi
kedro 0.16.1 pypi_0 pypi
kedro-viz 3.2.0 pypi_0 pypi
kiwisolver 1.2.0 pypi_0 pypi
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20181209 hb402a30_0
libffi 3.3 h0a44026_1
lxml 4.5.0 pypi_0 pypi
markupsafe 1.1.1 py36h1de35cc_0
matplotlib 3.2.1 pypi_0 pypi
mistune 0.8.4 pypi_0 pypi
mock 4.0.2 pypi_0 pypi
more-itertools 8.2.0 pypi_0 pypi
nbconvert 5.6.1 pypi_0 pypi
nbformat 5.0.6 pypi_0 pypi
nbstripout 0.3.3 pypi_0 pypi
ncurses 6.2 h0a44026_1
notebook 6.0.3 pypi_0 pypi
numexpr 2.7.1 pypi_0 pypi
numpy 1.18.4 pypi_0 pypi
oauthlib 3.1.0 pypi_0 pypi
openssl 1.1.1g h1de35cc_0
packaging 20.3 py_0
pandas 0.25.3 pypi_0 pypi
pandas-gbq 0.13.1 pypi_0 pypi
pandocfilters 1.4.2 pypi_0 pypi
parsel 1.6.0 pypi_0 pypi
parso 0.7.0 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pip 20.0.2 py36_3
pip-tools 5.2.0 pypi_0 pypi
plotly 4.7.1 pypi_0 pypi
pluggy 0.13.1 pypi_0 pypi
poyo 0.5.0 pypi_0 pypi
prometheus-client 0.7.1 pypi_0 pypi
prompt-toolkit 3.0.5 pypi_0 pypi
protego 0.1.16 pypi_0 pypi
protobuf 3.11.3 pypi_0 pypi
ptyprocess 0.6.0 pypi_0 pypi
py 1.8.1 pypi_0 pypi
pyarrow 0.17.0 pypi_0 pypi
pyasn1 0.4.8 pypi_0 pypi
pyasn1-modules 0.2.8 pypi_0 pypi
pycparser 2.20 py_0
pydata-google-auth 1.1.0 pypi_0 pypi
pydispatcher 2.0.5 pypi_0 pypi
pygments 2.6.1 py_0
pyhamcrest 2.0.2 pypi_0 pypi
pyopenssl 19.1.0 py36_0
pyparsing 2.4.7 py_0
pyrsistent 0.16.0 pypi_0 pypi
pysocks 1.7.1 py36_0
pytest 3.10.1 pypi_0 pypi
pytest-cov 2.8.1 pypi_0 pypi
pytest-mock 1.13.0 pypi_0 pypi
python 3.6.10 hf48f09d_2
python-dateutil 2.8.0 pypi_0 pypi
python-json-logger 0.1.11 pypi_0 pypi
python-slugify 4.0.0 pypi_0 pypi
pytz 2020.1 py_0
pyyaml 5.3.1 pypi_0 pypi
pyzmq 19.0.1 pypi_0 pypi
qtconsole 4.7.4 pypi_0 pypi
qtpy 1.9.0 pypi_0 pypi
queuelib 1.5.0 pypi_0 pypi
readline 8.0 h1de35cc_0
recommonmark 0.6.0 py_0
requests 2.23.0 py36_0
requests-oauthlib 1.3.0 pypi_0 pypi
retrying 1.3.3 pypi_0 pypi
rsa 4.0 pypi_0 pypi
s3fs 0.4.0 pypi_0 pypi
s3transfer 0.3.3 pypi_0 pypi
scipy 1.4.1 pypi_0 pypi
scrapy 2.1.0 pypi_0 pypi
seaborn 0.10.1 pypi_0 pypi
selenium 3.141.0 pypi_0 pypi
semver 2.10.0 pypi_0 pypi
send2trash 1.5.0 pypi_0 pypi
service-identity 18.1.0 pypi_0 pypi
setuptools 46.1.3 py36_0
six 1.14.0 py36_0
snowballstemmer 2.0.0 py_0
sphinx 3.0.3 py_0
sphinxcontrib-applehelp 1.0.2 py_0
sphinxcontrib-devhelp 1.0.2 py_0
sphinxcontrib-htmlhelp 1.0.3 py_0
sphinxcontrib-jsmath 1.0.1 py_0
sphinxcontrib-qthelp 1.0.3 py_0
sphinxcontrib-serializinghtml 1.1.4 py_0
sqlalchemy 1.3.17 pypi_0 pypi
sqlite 3.31.1 h5c1f38d_1
tables 3.5.2 pypi_0 pypi
terminado 0.8.3 pypi_0 pypi
testpath 0.4.4 pypi_0 pypi
text-unidecode 1.3 pypi_0 pypi
tk 8.6.8 ha441bb4_0
toposort 1.5 pypi_0 pypi
tornado 6.0.4 pypi_0 pypi
traitlets 4.3.3 pypi_0 pypi
twisted 20.3.0 pypi_0 pypi
urllib3 1.25.9 pypi_0 pypi
w3lib 1.22.0 pypi_0 pypi
wcwidth 0.1.9 pypi_0 pypi
webencodings 0.5.1 pypi_0 pypi
werkzeug 1.0.1 pypi_0 pypi
wheel 0.32.2 pypi_0 pypi
whichcraft 0.6.1 pypi_0 pypi
widgetsnbextension 3.5.1 pypi_0 pypi
xlrd 1.2.0 pypi_0 pypi
xlsxwriter 1.2.8 pypi_0 pypi
xz 5.2.5 h1de35cc_0
zipp 3.1.0 pypi_0 pypi
zlib 1.2.11 h1de35cc_3
zope-interface 5.1.0 pypi_0 pypi
Hi I am also encountering this issue after updating Kedro from 0.15.9 to 0.16.1
I got the red line under KEDRO_ENV_VAR while opening in pycharm. Everything works fine before upgrading to 0.16.1.
snip
Hi @oscartse68 馃憢
This is expected from the upgrade. If you look at the RELEASE.md release notes, there's a section that lays out how to migrate your project from 0.15.9 to 0.16.1. The relevant bit here is under the section Migration for CLI and KEDRO_ENV environment variable.
Let me know if that helps!
@mzjp2 Hi thanks! It works like charm, will look at the release note before raising the question next time 馃ぃ May I ask does quantumblack provide any YouTube/learning channel for Kedro?
@mzjp2 Hi thanks! It works like charm, will look at the release note before raising the question next time 馃ぃ May I ask does quantumblack provide any YouTube/learning channel for Kedro?
@oscartse68 We're so glad that you're all sorted out on this one. I have one question and recommendation for you as a follow-up to this question you've asked.
My question is, "Why would you like to see a YouTube or video-based learning channel for Kedro?"
And then on that I would definitely recommend checking out the DataEngineerOne series on YouTube. It's a series of Kedro tutorials on different functionality done by a super user of Kedro.
@yetudada Thankyou for your reply, I am quite new in engineering and would like to kickstart my project with kedro, DataEnginerOne is definitely a great channel for beginners!
@oscartse68 This is good to know! If you think of anything that can be done to make explaining Kedro a bit easier then let us know but otherwise we hope that you enjoy DataEngineerOne. We're really big fans!
@madhao Thanks one more time for reporting this issue. We are still waiting for your feedback.
Meanwhile, I'm going to close the issue since there is no evidence that it is still relevant.
You are free to reopen the issue if you still experience the problem.