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 Numpy as Mac OSX Wheel on Windows Laptop & Throws [WinError 145] #807

Closed
3 tasks done
KyleKing opened this issue Jan 18, 2019 · 9 comments
Closed
3 tasks done

Comments

@KyleKing
Copy link
Contributor

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate. (Searched for WinError 145, numpy, etc.)

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Windows 7

  • Poetry version: 0.12.11

  • Linked pyproject.toml file (renamed as .toml.txt to upload): pyproject.toml.txt

Issue

Can be reproduced on my laptop with the below script. When attempting to add Numpy, it returns a directory not empty error and can't get past that.

poetry new test_numpy
cd test_numpy
poetry install
poetry add numpy -vvv

In the debug message below, Poetry downloads numpy-1.16.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.wh but I'm on a Windows system

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

(py37) C:\Users\king.kyle\Developer\_test_numpy>poetry install
Updating dependencies
Resolving dependencies...

Nothing to install or update

Writing lock file

  - Installing test_numpy (0.1.0)

(py37) C:\Users\king.kyle\Developer\_test_numpy>poetry add numpy -vvv
Using virtualenv: C:\Users\king.kyle\AppData\Local\pypoetry\Cache\virtualenvs\mm-upgrade-utility-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: 45 packages found for numpy *
Using version ^1.16 for numpy

Updating dependencies
Resolving dependencies...
   1: fact: test-numpy is 0.1.0
   1: derived: test-numpy
   1: fact: test-numpy depends on numpy (^1.16)
   1: fact: test-numpy depends on pytest (^3.0)
   1: selecting test-numpy (0.1.0)
   1: derived: pytest (^3.0)
   1: derived: numpy (^1.16)
   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 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: 1 packages found for numpy >=1.16,<2.0
PyPI: Getting info for numpy (1.16.0) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading sdist: numpy-1.16.0.zip
PyPI: Downloading wheel: numpy-1.16.0-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 15.665 seconds.
   1: Tried 1 solutions.

[OSError]
[WinError 145] The directory is not empty: 'C:\\Users\\KING~1.KYL\\AppData\\Local\\Temp\\tmp774m6ge1'

Exception trace:
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cleo\application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 C:\Users\king.kyle\.poetry\lib\poetry\console\application.py in do_run() at line 89
   return super(Application, self).do_run(i, o)
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cleo\application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 C:\Users\king.kyle\.poetry\lib\poetry\console\commands\command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\command.py in execute() at line 107
   return self.handle()
 C:\Users\king.kyle\.poetry\lib\poetry\console\commands\add.py in handle() at line 139
   status = installer.run()
 C:\Users\king.kyle\.poetry\lib\poetry\installation\installer.py in run() at line 76
   self._do_install(local_repo)
 C:\Users\king.kyle\.poetry\lib\poetry\installation\installer.py in _do_install() at line 158
   ops = solver.solve(use_latest=self._whitelist)
 C:\Users\king.kyle\.poetry\lib\poetry\puzzle\solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 C:\Users\king.kyle\.poetry\lib\poetry\puzzle\solver.py in _solve() at line 171
   self._package, self._provider, locked=locked, use_latest=use_latest
 C:\Users\king.kyle\.poetry\lib\poetry\mixology\__init__.py in resolve_version() at line 7
   return solver.solve()
 C:\Users\king.kyle\.poetry\lib\poetry\mixology\version_solver.py in solve() at line 79
   next = self._choose_package_version()
 C:\Users\king.kyle\.poetry\lib\poetry\mixology\version_solver.py in _choose_package_version() at line 378
   version = self._provider.complete_package(version)
 C:\Users\king.kyle\.poetry\lib\poetry\puzzle\provider.py in complete_package() at line 462
   package.name, package.version.text, extras=package.requires_extras
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pool.py in package() at line 49
   package = repository.package(name, version, extras=extras)
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in package() at line 146
   release_info = self.get_release_info(name, version)
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in get_release_info() at line 249
   "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cachy\repository.py in remember_forever() at line 174
   val = value(callback)
 C:\Users\king.kyle\.poetry\lib\poetry\_vendor\py3.7\cachy\helpers.py in value() at line 6
   return val()
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in <lambda>() at line 249
   "{}:{}".format(name, version), lambda: self._get_release_info(name, version)
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in _get_release_info() at line 371
   info = self._get_info_from_urls(urls)
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in _get_info_from_urls() at line 399
   return self._get_info_from_wheel(urls["bdist_wheel"])
 C:\Users\king.kyle\.poetry\lib\poetry\repositories\pypi_repository.py in _get_info_from_wheel() at line 425
   return info
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\contextlib.py in __exit__() at line 119
   next(self.gen)
 C:\Users\king.kyle\.poetry\lib\poetry\utils\helpers.py in temporary_directory() at line 35
   yield name
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\tempfile.py in __exit__() at line 805
   self.cleanup()
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\tempfile.py in cleanup() at line 809
   _shutil.rmtree(self.name)
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\shutil.py in rmtree() at line 507
   return _rmtree_unsafe(path, onerror)
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\shutil.py in _rmtree_unsafe() at line 395
   onerror(os.rmdir, path, sys.exc_info())
 C:\Users\king.kyle\AppData\Local\Continuum\anaconda2\envs\py37\lib\shutil.py in _rmtree_unsafe() at line 393
   os.rmdir(path)

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
@KyleKing KyleKing changed the title Download Mac OSX Wheel on Windows + [WinError 145] Poetry appears to download Numpy as Mac OSX Wheel on Windows Laptop & Throws [WinError 145] Jan 18, 2019
@KyleKing KyleKing changed the title Poetry appears to download Numpy as Mac OSX Wheel on Windows Laptop & Throws [WinError 145] Poetry downloads Numpy as Mac OSX Wheel on Windows Laptop & Throws [WinError 145] Jan 18, 2019
@KyleKing
Copy link
Contributor Author

KyleKing commented Jan 18, 2019

The Numpy release files include valid Windows wheels, but it looks Poetry attempts to install the first one (...cp27m-macosx_10_6_intel...): https://pypi.org/project/numpy/#files

The correct release should be: numpy-1.16.0-cp37-cp37m-win32.whl. Downloading this wheel file and installing directly works: poetry add numpy --path C:\Users\king.kyle\Developer\numpy-1.16.0-cp37-cp37m-win32.whl

@Pluckerpluck
Copy link

Pluckerpluck commented Jan 25, 2019

I just ran into the same issue when creating a new project.

I generated the pyproject.toml and then it failed to poetry install with the same error.

I then used poetry remove numpy, which started installing the dependencies into the virtual environment, and interestingly happily installed numpy as it was a dependency of pandas. So it installed fine... just not when it was directly referenced in the pyproject.toml (it was the first dependency in the list).

Edit: So I don't know how I got it to install correctly before. I can no longer do it without getting the wheel manually.

@Pluckerpluck
Copy link

Is there a way around this problem without manually downloading the wheel? This is actually a major frustration right now, as nobody can sensibly create new projects, as everything we do involves numpy (or pandas).

@KyleKing
Copy link
Contributor Author

KyleKing commented Mar 8, 2019

I think this is a larger issue with Poetry, so I created a new ticket to track this: #944

In the meantime, I found that downloading and linking the correct wheel files for Numpy, pywin32, and pypiwin32 were the only workaround 🤕

@KyleKing KyleKing closed this as completed Mar 8, 2019
@KyleKing
Copy link
Contributor Author

KyleKing commented Mar 11, 2019

I'm ~90% certain that I fixed it! I need to add a test, prep a PR for master (instead of develop), and fix a few small things, but you can start using my development branch until it's merged: debug/issue-944-pickWheel (Use fix/944-select_wheel instead)

git clone https://github.com/KyleKing/poetry.git
cd poetry
git checkout fix/944-select-wheel
poetry install
# Manually edit: "./poetry/__version__.py" with a new version like: 0.12.11a0
poetry version 0.12.11a0
poetry build

To use in Python2 or Python3 environment:

pip install ./<pathTo>/poetry/dist/poetry-0.12.11a0-py2.py3-none-any.whl
poetry install
poetry add numpy  # rejoice!

Let me know if that helps resolve your issue and if this fix works

@KyleKing
Copy link
Contributor Author

KyleKing commented Mar 12, 2019

I submitted a PR (#955)



@vincedgy
Copy link

On MAC Os BigSur (11.1)

I've being facing similar issues all day with numpy fail install itself with pandas with Python 3.9.1.6 and poetry 1.1.4.

I understood that poetry uses pip which does not use the wheel version of numpy with pip <= 20.2.x

This is how I managed to install what I needed :

First check the default version of Python linked to poetry (reinstall it if it does not fit)

poetry env info | grep -i python
Python:         3.9.1
Implementation: CPython
Python:   /usr/local/Cellar/[email protected]/3.9.1_6/Frameworks/Python.framework/Versions/3.9

Install you project and run poetry init without any dependencies you seek (you'll use poetry add <deps> juste after...)

You should obtain something similar to this pyproject.toml :

[tool.poetry]
name = "project1"
version = "0.1.0"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Launch the poetry shell

➜  project1 poetry shell

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).
You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

Spawning shell within /Users/vincent/Library/Caches/pypoetry/virtualenvs/project1-5XOg8Qie-py3.9
➜  project1 . /Users/vincent/Library/Caches/pypoetry/virtualenvs/project1-5XOg8Qie-py3.9/bin/activate
(project1-5XOg8Qie-py3.9) ➜  project1

At this point upgrade pip, wheel and setuptools !

(project1-5XOg8Qie-py3.9) ➜  project1 $ pip install --upgrade pip wheel setuptools
Looking in indexes: https://pypi.python.org/simple/
Collecting pip
  Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting setuptools
  Using cached setuptools-51.1.2-py3-none-any.whl (784 kB)
Installing collected packages: pip, wheel, setuptools
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
  Attempting uninstall: wheel
    Found existing installation: wheel 0.35.1
    Uninstalling wheel-0.35.1:
      Successfully uninstalled wheel-0.35.1
  Attempting uninstall: setuptools
    Found existing installation: setuptools 50.3.2
    Uninstalling setuptools-50.3.2:
      Successfully uninstalled setuptools-50.3.2
Successfully installed pip-20.3.3 setuptools-51.1.2 wheel-0.36.2

Now installation should be ok

(project1-5XOg8Qie-py3.9) ➜  project1 poetry install
Installing dependencies from lock file

Package operations: 5 installs, 0 updates, 0 removals

  - Installing six (1.15.0)
  - Installing numpy (1.19.5)
  - Installing python-dateutil (2.8.1)
  - Installing pytz (2020.5)
  - Installing pandas (1.2.0)

Installing the current project: project1 (0.1.0)

Yeepee !

@JezuzStardust
Copy link

@vincedgy I tried this, but did not get it to work. Specifically numpy was the problem. However, using:
poetry config experimental.new-installer false first, solved the issues for me.

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

No branches or pull requests

4 participants