0

I'm new to kedro and I have a problem when opening Jupyter Lab/Notebook from Kedro using the command kedro jupyter lab. The error was:

TypeError: Can't instantiate abstract class ProjectContext with abstract methods project_name, project_version Run with --verbose to see the full exception Error: Unable to load Kedro context with environment None. Make sure it exists in the project configuration. Error: Can't instantiate abstract class ProjectContext with abstract methods project_name, project_version

I have been following the steps in kedro official docs website , but didn't succeed. For replication purpose, here are the steps I performed:

  1. Create new conda environment: conda create --name myenv
  2. Activate the environment: source activate myenv
  3. Create new kedro project with pyspark starter: kedro new --starter=pyspark
  4. Go to newly created project folder: cd my_project
  5. Install requirements: kedro install
  6. Open jupyter lab: kedro jupyter lab --no-browser

Step 6 where gave me the error. As a side note, I had to do point 5 twice because the first time gave me incompatible error, but then I executed it again and it works.

Sorry in advance if I didn't put too much detail as this is the first time asking in stackoverflow. Feel free to ask any details you need, I'll be gladly to answer them.

Thank you.

1 Answers1

0

I was unable to reproduce the problem when following your steps, however I noticed that some important steps were missing from your journey. This is what works for me:

  1. Create new conda environment: conda create --name myenv **python=3.6**
  2. Activate the environment: conda activate myenv
  3. Install Kedro in myenv: pip install kedro
  4. Create new kedro project with pyspark starter: kedro new --starter=pyspark
  5. Go to the newly created project folder: cd my_project
  6. Install requirements: kedro install
  7. Open jupyter lab: kedro jupyter lab --no-browser

For step 1, it is important to be specific about the Python version, since Anaconda can create a Python environment not supported by Kedro by default without you realising.

And step 3 is needed, because if you have Kedro installed in your base Anaconda environment, but you try to use it in your currently selected environment, you might experience some hard to debug problems. Note that this is not something specific to Kedro, but to Anaconda - I've seen people biten by this many times when using pylint and forgetting to install it in their new environment.

I hope this can help you recreate your project successfully.

idanov
  • 136
  • 1
  • 6
  • Thank you for your response, however it is still not working for me when I tried your proposed solution. Did you also have incompatibility issues when doing `kedro install` ? It's weird because making a new environment creates a blank environment but somehow it's got this incompatibility issue. Would you mind showing me what are packages in your requirements.txt initially? Thank you. – Adam Ginza Sep 23 '20 at 02:13
  • If conda's environment is installed correctly (with the correct python version) and kedro is installed in it, there should be no compatibility issues. From what I hear, I can only guess that there might be something wrong with your Kedro installation. Could you please double check that you have the correct python version, and your kedro executable is pointing to the correct environment? You can do that with calling `which kedro`, `which python`, `python -V` and `kedro -V` (to ensure you have the correct versions). What OS are you using? – idanov Sep 23 '20 at 12:43
  • Just managed to reproduce incompatibilities in the dependencies when running `kedro install` and those dependencies are for `pytest`. Do you get the same? If so, the way to resolve this is to look at `src/requirements.in` and remove the upper boundary for the `pytest` version and then run `kedro install` again and that should resolve it. If that doesn't fix it for you, do you mind sharing what error message you get here? – idanov Sep 23 '20 at 13:46