DEV-tools icon indicating copy to clipboard operation
DEV-tools copied to clipboard

Can't shim 'py.exe': File doesn't exist when installing pipx

Open issam-seghir opened this issue 2 years ago • 5 comments

Bug Report

Package Name: pipx

Current Behaviour

image

i install python with pyenv , and pyenv is installed with scoop this is the location of python (where python)

E:\Apps\scoop\apps\pyenv\current\pyenv-win\shims\python
E:\Apps\scoop\apps\pyenv\current\pyenv-win\shims\python.bat
C:\Users\<USER>\AppData\Local\Microsoft\WindowsApps\python.exe

Expected Behaviour

clean install

Possible Solution

System details

Windows version: [10]

OS architecture: [64bit]

PowerShell version: [7.3.4]

Scoop Configuration

{
  "alias": {
    "gui": "scoop-gui"
  },
  "aria2-enabled": true,
  "last_update": "2023-06-29T15:51:47.7565564+01:00",
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop",
  "scoop_branch": "master"
}

issam-seghir avatar Jun 29 '23 18:06 issam-seghir

Hmmm.. that's strange, because it works for me:

PS C:\Users\ander> scoop install anderlli0053_DEV-tools/pipx
WARN  Scoop uses 'aria2c' for multi-connection downloads.
WARN  Should it cause issues, run 'scoop config aria2-enabled false' to disable it.
WARN  To disable this warning, run 'scoop config aria2-warning-enabled false'.
Installing 'pipx' (1.2.0) [64bit] from anderlli0053_DEV-tools bucket
Loading pipx.pyz from cache.
Checking hash of pipx.pyz ... ok.
Linking ~\scoop\apps\pipx\current => ~\scoop\apps\pipx\1.2.0
Creating shim for 'pipx'.
'pipx' (1.2.0) was installed successfully!
PS C:\Users\ander>

anderlli0053 avatar Jun 29 '23 18:06 anderlli0053

Hmmm.. that's strange, because it works for me:

PS C:\Users\ander> scoop install anderlli0053_DEV-tools/pipx
WARN  Scoop uses 'aria2c' for multi-connection downloads.
WARN  Should it cause issues, run 'scoop config aria2-enabled false' to disable it.
WARN  To disable this warning, run 'scoop config aria2-warning-enabled false'.
Installing 'pipx' (1.2.0) [64bit] from anderlli0053_DEV-tools bucket
Loading pipx.pyz from cache.
Checking hash of pipx.pyz ... ok.
Linking ~\scoop\apps\pipx\current => ~\scoop\apps\pipx\1.2.0
Creating shim for 'pipx'.
'pipx' (1.2.0) was installed successfully!
PS C:\Users\ander>

Maybe you install python with Microsoft store or Globlay with msi installer?

I only installed Python using pyenv install python so the environment variable PATH does not contain the path to python.exe. It only includes the paths 'pyenv/bin' and 'pyenv/shims'

issam-seghir avatar Jun 29 '23 18:06 issam-seghir

where python command returns C:\Users\ander\scoop\apps\python\current , whish means that in my case it is installed via Scoop and is on the PATH

anderlli0053 avatar Jun 29 '23 18:06 anderlli0053

The problem occurs because pipx requires a Python launcher py.exe to be installed. However, in my case, pyenv installs Python without the launcher. This is how pyenv works for Windows, so I do not have py.exe in my system.

When I run 'py' in my terminal, I receive the following output: "py: The term 'py' is not recognized as a name of a cmdlet."

To resolve this, I need to install Python either with Scoop or using the MSI installer from the official site. Both options come with the Python launcher (py.exe).

Note: When I install Python with Scoop, I follow the instructions mentioned in the note, which state: Allow applications and third-party installers to find python by running: E:\Apps\scoop\apps\python310\current\install-pep-514.reg So, I run E:\Apps\scoop\apps\python310\current\install-pep-514.reg and accept the pop-up window to ensure that py works without any issues.

To verify that py.exe is working, type py in the terminal, and it should run the Python version installed with Scoop.

Then, I install pipx using scoop install anderlli0053_DEV-tools/pipx without any problems

update : to fix the conflcit between using python scoop version and python pyenv versions i move the pyenv path in env var to the top like this image

issam-seghir avatar Jun 30 '23 08:06 issam-seghir

Thanks for the explanation.

But what am i supposed to do about that in the manifest file itself, what's even more the manifests are self-updated and fetched regularly and the changes are overwritten by preeceding manifests.

anderlli0053 avatar Jul 01 '23 15:07 anderlli0053