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 env doesn't work on Windows after install-poetry.py #4615

Closed
3 tasks done
tom-bowles opened this issue Oct 8, 2021 · 8 comments
Closed
3 tasks done

poetry env doesn't work on Windows after install-poetry.py #4615

tom-bowles opened this issue Oct 8, 2021 · 8 comments
Labels
status/duplicate Duplicate issues

Comments

@tom-bowles
Copy link

tom-bowles commented Oct 8, 2021

  • 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.11

  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

After installing poetry, creating a fresh project and running poetry env list the following error occurs:

EnvCommandError

Command python -W ignore - errored with the following return code 1, and output:
'python' is not recognized as an internal or external command,
operable program or batch file.
input was : import sys

if hasattr(sys, "real_prefix"):
    print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
    print(sys.base_prefix)
else:
    print(sys.prefix)


at c:\...\poetry\venv\lib\site-packages\poetry\utils\env.py:1183 in _run
    1179│                 output = subprocess.check_output(
    1180│                     cmd, stderr=subprocess.STDOUT, **kwargs
    1181│                 )
    1182│         except CalledProcessError as e:
  → 1183│             raise EnvCommandError(e, input=input_)
    1184│
    1185│         return decode(output)
    1186│
    1187│     def execute(self, bin, *args, **kwargs):

This appears to be due to the following at lines 1233-1236 in https://github.com/python-poetry/poetry/blob/1.1/poetry/utils/env.py:

            if not bin.endswith(".exe"):
                bin_path = self._bin_dir / (bin + ".exe")
            else:
                bin_path = self._path / bin

I believe in the first case self._path should be used instead of self._bin_dir.

This problem doesn't appear to happen (the function is never called) when poetry is installed with get-poetry.py instead of install-poetry.py. I don't know why that is, but it's a good workaround. I think the above code is wrong nonetheless.

@tom-bowles tom-bowles added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 8, 2021
@tom-bowles
Copy link
Author

FWIW this problem appears to have begun in 1.1.9.

@Luttik
Copy link

Luttik commented Oct 18, 2021

@tom-bowles great research. Poetry 1.1.8 works for me too, the latest version still seems to be broken.

@tom-bowles
Copy link
Author

With apologies, I'm pinging the 4 members of the python-poetry project since the "@python-poetry/triage" as mentioned in the docs doesn't work: @sdispater @abn @finswimmer @stephsamson

This issue has been present since 1.1.9 and renders poetry unusable on Windows. It's a simple typo with a one-line fix.

tom-bowles pushed a commit to tom-bowles/poetry that referenced this issue Oct 28, 2021
tom-bowles pushed a commit to tom-bowles/poetry that referenced this issue Oct 31, 2021
tom-bowles pushed a commit to tom-bowles/poetry that referenced this issue Nov 1, 2021
Parnassius added a commit to Parnassius/domify that referenced this issue Nov 26, 2021
floatingpurr added a commit to floatingpurr/sync_with_poetry that referenced this issue Dec 15, 2021
@zndr27
Copy link

zndr27 commented Dec 18, 2021

Any timeline on when this will be resolved?

@clintonroy
Copy link
Contributor

Have you tried installing poetry with pipx at all, does that get around this issue?

@shelper
Copy link

shelper commented Apr 9, 2022

Have you tried installing poetry with pipx at all, does that get around this issue?

tried and the answer is no...
i think this is also related to issue #2117

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
@neersighted neersighted added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 24, 2022
@neersighted
Copy link
Member

Closing as duplicate of #2117.

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
status/duplicate Duplicate issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants