Impossible d’installer ou de mettre à jour Checkov à l’aide de pip. Erreur : lors de l’installation de Visual Studio Code Checkov Extension dans Microsoft Windows.

Impossible d’installer ou de mettre à jour Checkov à l’aide de pip. Erreur : lors de l’installation de Visual Studio Code Checkov Extension dans Microsoft Windows.

17470
Created On 04/19/22 18:48 PM - Last Modified 07/14/25 23:07 PM


Objective


Les erreurs suivantes peuvent se produire lors de l’installation de l’extension Visual Studio Code Checkov dans Microsoft Windows.
-Failed to install or update Checkov using pip3
-Failed to install or update Checkov using pip
-Command failed: python3 --version\n'python3' is not recognized as an internal or external command
-Error: Command failed: python --version\n'python' is not recognized as an internal or external command

Exemple de sortie d’erreur :
Checkov logs
[info]: Starting Checkov Extension. {"extensionVersion":"1.0.72","vscodeVersion":"1.65.2"}
[info]: Trying to install Checkov using Docker. 
[debug]: Testing docker installation with command: docker pull bridgecrew/checkov:latest 
[error]: Failed to install or update Checkov using Docker. Error: {"error":{"killed":false,"code":1,"signal":null,
"cmd":"docker pull bridgecrew/checkov:latest","message":"Command failed: docker pull bridgecrew/checkov:latest\n'docker' is not recognized as an internal or 
external command,\r\noperable program or batch file.\r\n","stack":
"Error: Command failed: docker pull bridgecrew/checkov:latest\n'docker' is not recognized as an internal or external command,\r\noperable program or 
batch file.\r\n\n\tat ChildProcess.exithandler 
(child_process.js:317:12)\n\tat ChildProcess.emit (events.js:315:20)\n\tat maybeClose (internal/child_process.js:1048:16)\n\tat Socket.<anonymous>
 (internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat
 Pipe.<anonymous> (net.js:673:12)"}}
[info]: Trying to install Checkov using pip3. 
[debug]: Getting python version with command: python3 --version 
[error]: Failed to install or update Checkov using pip3. Error: {"error":
{"killed":false,"code":1,"signal":null,"cmd":"python3 --
version","message":"Command failed: python3 --version\n'python3' is not recognized 
as an internal or external command,\r\noperable program or batch 
file.\r\n","stack":"Error: Command failed: python3 --version\n'python3' is not 
recognized as an internal or external command,\r\noperable program or batch 
file.\r\n\n\tat ChildProcess.exithandler (child_process.js:317:12)\n\tat 
ChildProcess.emit (events.js:315:20)\n\tat maybeClose 
(internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[info]: Retrying using `python` and `pip` 
[debug]: Getting python version with command: python --version 
[error]: Failed to install or update Checkov using pip. Error: {"error":
{"killed":false,"code":1,"signal":null,"cmd":"python --version","message":"Command
 failed: python --version\n'python' is not recognized as an internal or external 
command,\r\noperable program or batch file.\r\n","stack":"Error: Command failed: 
python --version\n'python' is not recognized as an internal or external 
command,\r\noperable program or batch file.\r\n\n\tat ChildProcess.exithandler 
(child_process.js:317:12)\n\tat ChildProcess.emit (events.js:315:20)\n\tat 
maybeClose (internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[info]: Trying to install Checkov using pipenv. 
[debug]: Installation dir: c:\Users\USERNAME\AppData\Roaming\Code\User\globalStorage\bridgecrew.checkov\check
ov-installation 
[debug]: Getting python version with command: pipenv run python --version 
[error]: Failed to install or update Checkov using pipenv. Error: {"error":{"killed":false,"code":1,"signal":null,"cmd":"pipenv run python --
version","message":"Command failed: pipenv run python --version\n'pipenv' is not 
recognized as an internal or external command,\r\noperable program or batch 
file.\r\n","stack":"Error: Command failed: pipenv run python --version\n'pipenv' 
is not recognized as an internal or external command,\r\noperable program or batch 
file.\r\n\n\tat ChildProcess.exithandler (child_process.js:317:12)\n\tat 
ChildProcess.emit (events.js:315:20)\n\tat maybeClose 
(internal/child_process.js:1048:16)\n\tat Socket.<anonymous> 
(internal/child_process.js:439:11)\n\tat Socket.emit (events.js:315:20)\n\tat 
Pipe.<anonymous> (net.js:673:12)"}}
[warn]: All installation / update methods failed; attempting to fall back to a 
global checkov installation 
[error]: Could not find a global `checkov` executable either 
[error]: Error occurred while preparing Checkov. Verify your settings, or try to 
reload vscode. {"error":{"message":"Could not install Checkov.","stack":"Error: 
Could not install Checkov.\n\tat 
c:\\Users\\USERNAME\\.vscode\\extensions\\bridgecrew.checkov-
1.0.72\\out\\checkovInstaller.js:165:11\n\tat Generator.next (<anonymous>)\n\tat 
fulfilled (c:\\Users\\USERNAME\\.vscode\\extensions\\bridgecrew.checkov-
1.0.72\\out\\checkovInstaller.js:24:58)"}}


 


Environment


  • Prisma Cloud
  • Code de sécurité / Bridgecrew
  • Microsoft Windows
  • Visual Studio Code Checkov Extension


Procedure


À partir de la documentation python ici - Le MSI programme d’installation est le chemin recommandé pour l’installation de Windows.
https://www.python.org/downloads/release/python-3102/
Image0001.png

Python est installé globalement
Python est installé globalement
 

À l’intérieur de l’environnement Windows, les chemins d’accès aux variables sont définis pour – Environnement de niveau utilisateur

Envs au niveau utilisateur

Environnement au niveau du système
Envs au niveau du système

Aussi via PowerShell -
Powershell
Powershell

Ce problème concerne Powershell qui est le shell par défaut dans le code Windows VS .

L’installation de Python3.10 MSI s’installe par défaut sur le chemin d’accès dans les variables (AppData\Local\Programs\Python). Il semble que Powershell ne chargera pas l’environnement défini à moins que non seulement l’environnement soit défini, mais le chemin d’accès au fichier soit également ajouté à la PATH variable env.

Une fois que vous avez pu résoudre correctement les variables python, Checkov ne s’initialiserait toujours pas à moins d’utiliser pip.
Checkov ne s’initialiserait toujours pas à moins d’utiliser pip.

Variable utilisateur PATH-
Variable utilisateur PATH

Ce qui signifiait que la documentation devait être suivie ici - https://pip.pypa.io/en/stable/installation/ et un environnement supplémentaire défini pour pip.

Variable système PATH (nécessaire pour pip)
Variable système PATH (nécessaire pour pip)

Une fois que tout cela est pris en charge, checkov retourne enfin à un état de fonctionnement
Checkov revient enfin à un état de fonctionnement
 
 


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u0000004OAnCAM&lang=fr&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language