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

Poetry installation fails. Windows 10, python39 #3388

Closed
3 tasks done
bmosier opened this issue Nov 19, 2020 · 14 comments
Closed
3 tasks done

Poetry installation fails. Windows 10, python39 #3388

bmosier opened this issue Nov 19, 2020 · 14 comments
Labels
kind/bug Something isn't working as expected

Comments

@bmosier
Copy link

bmosier commented Nov 19, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10 Education edition
  • Poetry version: 1.1.4
  • Link of a [Gist] with the contents of your pyproject.toml file: N/A
  • Python version: 3.9

Issue

Poetry install fails on windows 10, both recommended installation (powershell) and Pip installation fail. Both methods have been tried in user and admin powershell consoles. My $PATH is correct.

PS C:\Users\me\workspace> (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
Retrieving Poetry metadata

Welcome to Poetry!
... ... ... omitted
Installing version: 1.1.4
  - Downloading poetry-1.1.4-win32.tar.gz (38.82MB)
Traceback (most recent call last):
  File "<stdin>", line 1086, in <module>
  File "<stdin>", line 1082, in main
  File "<stdin>", line 362, in run
  File "<stdin>", line 529, in install
  File "<stdin>", line 676, in make_bin
  File "<stdin>", line 665, in _which_python
RuntimeError: No python executable found in shell environment. Tried: ['python', 'python3', 'py.exe -3', 'py.exe -2']
PS C:\Users\me\workspace> python --version
Python 3.9.0

PS C:\Users\me\workspace> pip install poetry --no-cache
... ... ... omitted
Installing collected packages: tomlkit, pylev, pastel, clikit, cleo, msgpack, lockfile, cachecontrol, poetry-core, cachy, filelock, appdirs, distlib, virtualenv, shellingham, webencodings, html5lib, pkginfo, poetry
    Running setup.py install for msgpack ... done
  WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an EnvironmentError: [WinError 2] The system cannot find the file specified: 'c:\\python39\\Scripts\\doesitcache.exe' -> 'c:\\python39\\Scripts\\doesitcache.exe.deleteme'

The powershell installation method tells me that it is unable to find my python executable, but it is certainly in my global PATH.
Using the Pip installation method will result in it being unable to find an exe in "python39/scripts". Running the pip installation again it tells me it can't find a different exe before installation terminates. Indeed, these executables are not in that directory.

These installation methods will place a .poetry directory skeleton in my home, but will not place an executable for poetry in .poetry/bin

@bmosier bmosier added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 19, 2020
@awburgess
Copy link

I'm experiencing the same issue:

  • OS version and name: Windows 10
  • Poetry version: 1.1.4 (also tried 1.0.10)
  • Link of a [Gist] with the contents of your pyproject.toml file: N/A
  • Python version: 3.7.9

I can confirm that my python executable is on my PATH and I've tried setting PYTHON_PATH.

@jamilraichouni
Copy link

jamilraichouni commented Dec 6, 2020

Took also an hour for me to get poetry installed on Win10.
In the end the root cause is in

https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py, line 639 where the method
def _which_python(self): is defined. Had no time to investigate but the very dirty hack

def _which_python(self):
    return r"C:\python38\python.exe"

"fixed" it to be able to install poetry.

@mnslarcher
Copy link

Same problem here :(

@eapetitfils
Copy link

I had the same problem on one machine, but not an another. The fix I used was to remove ,shell=True from the subprocess command line 651

It ended up working for me but this could break other use cases.

@eapetitfils
Copy link

I fixed the issue properly on my side, this was not a poetry problem, but rather an old installation of Anaconda not properly cleaned up.

Basically, whenever I was starting a command prompt in Windows, there was a message The system cannot find the path specified.. I was not alarmed as everything else was working. However, it does change the exit status to 1 instead of 0 when calling something with subprocess if using shell=True. You can reproduce the same error directly in the command prompt by doing:

cmd.exe /c "python --version"
echo %errorlevel%

Command Prompt Bug Check

The way I fixed it is described on StackOverflow:
Open regedit.exe, navigate to Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor and make sure the value of the Autorun key exists. If not, clear the value. In my case, I had an entry for an Anaconda batch file that did not exist anymore.

While this error is not related to Poetry, maybe it would be interested to document it if the root cause is similar for other people.

@KyryloKaralyus
Copy link

this is still a thing :C

@Dragonlord1005
Copy link

Same here, bit different, but still preventing me from using poetry

@danielbellhv
Copy link

I've a similar issue but with a different effect - Git Issue

@dimbleby
Copy link
Contributor

dimbleby commented Jul 2, 2022

get-poetry.py is now deprecated, not much point in keeping this one open

@kitchoi
Copy link

kitchoi commented Sep 6, 2022

I am afraid this issue is still valid with Poetry 1.2 and Python 3.8, on Windows 2022.
The following was captured from running the new Poetry install script on GitHub Actions (windows-2022) self-hosted instance:

$ curl -sSL https://install.python-poetry.org/ | python -
  shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
  env:
    PYTHON_VERSION: 3.8
    pythonLocation: C:\hostedtoolcache\windows\Python\3.8.10\x64
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

C:\Users\runneradmin\AppData\Roaming\Python\Scripts

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.0)
Installing Poetry (1.2.0): Creating environment
Installing Poetry (1.2.0): An error occurred. Removing partial environment.
Traceback (most recent call last):
  File "<stdin>", line 930, in <module>
  File "<stdin>", line 909, in main
  File "<stdin>", line 545, in run
  File "<stdin>", line 566, in install
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "<stdin>", line 638, in make_env
  File "<stdin>", line 624, in make_env
  File "<stdin>", line 314, in make
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\venv\__init__.py", line 68, in create
    self._setup_pip(context)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\venv\__init__.py", line 289, in _setup_pip
    subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@neersighted
Copy link
Member

@kitchoi this is for a different installer -- I am going to close this.

Could you please open a new issue on https://github.com/python-poetry/install.python-poetry.org with more instructions on how to reproduce the issue you're having on Windows? Thanks!

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Sep 18, 2022
@systematicguy
Copy link

@kitchoi I had the same issue when trying to pipe into python3, and solved this simply piping into python. I am using pyenv-win, my global python is 3.9.6.
I need to install poetry behind a proxy, so I use $webClient.DownloadString("https://install.python-poetry.org") | python
^ this is where I had to use python instead of python3 although both work via the same pyenv-win-managed installation.

@neersighted
Copy link
Member

python-poetry/install.python-poetry.org#46

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests