Search code examples
pythontensorflowpip

can't update tensorflowjs from 3.18 to 4.18


the error when i try to update

ERROR: Cannot install tensorflowjs and tensorflowjs==4.18.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    tensorflowjs 4.18.0 depends on tensorflow<3 and >=2.13.0
    tensorflow-decision-forests 1.8.1 depends on tensorflow~=2.15.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

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

then when i try to install tensorflow-decision-forests 1.8.1

Collecting tensorflow-decision-forests
  Using cached tensorflow_decision_forests-1.8.1.tar.gz (15.2 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\python312\lib\site-packages (from tensorflow-decision-forests) (1.26.4)
Requirement already satisfied: pandas in c:\python312\lib\site-packages (from tensorflow-decision-forests) (2.2.0)
INFO: pip is looking at multiple versions of tensorflow-decision-forests to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.15.0 (from tensorflow-decision-forests) (from versions: 2.16.0rc0, 2.16.1)
ERROR: No matching distribution found for tensorflow~=2.15.0

Name: tensorflow Version: 2.16.1 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: [email protected] License: Apache 2.0 Location: C:\Python312\Lib\site-packages Requires: tensorflow-intel Required-by: tensorflowjs

my tensorflow version already 2.16.1


Solution

  • The underlying reason why decision-forest cannot be installed is in the error message:

    ERROR: Could not find a version that satisfies the requirement tensorflow~=2.15.0 (from tensorflow-decision-forests) (from versions: 2.16.0rc0, 2.16.1)
    

    It needs tensorflow~=2.15.0 which tensorflow 2.16 does not satisfy. The ~= means "compatible release".

    You might ask "Why does it not install tensforflow 2.15 then?" to which the answer is: Because it cannot be installed, which is also in the same error message: from versions: 2.16.0rc0, 2.16.1. Only versions 2.16.0rc0, 2.16.1 of tensorflow are compatible with your python version/OS combination.

    This in turn is because you are using python 3.12, which is rather new and only supported in rather recent releases of tensorflow on windows. If you absolutely need the higher version version of tensorflowjs, you will need to downgrade your python version