XargsUK / checkov-prismaless-vscode

Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework, and other infrastructure-as-code-languages with Checkov in VS Code.
https://marketplace.visualstudio.com/items?itemName=XargsUK.checkov-prismaless
Apache License 2.0
6 stars 2 forks source link

[Bug]: Failed to install or update Checkov using python pip etc #8

Closed brokedba closed 3 months ago

brokedba commented 5 months ago

Python Version

Python 3.10

Checkov Installation Method

pip

CheckovPrismaless Version

1.0.107

VSCode Version

1.89.1

Operating System

Windows 10

Description of the Bug

Hi XargsUK, I don't now if it's related to the recent updates after issue I open weeks ago #2 but I started to have this error output whilefailing the update through pip python python 3 etc .

[info]: Starting Checkov Extension. {"extensionVersion":"unknown","vscodeVersion":"1.89.1"}
[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":{"code":1,"killed":false,"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 (node:child_process:423:12)\n\tat ChildProcess.emit (node:events:517:28)\n\tat maybeClose (node:internal/child_process:1098:16)\n\tat Socket.<anonymous> (node:internal/child_process:450:11)\n\tat Socket.emit (node:events:517:28)\n\tat Pipe.<anonymous> (node:net:350:12)"}}
[info]: Trying to install Checkov using pip3. 
[debug]: Getting python version with command: python3 --version 
[debug]: python3 executable not found on Windows, falling back to python 
[debug]: Getting python version with command: python --version 
[error]: Failed to install or update Checkov using pip3. Error: {"error":{"code":9009,"killed":false,"signal":null,"cmd":"python --version","message":"Command failed: python --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: python --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 (node:child_process:423:12)\n\tat ChildProcess.emit (node:events:517:28)\n\tat maybeClose (node:internal/child_process:1098:16)\n\tat Socket.<anonymous> (node:internal/child_process:450:11)\n\tat Socket.emit (node:events:517:28)\n\tat Pipe.<anonymous> (node:net:350: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":{"code":9009,"killed":false,"signal":null,"cmd":"python --version","message":"Command failed: python --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: python --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 (node:child_process:423:12)\n\tat ChildProcess.emit (node:events:517:28)\n\tat maybeClose (node:internal/child_process:1098:16)\n\tat Socket.<anonymous> (node:internal/child_process:450:11)\n\tat Socket.emit (node:events:517:28)\n\tat Pipe.<anonymous> (node:net:350:12)"}}
[info]: Trying to install Checkov using pipenv. 
[debug]: Installation dir: c:\Users\kosse\AppData\Roaming\Code\User\globalStorage\xargsuk.checkov-prismaless\checkov-installation 
[debug]: Getting python version with command: pipenv run python --version 
[error]: Failed to install or update Checkov using pipenv. Error: {"error":{"code":1,"killed":false,"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 (node:child_process:423:12)\n\tat ChildProcess.emit (node:events:517:28)\n\tat maybeClose (node:internal/child_process:1098:16)\n\tat Socket.<anonymous> (node:internal/child_process:450:11)\n\tat Socket.emit (node:events:517:28)\n\tat Pipe.<anonymous> (node:net:350: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\\user\\.vscode\\extensions\\xargsuk.checkov-prismaless-1.0.107\\out\\checkov\\checkovInstaller.js:169:11\n\tat Generator.next (<anonymous>)\n\tat fulfilled (c:\\Users\\user\\.vscode\\extensions\\xargsuk.checkov-prismaless-1.0.107\\out\\checkov\\checkovInstaller.js:28:58)"}}

maybe It's on my side or because I updated VSCode today . but I wanted to share that anyway. Thank you

Steps to Reproduce

Update VSCODE

brokedba commented 5 months ago

Might try this Go to -> "start" and type "Manage App Execution Aliases". Go to it and turn off "Python" image

from this StackOverflow post and see how it goes

brokedba commented 5 months ago

reinstalled python and still having the same issue

>python --version
Python 3.10.0
> where python 
C:\Program Files\python\Python310\python.exe
C:\Users\User\AppData\Local\Microsoft\WindowsApps\python.exe 
brokedba commented 5 months ago

ok now it's working . I went back to "Manage App Execution Aliases" and enabled the alias for everything python , image

[debug]: Getting python version with command: python3 --version 
[debug]: Raw output: 
[debug]: Python 3.10.11

[debug]: Python version: 3.10.11

[debug]: Testing pip[3] installation with command: pip3 install --user -U -i https://pypi.org/simple/ checkov 
[debug]: Location: c:\users\kosse\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages 
[info]: Checkov installed successfully using pip3. {"checkovPath":"c:\\users\\user\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\\localcache\\local-packages\\python310\\Scripts\\checkov"}
[info]: Checkov installation:  {"checkovInstallationMethod":"pip3","checkovPath":"c:\\users\\user\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\\localcache\\local-packages\\python310\\Scripts\\checkov"}
[debug]: Version command: c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\Scripts\checkov -v 
[debug]: Response from version command: 3.2.90

[info]: Previously installed checkov version does not match the newly installed one. Clearing results cache. 
[debug]: Clearing results cache 

image

you can close it I guess , but I still don't know why it happened.