question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poetry | RuntimeError: No python executable found in shell environment. Tried: ['python3', 'python', 'py.exe -3', 'py.exe -2']

See original GitHub issue
  • 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

  • Poetry version: 1.1.13

  • Link of a Gist with the contents of your pyproject.toml file: gist

Issue

HDS+dabell@PF2DCSXD MINGW64 ~/Anaconda3
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Retrieving Poetry metadata

This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
# 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:

%USERPROFILE%\.poetry\bin

This path will then be added to your `PATH` environment variable by
modifying the `HKEY_CURRENT_USER/Environment/PATH` registry key.

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

Installing version: 1.1.13
  - Downloading poetry-1.1.13-win32.tar.gz (71.14MB)
Traceback (most recent call last):
  File "<stdin>", line 1118, in <module>
  File "<stdin>", line 1114, in main
  File "<stdin>", line 362, in run
  File "<stdin>", line 556, in install
  File "<stdin>", line 704, in make_bin
  File "<stdin>", line 693, in _which_python
RuntimeError: No python executable found in shell environment. Tried: ['python3', 'python', 'py.exe -3', 'py.exe -2']

So, I went into Anaconda3, duplicated python.exe, renaming it python3.exe:

HDS+dabell@PF2DCSXD MINGW64 ~/Anaconda3
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
bash: python3: command not found
curl: (23) Failure writing output to destination
(base)
HDS+dabell@PF2DCSXD MINGW64 ~/Anaconda3
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Retrieving Poetry metadata

This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
Latest version already installed.
(base)
HDS+dabell@PF2DCSXD MINGW64 ~
HDS+dabell@PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen (daniel_sims)
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Retrieving Poetry metadata

This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
Latest version already installed.
(base)
HDS+dabell@PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen (daniel_sims)
$ poetry install
bash: poetry: command not found
(base)

I then tried Powershell:

PS C:\Users\dabell> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python3       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\dabell\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.1.13)
Installing Poetry (1.1.13): Creating environment
Installing Poetry (1.1.13): Installing Poetry
Installing Poetry (1.1.13): Creating script
Installing Poetry (1.1.13): Done

Poetry (1.1.13) is installed now. Great!

To get started you need Poetry's bin directory (C:\Users\dabell\AppData\Roaming\Python\Scripts) in your `PATH`
environment variable.

Alternatively, you can call Poetry explicitly with `C:\Users\dabell\AppData\Roaming\Python\Scripts\poetry`.

You can test that everything is set up by executing:

`poetry --version`

PS C:\Users\dabell> poetry --version
poetry : The term 'poetry' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ poetry --version
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (poetry:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dimblebycommented, Jun 29, 2022

I have no idea, I have never installed poetry on windows. All that I have done for you is read the logs that you were not reading.

Good luck!

0reactions
neersightedcommented, Oct 11, 2022

Anaconda is not officially supported by the virtualenv module on Windows – while I have had it work in trivial scenarios, it simply isn’t compatible in all the ways expected (e.g. providing the py.exe launcher) of a Windows Python distribution. A Windows expert could likely spend time figuring out why and working around it, but for now Poetry depends on standard interfaces to interact with Python on Windows and doesn’t do any special-casing needed for Anaconda.

You could open a new issue as a feature request for Anaconda support, and PRs are always welcome if someone wants to start working on a compatibility layer ahead of discussion in an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry installation fails. Windows 10, python39 #3388 - GitHub
... in _which_python RuntimeError: No python executable found in shell environment. Tried: ['python', 'python3', 'py.exe -3', 'py.exe -2'] ...
Read more >
Poetry - RuntimeError: No python executable found in shell ...
Poetry - RuntimeError: No python executable found in shell environment. Tried: ['python3', 'python', 'py.exe -3', 'py.exe -2'].
Read more >
Managing environments | Documentation - Poetry
Managing environments Poetry makes project environment isolation one of its core features ... Poetry will then try to find the current python of...
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry Install. Poetry replaces ...
Read more >
'Access is denied' while i am running a command in powershell
I am trying to make a python 3.7 virtual environment using virtualenv. to give you a context in already have python 3.8 in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found