My kedro project is created using Kedro 0.15.9.
I recently upgraded kedro using pip install kedro==0.16.0.
However, I got ImportError: cannot import name 'KEDRO_ENV_VAR' after I run kedro info.
Here is the detailed error message:
~/.pyenv/versions/3.6.6/envs/kedro-mlflow/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,
~/.pyenv/versions/3.6.6/envs/kedro-mlflow/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 "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "~/.pyenv/versions/3.6.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/myProject/kedro_cli.py", line 54, in <module>
from kedro.context import KEDRO_ENV_VAR, load_context
ImportError: cannot import name 'KEDRO_ENV_VAR'
Traceback (most recent call last):
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "~/.pyenv/versions/3.6.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/myProject/kedro_cli.py", line 54, in <module>
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 "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/bin/kedro", line 8, in <module>
sys.exit(main())
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/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 "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/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 /myProject/kedro_cli.py
Include as many relevant details about the environment in which you experienced the bug:
pip show kedro or kedro -V): pip install kedro==0.16.0python -V): 3.6.6Hello @zhangchi1 馃憢
Thanks for raising the issue. This is the expected behaviour. Kedro 0.16 is a breaking change from 0.15, and documented in the breaking changes section of the RELEASE.md notes. The notes also have the migration steps to help you migrate your project and fix the error you鈥檙e seeing.
As the notes mention, it might just be easier for you to regenerate a new template and copy your conf, data and pipelines over instead of doing all the code changes yourself, if you haven鈥檛 made serious customisations to the project template yourself.
Most helpful comment
Hello @zhangchi1 馃憢
Thanks for raising the issue. This is the expected behaviour. Kedro 0.16 is a breaking change from 0.15, and documented in the breaking changes section of the
RELEASE.mdnotes. The notes also have the migration steps to help you migrate your project and fix the error you鈥檙e seeing.As the notes mention, it might just be easier for you to regenerate a new template and copy your
conf,dataandpipelines over instead of doing all the code changes yourself, if you haven鈥檛 made serious customisations to the project template yourself.