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 on Windows 10 + pyenv-win is quickly corrupted

See original GitHub issue
  • I am on the latest Poetry version (reason below).
  • 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).

Issue

I spent several days trying to install poetry on my Windows workstation (after already using it for months on my Linux PCs). After trying the following methods (which failed):

  • Global python installation + PowerShell command
  • pyenv-win + PowerShell command
  • pyenv-win + pipx + poetry==1.0.10

I got poetry to work using:

  1. Uninstalling global python and removing entries from PATH
  2. Installing pyenv-win 2.64.1
  3. Installing python using pyenv install 3.8.2 and pyenv global 3.8.2
  4. Installing pipx using pip install pipx
  5. Correctly adding all directories to PATH
  6. Installing poetry using pipx install poetry==1.1.0b2 (beta was required to get poetry to run - got the tip from another issue)

Running poetry install on a project worked once, but broke when trying again on another project. So what already fails then is the following:

  1. Create a new project using poetry new blablub
  2. poetry add tqdm (or insert any other package here) fails with
  Command C:\Users\Karlson\AppData\Local\pypoetry\Cache\virtualenvs\blablub-HgamxXlr-py3.8\Scripts\pip.exe install --no-deps file://C:\Users\Karlson\AppData\Local\pypoetry\Cache\artifacts\be\98\c7\69fe6fea7a59659af1c6260899226129565330b1e07c9c5b3769be76bf\six-1.15.0-py2.py3-none-any.whl errored with the following return code 1, and output:
  Processing c:\users\karlson\appdata\local\pypoetry\cache\artifacts\be\98\c7\69fe6fea7a59659af1c6260899226129565330b1e07c9c5b3769be76bf\six-1.15.0-py2.py3-none-any.whl
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\Karlson\AppData\Local\pypoetry\Cache\virtualenvs\blablub-HgamxXlr-py3.8\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Karlson\\AppData\\Local\\Temp\\pip-req-build-mm0i0yyu\\setup.py'"'"'; __file__='"'"'C:\\Users\\Karlson\\AppData\\Local\\Temp\\pip-req-build-mm0i0yyu\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Karlson\AppData\Local\Temp\pip-pip-egg-info-sly7kipr'
           cwd: C:\Users\Karlson\AppData\Local\Temp\pip-req-build-mm0i0yyu\
      Complete output (5 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "c:\users\karlson\.pyenv\pyenv-win\versions\3.8.2\lib\tokenize.py", line 392, in open
          buffer = _builtin_open(filename, 'rb')
      FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Karlson\\AppData\\Local\\Temp\\pip-req-build-mm0i0yyu\\setup.py'
      ----------------------------------------
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Gist with the full debug output: https://gist.github.com/kiudee/70df85a30c7caed4156fc490d2569d02

Installing the same package in the pyenv environment using pip install six works perfectly fine.

Let me know if you need more information to debug the problem.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
JayDoubleucommented, Oct 27, 2021

This is pretty annoying. I just deleted cache directory at least 20 times today during development. I would appreciate if this could be prioritized

2reactions
gwdekkercommented, Aug 12, 2020

I have a very similar experience when trying to let poetry work with multiple python versions on Windows. In my experience, pyenv-win and poetry do not play nicely so I dropped that option - instead, having several pythons installed in Windows through the standard python.org Windows installers, added only one to PATH. Now I experience the following:

  • Poetry 1.0.10 seems to work fine as long as you use the same python version poetry was installed with
  • Poetry 1.0.10 crashes when trying poetry env use, as covered in issue #2698. This issue suggests using 1.1.0b2 instead.
  • Poetry 1.1.0b2 shows exactly the same instable behavior for me as experenced by OP.
  • Poetry 1.0.9 does not crash when using poetry env use
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Poetry on Windows 10 + pyenv-win is quickly corrupted. ... Coming soon: A brand new website interface for an even better experience!
Read more >
How to Set Up Pyenv and Poetry on Windows 10 for Python ...
Install Pyenv​​ The first step is to open a Git terminal and download the pyenv-win project from Github. Restart your Git session and...
Read more >
Ask HN: Why Poetry did not become a mainstream package ...
Personally, I use pipenv (manages package dependencies and sub-dependencies), pyenv (python version management), and pyenv-virtualenv ...
Read more >
Python poetry install failure - invalid hashes - Stack Overflow
There are several issue reports about invalid hashes. One common cause is running multiple Poetry instances simultaneously; ...
Read more >
Mastering Python - Second Edition - Packt
Creating environments using venv , pipenv , poetry , pyenv , and anaconda ... And for Windows cmd.exe (assuming python.exe is in your...
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