model-card-toolkit icon indicating copy to clipboard operation
model-card-toolkit copied to clipboard

Unable to install model-card-toolkit in Colab

Open swsachith opened this issue 2 years ago • 1 comments

Expected Behavior

First cell of both example notebooks: https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb

fails to install the model-card-toolkit package.

Actual Behavior

fails to install the toolkit.

Steps to Reproduce the Problem

  1. Run the first cells of both notebooks on colab.

Error attached below.

Specifications

  • Version: latest
  • Platform: colab

ERROR: Cannot install model-card-toolkit==1.0.0, model-card-toolkit==1.1.0, model-card-toolkit==1.2.0, model-card-toolkit==1.3.0, model-card-toolkit==1.3.1, model-card-toolkit==1.3.2 and model-card-toolkit==2.0.0 because these package versions have conflicting dependencies.

The conflict is caused by: model-card-toolkit 2.0.0 depends on tensorflow-data-validation<2.0.0 and >=1.5.0 model-card-toolkit 1.3.2 depends on ml-metadata<1.6.0 and >=1.5.0 model-card-toolkit 1.3.1 depends on ml-metadata<1.6.0 and >=1.5.0 model-card-toolkit 1.3.0 depends on ml-metadata<1.6.0 and >=1.5.0 model-card-toolkit 1.2.0 depends on ml-metadata<1.6.0 and >=1.5.0 model-card-toolkit 1.1.0 depends on ml-metadata<1.3.0 and >=1.2.0 model-card-toolkit 1.0.0 depends on ml-metadata<0.27.0 and >=0.26.0

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

swsachith avatar Jun 09 '23 20:06 swsachith

Thank you for reporting this issue, @swsachith! Colab recently updated to Python 3.10, and some TensorFlow extended libraries don't support this version of Python yet.

Here's the recommended workaround (source):

  1. Run this code in a cell at the top of your notebook to set up an older Python version:

    %%shell
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3
    curl -O https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
    
  2. In another cell, symlink the google.colab package so that it's on the path of the Python version you want to use:

    !mkdir /usr/local/lib/python3.8/dist-packages/google
    !ln -s /usr/local/lib/python3.10/dist-packages/google/colab /usr/local/lib/python3.8/dist-packages/google/colab
    
  3. Install the packages and restart your runtime.

In the meantime, you can follow https://github.com/tensorflow/tfx/issues/5897 for updates on when this will be fixed.

codesue avatar Jun 10 '23 12:06 codesue