opendatahub-io / notebooks

Notebook images for ODH
Apache License 2.0
17 stars 55 forks source link

fix tensorflow rocm resolution by installing it from .whl file #609

Closed atheo89 closed 2 months ago

atheo89 commented 2 months ago

Related to: https://issues.redhat.com/browse/RHOAIENG-9596

Description

We have the following error in ocp-ci and locally, when we try to fetch the tensorflow python package from repo url. :

Looking in indexes: https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1/
ERROR: Could not find a version that satisfies the requirement tensorflow==2.15.1 (from versions: none)
ERROR: No matching distribution found for tensorflow==2.15.1
Failed to install 'tensorflow', will try in next installation round...

Most probably, the issue seems to stem from the fact that the custom source URL we are using for tensorflow_rocm does not have the necessary metadata that pipenv uses to resolve and lock dependencies. When pipenv tries to find the specified package in the custom index, it fails because it doesn't find any matching version metadata.

This fix specify the direct URL to the wheel file in the Pipfile instead of using the custom index.

How has been tested

Run the following cmd to spin up the image: podman run --rm -it -p8888:8888 ghcr.io/atheo89/notebooks/workbench-images:amd-jupyter-tensorflow-c9s-python-3.9-resolve-tensorflow-rocm_3f5325cf541e01dc0b747432bd7ea99dd6614ec6

Create a new notebook and run: pip show tensorflow_rocm You should see the following:

Name: tensorflow-rocm
Version: 2.15.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /opt/app-root/lib/python3.9/site-packages
Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, libclang, ml-dtypes, numpy, opt-einsum, packaging, protobuf, setuptools, six, tensorboard, tensorflow-estimator, tensorflow-io-gcs-filesystem, termcolor, typing-extensions, wrapt
Required-by: 
Note: you may need to restart the kernel to use updated packages.

Run a test case, where it provided here: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/3rd-party/tensorflow-install.html#running-a-basic-tensorflow-example it should be run successfully

Merge criteria:

jiridanek commented 2 months ago

/lgtm it fixed gha!

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: harshad16

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/opendatahub-io/notebooks/blob/main/OWNERS)~~ [harshad16] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment