Search code examples
pythongoogle-cloud-platformjupyter-notebooktensorflow-transformgcp-ai-platform-notebook

How to install tensorflow-transform on a Google Cloud Deep Learning VM?


In a notebook, when I run

!pip3 install tensorflow-transform==0.15.0

I receive an error:

Collecting tensorflow-transform==0.15.0
  Using cached https://files.pythonhosted.org/packages/34/88/9ee55045a1ffbf44fb75b10a30c54609f58987987f69ace9b971938e750d/tensorflow-transform-0.15.0.tar.gz
Requirement already satisfied: absl-py<0.9,>=0.7 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Requirement already satisfied: apache-beam[gcp]<3,>=2.16 in ./.local/lib/python3.5/site-packages (from tensorflow-transform==0.15.0)
Requirement already satisfied: numpy<2,>=1.16 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Requirement already satisfied: protobuf<4,>=3.7 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Requirement already satisfied: pydot<2,>=1.2 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Requirement already satisfied: six<2,>=1.10 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Collecting tensorflow-metadata<0.16,>=0.15 (from tensorflow-transform==0.15.0)
  Using cached https://files.pythonhosted.org/packages/bd/00/f353385e40f7962b63b94d17f7050b5853bc20c243483cff0cb3da03d206/tensorflow_metadata-0.15.1-py2.py3-none-any.whl
Requirement already satisfied: tensorflow<2.2,>=1.15 in /usr/local/lib/python3.5/dist-packages (from tensorflow-transform==0.15.0)
Collecting tfx-bsl<0.16,>=0.15 (from tensorflow-transform==0.15.0)
  Could not find a version that satisfies the requirement tfx-bsl<0.16,>=0.15 (from tensorflow-transform==0.15.0) (from versions: )
No matching distribution found for tfx-bsl<0.16,>=0.15 (from tensorflow-transform==0.15.0)

This is the error when run in a Notebook instance.

Note I am using

tensorflow==2.0.0
tensorflow-estimator==2.0.0
tensorflow-hub==0.6.0
tensorflow-probability==0.7.0
tensorflow-serving-api==1.14.0
apache-beam==2.16.0

Solution

  • This can happen with older pip versions that apparently do not recognize the tfx-bsl wheel as compatible.

    I had the same issue and got it resolved just updating pip:

    sudo pip3 install --upgrade pip
    

    (Of course best would be to already have a later pip in the source image of the notebook itself.)