Skip to main content
Skip table of contents

ERROR: Could not find a version that satisfies the requirement

Overview

This article details the reason why you might receive this Python "ERROR: Could not find a version that satisfies the requirement" error in your Mend repo integrations and how to resolve it.

Reason

This error will appear for Python projects during step one of the scan: Package Manager Resolution. The reason why this error can occur is that a dependency (or multiple dependencies) requires a higher version of Python than what is being used in the environment.

Let’s use the package, numpy v1.23.1, as an example. By default, our SCM scanner uses Python 3.7.12. Since numpy v.1.23.1 requires Python 3.8 or higher, we will see the following error in the scan log during the package manager resolution step. This leads to numpy being unresolved and excluded from the scan results:

CODE
2022-08-19 17:09:56.517/UTC [WARN] org.whitesource.utils.command.Command - Read error line #2: ERROR: Could not find a version that satisfies the requirement numpy==1.23.1 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0rc1, 1.17.0rc2, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1, 1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0rc1, 1.20.0rc2, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0rc1, 1.21.0rc2, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6)

Resolution

Let’s look at the resolution for this error using our numpy example. Since numpy v1.23.1 requires at least Python 3.8, we can tell the SCM scanner to use a newer version. You are able to manually change the Python version the scanner uses with the following steps:

  1. Edit the configMode setting in your .whitesource file to LOCAL

  2. Create a whitesource.config file in your root

  3. Add the following parameters to the whitesource.config file:

CODE
python.invokePipAsModule=true
python.path=python3.9
python.installVirtualenv=true

Definitions of these parameters and how they interact with each other:

  • python.invokePipAsModule - when set to true, and in-hand with the "python.path" parameter, this allows you to use a specific version of Python by making the scanner use the "pythonX.Y -m pip" commands instead of just "pip", where the repo integration scanner would originally use its default version of Python 3.7.12

  • python.path - Points to the Python executable path. Our SCM scanner currently supports:

    • Mend-Hosted Integrations (http://Github.com , Azure Repos): Python 2.7.18, 3.6.15, 3.7.12, 3.9.9

  • python.installVirtualenv - when set to true, and in-hand with the other two parameters, installs the virtualenv package. For our numpy example, this would run "python3.9 -m pip install --user virtualenv"

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.