Noughts and Crosses Requirements - ERROR: No matching distribution found for tensorflow-decision-forests==1.9.0

79 views
Skip to first unread message

Raspberry Pieman

unread,
Jun 15, 2024, 7:04:34 AM6/15/24
to Machine Learning for Kids
  Hi,
       I am trying to set up my computer to run Machine-Learning-For-Kids - Noughts and Crosses (Python variant)

I have Python V3.11 installed and am attempting to satisfy the requirements.txt: 

# noughts and crosses dependencies
certifi==2024.2.2
chardet==5.2.0
idna==3.6
pygame==2.5.2
requests==2.31.0
urllib3==2.2.1
# mlforkidsnumbers dependencies
tensorflow-decision-forests==1.9.0
pandas==2.2.1


Here are the results:

C:\Users\Raspberry\AppData\Local\Programs\Python\Python311\Scripts>pip install -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt
Collecting certifi==2024.2.2 (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 2))
  Using cached certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
Collecting chardet==5.2.0 (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 3))
  Using cached chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
Collecting idna==3.6 (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 4))
  Using cached idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Requirement already satisfied: pygame==2.5.2 in c:\users\raspberry\appdata\local\programs\python\python311\lib\site-packages (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 5)) (2.5.2)
Requirement already satisfied: requests==2.31.0 in c:\users\raspberry\appdata\local\programs\python\python311\lib\site-packages (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 6)) (2.31.0)
Collecting urllib3==2.2.1 (from -r Y:\Source\Python\_Python3\MachineLearning\ForKids\NoughtsAndCrosses\Noughts-and-Crosses-master\Noughts-and-Crosses-master\requirements.txt (line 7))
  Downloading urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
ERROR: Could not find a version that satisfies the requirement tensorflow-decision-forests==1.9.0 (from versions: 1.8.1)
ERROR: No matching distribution found for tensorflow-decision-forests==1.9.0



I don't know how to solve this issue, can you help, please?

Best Regards,
Martyn

Dale Lane

unread,
Jun 15, 2024, 7:11:34 AM6/15/24
to Machine Learning for Kids
What is the operating system (e.g. Windows, MacOS) and processor (e.g. x86_64) where you are running this?

If you're not sure what processor you have, try this in Python

import platform 
print(platform.machine())

Kind regards

D

Dale Lane

unread,
Jun 15, 2024, 10:28:43 AM6/15/24
to Machine Learning for Kids

> ERROR: Could not find a version that satisfies the requirement
> tensorflow-decision-forests==1.9.0 (from versions: 1.8.1)
> ERROR: No matching distribution found for
> tensorflow-decision-forests==1.9.0

When you run pip install, pip downloads the dependencies – it needs to download dependencies specific to your version of Python and your computer.

That message is telling you that there is no built version of Tensorflow Decision Forests (“TFDF”) available for your version of Python, operating system, and processor.

Looking at https://pypi.org/project/tensorflow-decision-forests/1.9.0/#files I can see TensorFlow have not published a build of TFDF for Windows – just Linux and MacOS.

This leaves a few options: 

  1. Use Windows Subsystem for Linux, so you can use the Linux version that is built and available
    (source https://www.tensorflow.org/decision_forests/known_issues#windows_pip_package_is_not_available )
  2. Build TFDF for yourself
    (source https://github.com/tensorflow/decision-forests/blob/main/documentation/installation.md#build-from-source )
  3. Use an alternate dependency - YDF - instead of TFDF, as I think they’re compatible, and there appear to be Windows builds available for it
    (source https://pypi.org/project/ydf/#files )

If you have WSL, then I expect option 1 would be the simplest.

If you don’t have WSL, then I expect option 3 to be the simplest.

I don’t have a Windows computer to try this for myself, but my guess would be that it would involve a few simple changes. 

Change 1) In the requirements.txt file

Replace this:
   tensorflow-decision-forests==1.9.0

With this:
   ydf==0.4.3

 

Change 2) In the imports section of the mlforkidsnumbers.py file

Replace this:
   import tensorflow_decision_forests as tfdf
   from tf_keras.models import load_model

With this:
   import ydf as tfdf
   from ydf import from_tensorflow_decision_forests as load_model

 

Change 3) In the classify function of the mlforkidsnumbers.py file

Replace this:
   ds = tfdf.keras.pd_dataframe_to_tf_dataset(df.astype(types), label=None)

With this:
   ds = df.astype(types)

 

There might be some more tweaking needed that I haven’t thought of, but I think that should be most of it at least.

Reply all
Reply to author
Forward
0 new messages