Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Windows Installation Failure using pip #90

Open
mitchellresnick opened this issue Feb 15, 2022 · 2 comments
Open

Windows Installation Failure using pip #90

mitchellresnick opened this issue Feb 15, 2022 · 2 comments

Comments

@mitchellresnick
Copy link

Description
On Windows, when Docker is not installed and pip is desired to install, the user sees an error stating the command python3 does not exist.

This is due to the fact that when installed on Windows, Python is registered as python instead of python3.

During the first-time setup of Checkov in Visual Studio Code, the following error is observed:
[error]: Failed to install or update Checkov using pip3. Error: {"error":{"killed":false,"code":9009,"signal":null,"cmd":"python3 --version","message":"Command failed: python3 --version\nPython was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.\r\n","stack":"Error: Command failed: python3 --version\nPython was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.\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 Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)"}}

To fix this error, an additional check should be run to see if python --version returns a valid response.

Reproduction of Issue

  1. Ensure that Docker is not installed on the system.
  2. Install Python on Windows for all users and select the option to add Python to the PATH.
  3. Install the Checkov extension within Visual Studio Code
  4. Observe that when running the command python3 --version an error is thrown stating python3 is not recognized. Additionally, run python --version to see that the version is returned as expected.
  5. Open a supported file in VS Code and using the command palette execute the "Checkov Scan" command.
  6. After a few seconds, open Checkov logs using the command palette and observe the error stating that the command python3 does not exist.

Proposed solution
When running the first-time setup of Checkov in VS Code, an additional check should be run after the check for python3 --version to see if python --version returns the desired result.

@willwh
Copy link

willwh commented Feb 23, 2022

Only the microsoft store package provides python3: https://docs.python.org/3/using/windows.html#the-microsoft-store-package

Installing using https://www.python.org/downloads/windows/ releases does not provide python3.exe, only python.exe is provided.

@willwh
Copy link

willwh commented Mar 2, 2022

So I tried the route of setting an alias in my powershell profile:

Set-Alias -Name python3 -Value "C:\Program Files\Python38\python.exe"

Restarting VSC I still get the same plugin install failures.... however python3 --version works from the VSC terminal.... so it doesn't seem Aliases will be an option, with powershell as a default shell.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants