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

pipx install "cannot find the file specified" #705

Closed
kcinlober opened this issue Jun 13, 2021 · 11 comments
Closed

pipx install "cannot find the file specified" #705

kcinlober opened this issue Jun 13, 2021 · 11 comments

Comments

@kcinlober
Copy link

kcinlober commented Jun 13, 2021

when using pipx install cowsay (or any program) i get an error stating that the file cannot be found in the .local\pipx\shared directory (see --verbose code)

C:\WINDOWS\system32>pipx install cowsay --verbose
pipx >(setup:717): pipx version is 0.16.3
pipx >(setup:718): Default python interpreter is 'c:\\users\\nbreb\\appdata\\local\\programs\\python\\python39\\python3.exe'
pipx >(package_name_from_spec:323): Determined package name: cowsay
pipx >(package_name_from_spec:324): Package name determined in 0.0s
creating virtual environment...
pipx >(run_subprocess:135): running c:\users\nbreb\appdata\local\programs\python\python39\python3.exe -m venv --without-pip C:\Users\nbreb\.local\pipx\venvs\cowsay
creating shared libraries...
pipx >(run_subprocess:135): running c:\users\nbreb\appdata\local\programs\python\python39\python3.exe -m venv --clear C:\Users\nbreb\.local\pipx\shared
Error: [WinError 2] The system cannot find the file specified

pipx >(rmdir:43): removing directory C:\Users\nbreb\.local\pipx\venvs\cowsay
'c:\\users\\nbreb\\appdata\\local\\programs\\python\\python39\\python3.exe -m venv --clear
C:\\Users\\nbreb\\.local\\pipx\\shared' failed

I believe i installed pipx correctly (as per instructions) and same with pip (21.1.2)

@itsayellow
Copy link
Contributor

Hi, some questions:

  1. Which version of Windows are you using?
  2. Are you using a native Powershell, cmd.exe, MSYS2, or Cygwin to run pipx?
  3. How was the python you're using installed, via a python.org installer? Or through some other package manager?
  4. Could you post the contents of the cmd_*.log file that pertains to this command? It should be located in C:\Users\nbreb\.local\pipx\logs. Sometimes there is more information in that than the --verbose output.

thanks!

@itsayellow
Copy link
Contributor

A quick thing to check, does c:\users\nbreb\appdata\local\programs\python\python39\python3.exe exist?

@malteohlers
Copy link

@itsayellow I have run into the same issue on a newly installed Windows 10 machine:

pipx >(setup:717): pipx version is 0.16.3
pipx >(setup:718): Default python interpreter is 'c:\\users\\malteøhlers\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe'
pipx >(package_name_from_spec:323): Determined package name: cowsay
pipx >(package_name_from_spec:324): Package name determined in 0.0s
creating virtual environment...
pipx >(run_subprocess:135): running c:\users\malteøhlers\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --without-pip C:\Users\MalteØhlers\.local\pipx\venvs\cowsay
creating shared libraries...
pipx >(run_subprocess:135): running c:\users\malteøhlers\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --clear C:\Users\MalteØhlers\.local\pipx\shared
Error: [WinError 2] The system cannot find the file specified

pipx >(rmdir:43): removing directory C:\Users\MalteØhlers\.local\pipx\venvs\cowsay
'c:\\users\\malteøhlers\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe -m venv --clear C:\\Users\\MalteØhlers\\.local\\pipx\\shared' failed
PS C:\Users\MalteØhlers\.local\pipx\venvs>
  1. Microsoft Windows 10 Enterprise (10.0.19042 N/A Build 19042)
  2. The problem seems to be consistent across Powershell, Command Prompt (cmd.exe), Git Bash (all launched via Windows Terminal)
  3. Python 3.9.6 is the only version installed and was installed via pyenv-win. The python global version is set to the 3.9.6 version and python and python3 is working as expected.
  4. See cmd_2021-07-20_19.08.36.log
  5. As you can see from the above log the python interperter c:\\users\\malteøhlers\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe exists and is successfully called once.

@kcinlober
Copy link
Author

hi, sorry, i didn't see the previous responses until just now. I actually figured out what was the problem for me. It is that windows has python.exe and python3.exe located in the following folder: C:\Users\MyUserName\AppData\Local\Microsoft\WindowsApps

I think this happens when installing python from the windows store. You can remove this folder from the PATH environment, or else just delete the python files from C:\Users\MyUserName\AppData\Local\Microsoft\WindowsApps.

@malteohlers
Copy link

malteohlers commented Jul 21, 2021

@kcinlober: Great that you found a solution, thanks for sharing!

@itsayellow: Unfortunately it's not the same problem for me. I had already removed/disabled the python installer shims as part of the pyenv-win installation. I did it by going to Start > Manage App Execution Aliases and turning off the App Installer aliases for Python (python.exe and python3.exe)

@dmwyatt
Copy link

dmwyatt commented Sep 20, 2021

I'm also getting this on a fresh Windows 10 install. I disabled the windows versions of python with Start > Manage App Execution Aliases and installed 3.9.6 with pyenv-win. I can start up python interpreter just fine by typing python, or python3, but get this error:

╰─ pipx install poetry --verbose                                                         ─╯
pipx >(setup:717): pipx version is 0.16.4
pipx >(setup:718): Default python interpreter is 'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe'
pipx >(package_name_from_spec:323): Determined package name: poetry
pipx >(package_name_from_spec:324): Package name determined in 0.0s
creating virtual environment...
pipx >(run_subprocess:135): running c:\users\dustin\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --without-pip C:\Users\dustin\.local\pipx\venvs\poetry
creating shared libraries...
pipx >(run_subprocess:135): running c:\users\dustin\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --clear C:\Users\dustin\.local\pipx\shared
Error: [WinError 2] The system cannot find the file specified

pipx >(rmdir:43): removing directory C:\Users\dustin\.local\pipx\venvs\poetry
'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe -m venv --clear
C:\\Users\\dustin\\.local\\pipx\\shared' failed

If I copy/paste that 'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe -m venv --clear C:\\Users\\dustin\\.local\\pipx\\shared', it runs without error and without any output.

That is the correct location of python:

╰─ python3                                                                               ─╯
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe'

@mobaset
Copy link

mobaset commented Jan 28, 2022

I'm also getting this on a fresh Windows 10 install. I disabled the windows versions of python with Start > Manage App Execution Aliases and installed 3.9.6 with pyenv-win. I can start up python interpreter just fine by typing python, or python3, but get this error:

╰─ pipx install poetry --verbose                                                         ─╯
pipx >(setup:717): pipx version is 0.16.4
pipx >(setup:718): Default python interpreter is 'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe'
pipx >(package_name_from_spec:323): Determined package name: poetry
pipx >(package_name_from_spec:324): Package name determined in 0.0s
creating virtual environment...
pipx >(run_subprocess:135): running c:\users\dustin\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --without-pip C:\Users\dustin\.local\pipx\venvs\poetry
creating shared libraries...
pipx >(run_subprocess:135): running c:\users\dustin\.pyenv\pyenv-win\versions\3.9.6\python3.exe -m venv --clear C:\Users\dustin\.local\pipx\shared
Error: [WinError 2] The system cannot find the file specified

pipx >(rmdir:43): removing directory C:\Users\dustin\.local\pipx\venvs\poetry
'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe -m venv --clear
C:\\Users\\dustin\\.local\\pipx\\shared' failed

If I copy/paste that 'c:\\users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe -m venv --clear C:\\Users\\dustin\\.local\\pipx\\shared', it runs without error and without any output.

That is the correct location of python:

╰─ python3                                                                               ─╯
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\dustin\\.pyenv\\pyenv-win\\versions\\3.9.6\\python3.exe'

I have the exact same error with the exact same use case. I'm trying to install poetry with no luck. Has anyone managed to find a solution or a workaround?

@gatoniel
Copy link

gatoniel commented Apr 13, 2022

Hi, I just opened an issue with pyenv-win as I guess this is an issue there. For now, a possible workaround would be to execute

C:\Users\myuser\.pyenv\pyenv-win\versions\3.9.6\python.exe -m venv --clear C:\Users\myuser\.local\pipx\shared

Without the 3 in python3.exe.
However, I do not know how to accomplish that.

This does also not directly solve @mobaset 's problem as there the command can be executed in isolation.

@rmcclellan-izo
Copy link
Contributor

I think this might be caused by python/cpython#87915 in combination with the installation instructions on windows, which currently are

python3 -m pip install --user pipx
python3 -m pipx ensurepath

I think these instructions are just incompatible with 3.8 and below and for 3.9 and 3.10 versions before the linked bugfix. Maybe a more robust installation method on windows would be:

py -3 -m pip install --user pipx
py -3 -m pipx ensurepath

@rmcclellan-izo
Copy link
Contributor

Apparently the Windows App Store version of python does not include the py tool specified by PEP 397 - so for those users py will not work. However, on that same discussion it's said that:

Right now, approx 95% of the downloads go through python.org.

So, perhaps we can depend on py existing for most windows users. However, due to python/cpython#87915, the current instructions aren't working for a lot of people. I also wonder if just using python is a better choice for most.

@rmcclellan-izo
Copy link
Contributor

I think this is resolved by #879

@uranusjr uranusjr closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants