Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/verify-windows.ps1 fails to find installed python3 #1583

Open
diablodale opened this issue Apr 29, 2021 · 1 comment · May be fixed by #1608
Open

scripts/verify-windows.ps1 fails to find installed python3 #1583

diablodale opened this issue Apr 29, 2021 · 1 comment · May be fixed by #1608
Assignees
Labels
Bug Something isn't working Investigating Dev team needs to Investigate

Comments

@diablodale
Copy link

scripts/verify-windows.ps1 does not find python3 that has been installed by Windows itself. The script reports the error

C:\njs\Azure-Kinect-Sensor-SDK\scripts\verify-windows.ps1 : Unable to find python 3. Please install python3 and add it
to your path
At line:1 char:1
+ .\verify-windows.ps1
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,verify-windows.ps1

Setup

Repro

  1. Run scripts/verify-windows.ps1

Result

C:\njs\Azure-Kinect-Sensor-SDK\scripts\verify-windows.ps1 : Unable to find python 3. Please install python3 and add it
to your path
At line:1 char:1
+ .\verify-windows.ps1
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,verify-windows.ps1

Expected

No error and the successful output "Machine setup. Please use Visual Studio Developer Command prompt to build."

Notes

If I run the command of line 86 of the verify script Get-Command -All -Name "python" I get the result

PS C:\njs\Azure-Kinect-Sensor-SDK\scripts> Get-Command -All -Name "python"

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     python.exe                                         0.0.0.0    C:\Users\dale\AppData\Local\Microsoft\WindowsApps\python.exe

and if at that same ps prompt I type that long path, or python, or python3...then all three methods run python 3...

Python 3.8.9 (tags/v3.8.9:a743f81, Apr  2 2021, 11:10:41) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

This suggests that the verify script's method of version checking is not sufficient to detect Windows Store installed python. Naturally, the Windows Store is....desired to also be supported. This is likely related to the Windows Store and App Execution Aliases.

It is not possible to add the Windows Store python manually to the PATH. That location is typically cryptic and not user maintainable. For example, on my computer it is C:\Users\dale\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0

@diablodale diablodale added Bug Something isn't working Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. labels Apr 29, 2021
@qm13 qm13 removed the Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. label May 3, 2021
@diablodale
Copy link
Author

My fix (which you are welcome to copy) is to update verify-windows.ps1 as follows

line 85 change from

if (-not (Get-Command -All -Name "python" | Where-Object { $_.Version -ge [Version]"3.0" }))

to

if (-not (Get-Command -All -Name "python3"))

Using python3 is a reliable method to check if python v3.x is installed and available on the path, and it works across all platforms, install types, app execution aliases, shortcuts, etc.

diablodale added a commit to diablodale/Azure-Kinect-Sensor-SDK that referenced this issue May 25, 2021
@diablodale diablodale linked a pull request May 25, 2021 that will close this issue
6 tasks
@qm13 qm13 added the Investigating Dev team needs to Investigate label Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Investigating Dev team needs to Investigate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants