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 Downloads 1st Wheel File from PyPi Regardless of Python version or OS. Unusable on Windows for projects with Pandas/Numpy #944

Closed
3 tasks done
KyleKing opened this issue Mar 8, 2019 · 7 comments

Comments

@KyleKing
Copy link
Contributor

KyleKing commented Mar 8, 2019

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

SysInfo

  • OS version and name: Windows 7 [Version 6.1.7601]
  • Poetry version: 1.0.0a2
  • pyproject.toml file (labeled as .txt to upload - nothing special, just default): pyproject.toml.txt

Issue

I think there is a problem in the wheels resolver in Poetry. I found a couple of test cases that build wheels targeting multiple OS and Python versions. In all cases, it looks like Poetry is downloading the first Wheel regardless of Python/OS constraints, then crashes with a [WinError 145] The directory is not empty: 'C:\\Users\\KING~1.KYL\\AppData\\Local\\Temp\\tmpopks2va_'.

Originally I posted issue #807, but I think this might be a larger issue with Poetry and not just Numpy, so I think a new ticket is more appropriate to track this issue.

Below is the abbreviated output for attempting an install of each of numpy and pywin32. The full log for all 6 packages is attached: FullLogs.txt

I think the relevant line is PyPI: Downloading wheel: pywin32-224-cp27-cp27m-win32.whl (cp27) where the correct version should have been: pywin32-224-cp37-cp37m-win32.whl (cp37)

>> poetry --version
Poetry version 1.0.0a2

>> poetry new TestWheelResolver
>> cd TestWheelResolver
>> poetry add pywin32 -vvv
Using virtualenv: C:\Users\king.kyle\AppData\Local\pypoetry\Cache\virtualenvs\mmuu-_zx5-I-Q-py3.7
PyPI: No release information found for pywin32-210, skipping
PyPI: No release information found for pywin32-214, skipping
PyPI: 3 packages found for pywin32 *
Using version ^224.0 for pywin32

Updating dependencies
Resolving dependencies...
   1: fact: testwheelresolver is 0.1.0
   1: derived: testwheelresolver
   1: fact: testwheelresolver depends on pywin32 (^224.0)
   1: fact: testwheelresolver depends on pytest (^3.0)
   1: selecting testwheelresolver (0.1.0)
   1: derived: pytest (^3.0)
   1: derived: pywin32 (^224.0)
PyPI: 44 packages found for pytest >=3.0,<4.0
PyPI: No release information found for pywin32-210, skipping
PyPI: No release information found for pywin32-214, skipping
PyPI: 1 packages found for pywin32 >=224.0,<225.0
PyPI: Getting info for pywin32 (224) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading wheel: pywin32-224-cp27-cp27m-win32.whl
   1: Version solving took 16.753 seconds.
   1: Tried 1 solutions.

>> poetry add numpy -vvv
Using virtualenv: C:\Users\king.kyle\AppData\Local\pypoetry\Cache\virtualenvs\mmuu-_zx5-I-Q-py3.7
PyPI: No release information found for numpy-0.9.6, skipping
PyPI: No release information found for numpy-0.9.8, skipping
PyPI: No release information found for numpy-1.0.3, skipping
PyPI: No release information found for numpy-1.0.4, skipping
PyPI: No release information found for numpy-1.0b1, skipping
PyPI: No release information found for numpy-1.0b4, skipping
PyPI: No release information found for numpy-1.0b5, skipping
PyPI: No release information found for numpy-1.0rc1, skipping
PyPI: No release information found for numpy-1.0rc2, skipping
PyPI: No release information found for numpy-1.0rc3, skipping
PyPI: No release information found for numpy-1.1.1, skipping
PyPI: No release information found for numpy-1.2.0, skipping
PyPI: No release information found for numpy-1.2.1, skipping
PyPI: No release information found for numpy-1.4.0, skipping
PyPI: 47 packages found for numpy *
Using version ^1.16 for numpy

Updating dependencies
Resolving dependencies...
   1: fact: testwheelresolver is 0.1.0
   1: derived: testwheelresolver
   1: fact: testwheelresolver depends on numpy (^1.16)
   1: fact: testwheelresolver depends on pytest (^3.0)
   1: selecting testwheelresolver (0.1.0)
   1: derived: pytest (^3.0)
   1: derived: numpy (^1.16)
PyPI: 44 packages found for pytest >=3.0,<4.0
PyPI: No release information found for numpy-0.9.6, skipping
PyPI: No release information found for numpy-0.9.8, skipping
PyPI: No release information found for numpy-1.0.3, skipping
PyPI: No release information found for numpy-1.0.4, skipping
PyPI: No release information found for numpy-1.0b1, skipping
PyPI: No release information found for numpy-1.0b4, skipping
PyPI: No release information found for numpy-1.0b5, skipping
PyPI: No release information found for numpy-1.0rc1, skipping
PyPI: No release information found for numpy-1.0rc2, skipping
PyPI: No release information found for numpy-1.0rc3, skipping
PyPI: No release information found for numpy-1.1.1, skipping
PyPI: No release information found for numpy-1.2.0, skipping
PyPI: No release information found for numpy-1.2.1, skipping
PyPI: No release information found for numpy-1.4.0, skipping
PyPI: 3 packages found for numpy >=1.16,<2.0
PyPI: Getting info for numpy (1.16.2) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading sdist: numpy-1.16.2.zip
PyPI: Downloading wheel: numpy-1.16.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
   1: Version solving took 26.382 seconds.
   1: Tried 1 solutions.

I will have some time this weekend to try to help figure out the root cause and if so, submit a PR. I'll also compare to Mac and see if this is Windows-only. Need to consider the wide list of possible platforms: https://github.com/easybuilders/easybuild/wiki/OS_flavor_name_version

This might be what needs to be updated: https://github.com/sdispater/poetry/blob/271e995844db11a40c7c4a0b320bf9bd600db444/poetry/repositories/pypi_repository.py#L423-L425

Update: so the OSError is Windows-only. On Mac, the wrong cp27 wheel is downloaded for cp37 ([tool.poetry.dependencies]\n python = "^3.7") for both Pillow and Pygame, but install completes without issue.

I started a potential fix in this branch: https://github.com/KyleKing/poetry/tree/fix/944-select_wheel

@KyleKing
Copy link
Contributor Author

Tested fix (new debugging lines start with an asterisks *PyPI). Picks correct wheel for pywin32 and others

(py372) C:\Users\king.kyle\testing>poetry add pywin32 -vvv
Using virtualenv: C:\Users\king.kyle\AppData\Local\pypoetry\Cache\virtualenvs\testing-py3.7
PyPI: No release information found for pywin32-210, skipping
PyPI: No release information found for pywin32-214, skipping
PyPI: 3 packages found for pywin32 *
Using version ^224.0 for pywin32

Updating dependencies
Resolving dependencies...
   1: fact: testing is 0.1.0
   1: derived: testing
   1: fact: testing depends on pywin32 (^224.0)
   1: fact: testing depends on pytest (^3.0)
   1: selecting testing (0.1.0)
   1: derived: pytest (^3.0)
   1: derived: pywin32 (^224.0)
   1: fact: pytest (3.10.1) depends on py (>=1.5.0)
   1: fact: pytest (3.10.1) depends on six (>=1.10.0)
   1: fact: pytest (3.10.1) depends on attrs (>=17.4.0)
   1: fact: pytest (3.10.1) depends on more-itertools (>=4.0.0)
   1: fact: pytest (3.10.1) depends on atomicwrites (>=1.0)
   1: fact: pytest (3.10.1) depends on pluggy (>=0.7)
   1: fact: pytest (3.10.1) depends on colorama (*)
   1: selecting pytest (3.10.1)
   1: derived: colorama (*)
   1: derived: pluggy (>=0.7)
   1: derived: atomicwrites (>=1.0)
   1: derived: more-itertools (>=4.0.0)
   1: derived: attrs (>=17.4.0)
   1: derived: six (>=1.10.0)
   1: derived: py (>=1.5.0)
PyPI: No release information found for pywin32-210, skipping
PyPI: No release information found for pywin32-214, skipping
PyPI: 1 packages found for pywin32 >=224.0,<225.0
PyPI: Getting info for pywin32 (224) from PyPI
PyPI: No dependencies found, downloading archives
*PyPI: Attempting to determine best match for: {'plat': 'windows', 'machine': 'amd64', 'pyver': ('3', '7', '2')}
*PyPI: Found best wheel match: https://files.pythonhosted.org/packages/a3/8a/eada1e7990202cd27e58eca2a278c344fef190759bbdc8f8f0eb6abeca9c/pywin32-224-cp37-cp37m-win_amd64.whl
*PyPI: Downloading wheel: pywin32-224-cp37-cp37m-win_amd64.whl
   1: selecting pywin32 (224)
   1: selecting colorama (0.4.1)
   1: selecting pluggy (0.9.0)
   1: selecting atomicwrites (1.3.0)
   1: selecting more-itertools (6.0.0)
   1: selecting attrs (19.1.0)
   1: selecting six (1.12.0)
   1: selecting py (1.8.0)
   1: Version solving took 1.654 seconds.
   1: Tried 1 solutions.


Package operations: 1 install, 0 updates, 0 removals

Writing lock file

  - Installing pywin32 (224)

(py372) C:\Users\king.kyle\testing>

@facthunter
Copy link

@sdispater, Is there an update on this issue? I can't use poetry until it is fixed.

@KyleKing
Copy link
Contributor Author

KyleKing commented Apr 9, 2019

@facthunter there is a PR pending review #955

I built a Poetry wheel from my branch that you can install if you absolutely need it. See #807 (comment)

@KyleKing KyleKing changed the title Possible Bug in Poetry's Wheel File Resolution (Impacts Numpy, PyWin32, Pillow, Pygame, etc.) Poetry Downloads first Wheel Files from PyPi Regardless of Python version or OS (Impacts Numpy, PyWin32, Pillow, Pygame, etc.) Aug 11, 2019
@KyleKing KyleKing changed the title Poetry Downloads first Wheel Files from PyPi Regardless of Python version or OS (Impacts Numpy, PyWin32, Pillow, Pygame, etc.) Poetry Downloads 1st Wheel File from PyPi Regardless of Python version or OS. Unusable on Windows for projects with Pandas/Numpy Aug 11, 2019
@KyleKing
Copy link
Contributor Author

KyleKing commented Sep 1, 2019

Tested installing numpy, pywin32, pypiwin32, and more-itertools. Poetry ^0.12.17 || ^1.0.0b* appear to have improvements that resolve this issue. I've closed the PR #1144, but poetry could probably still use better wheel-file selection logic...

https://github.com/sdispater/poetry/blob/af57f15c9dae32a84b9d68ef3382dcae778546f0/poetry/repositories/pypi_repository.py#L443-L445

@KyleKing KyleKing closed this as completed Sep 1, 2019
@yihuang
Copy link

yihuang commented Oct 19, 2020

I still have this issue, reproduce:

$ python3 --version
Python 3.8.5
$ uname
Darwin
$ poetry --version
Poetry version 1.1.2
$ poetry new testpoetry
$ cd testpoetry
$ poetry add -vvv web3
...
PyPI: Getting info for pywin32 (228) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading wheel: pywin32-228-cp27-cp27m-win32.whl

@abn
Copy link
Member

abn commented Oct 19, 2020

@yihuang that is expected behaviour at the moment when PyPI metadata does not contain requirement information. We pick the first available wheel and derive core metadata from it. This is not the wheel that gets installed. This is only used for inspection.

Copy link

github-actions bot commented Mar 2, 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 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants