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

ContextualVersionConflict Error Stop Kedro running when dependency clashes #1487

Closed
rashidakanchwala opened this issue Apr 26, 2022 · 7 comments · Fixed by #1542
Closed

ContextualVersionConflict Error Stop Kedro running when dependency clashes #1487

rashidakanchwala opened this issue Apr 26, 2022 · 7 comments · Fixed by #1542
Assignees
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed

Comments

@rashidakanchwala
Copy link
Contributor

rashidakanchwala commented Apr 26, 2022

Description

ContextualVersionConflict error arises on two ocassions when using Kedro :-

  • when you install a Kedro plug-in with a dependency that clashes with a kedro, or a kedro-viz dependency
  • when you do %reload_kedro on Databricks

Steps to Reproduce on Databricks

  1. clone a kedro project on github
  2. make sure you have kedro-viz installed on Databricks in the same place as kedro (i.e. Cluster Library or using pip command)
  3. load kedro IPython extension
  4. try using %reload_kedro. line magic command

Steps to Reproduce outside Databricks

  1. for a kedro-plugin, in the setup.py add to install_requires a dependency that clashes with kedro
  2. pip install the kedro-plugin
  3. do a kedro run when in the project folder

Actual Result

image (4)

Expected Result

Instead of an error message which breaks Kedro, it should just display a warning maybe?

Your Environment

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

  • Kedro version used (pip show kedro or kedro -V): 0.18
  • Python version used (python -V): 3.8
  • Operating system and version: Linux
@rashidakanchwala
Copy link
Contributor Author

@AntonyMilneQB - please review.

@noklam
Copy link
Contributor

noklam commented Apr 29, 2022

I think this shows up even when we do kedro or any kedro xxx commands, I am not 100% sure if it raise the same ContextualVersionConflictError, but it is definitely related to the dependencies conflict.

@noklam
Copy link
Contributor

noklam commented Apr 29, 2022

I can reproduce the error with these steps.

conda create -n test python==3.8.5
conda activate test
pip install kedro kedro-viz
pip install pip==21.0.0
kedro new
conda create -n test python==3.8.5
conda activate test
pip install kedro kedro-viz
pip install plotly<4.0 # kedro-viz requires >=4.0
kedro new

pip version shouldn't really matter if we already have the library installed, nonetheless it still crash the program and prevent it runs.

    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pip 21.0 (/Users/Nok_Lam_Chan/miniconda3/envs/test/lib/python3.8/site-packages), Requirement.parse('pip>=21.2'), {'pip-tools'})

@noklam noklam added Issue: Bug Report 🐞 Bug that needs to be fixed Component: CLI Issue/PR that addresses the CLI for Kedro Component: Framework Issue/PR that addresses core framework functionality and removed Component: CLI Issue/PR that addresses the CLI for Kedro Component: Framework Issue/PR that addresses core framework functionality labels Apr 29, 2022
@noklam
Copy link
Contributor

noklam commented Apr 29, 2022

@rashidakanchwala Is this a Databricks specific issue or it would happen locally too?

@noklam noklam changed the title ContextualVersionConflict Error ContextualVersionConflict Error Stop Kedro running when dependency clashes Apr 29, 2022
@antonymilne
Copy link
Contributor

This is indeed not a databricks (or kedro-viz) specific issue, but rather something related to plugins in general.

I believe the solution would be to change these lines

try:
entry_point_commands.append(entry_point.load())
except Exception as exc:
raise KedroCliError(f"Loading {name} commands from {entry_point}") from exc

to instead catch the error and emit a warning rather than throw a KedroCliError. There might be other places in the codebase where we should make the same change (e.g. _init_plugins).

@noklam noklam self-assigned this May 12, 2022
@noklam
Copy link
Contributor

noklam commented May 12, 2022

Have a quick look this morning, maybe tricker than I thought. Seems like this is not the only way the entrypoint is loaded, the USER/env/bin/kedro also loads the entry point. Will share more details later.

@antonymilne
Copy link
Contributor

@noklam Could you explain that a bit more? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed
Projects
None yet
3 participants