poetry: poetry install extremely slow when installing scipy

  • 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: Arch Linux & Docker environment python:latest (currently python-3.10 with debian bullseye)

  • Poetry version: 1.1.12

  • **Link of a Gist **

Issue

Installation of scipy takes a very long time (>5 min) when running

poetry install

The Gist above is a reduced version where the long installation occurs because scipy is a dependency for spatialmath-python. I ran with -vvv at the beginning and it is shown again that Python 3.10 is used. When coming to scipy it say

1: fact: scipy (1.7.3) requires Python >=3.7,❤️.11 1: derived: not scipy (==1.7.3) 1: fact: scipy (1.7.2) requires Python >=3.7,❤️.11 1: derived: not scipy (==1.7.2) 1: fact: scipy (1.7.1) requires Python >=3.7,❤️.10 1: derived: not scipy (==1.7.1) 1: fact: scipy (1.7.0) requires Python >=3.7,❤️.10 1: derived: not scipy (==1.7.0) 1: fact: scipy (1.6.3) requires Python >=3.7,❤️.10 1: derived: not scipy (==1.6.3) 1: fact: scipy (1.6.2) requires Python >=3.7,❤️.10 1: derived: not scipy (==1.6.2) 1: fact: scipy (1.6.1) depends on numpy (>=1.16.5) 1: selecting scipy (1.6.1)

which I don’t understand, since Python 3.10 is used.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 18 (8 by maintainers)

Most upvoted comments

I had a very similar problem. My project’s dependencies were python = "^3.10" and statsmodels = "0.13.1", which resulted in Poetry deciding to pull in scipy@1.6.1 for whatever reason (which does not have pre-built wheels for Python 3.10). I explicitly did poetry add scipy@1.8.0, which resulted in SolveFailure:

The current project's Python requirement (>=3.10,<4.0) is not compatible with some of the required packages Python requirement:
  - scipy requires Python >=3.8,<3.11, so it will not be satisfied for Python >=3.11,<4.0

This makes sense, because python = "^3.10" does not guarantee scipy’s requirement for ❤️.11. I changed my Python dependency to python = "3.10" (explicitly == 3.10, not >= 3.10), which allowed scipy@1.8.0 to be added. Then I tried a fresh poetry install, which finished in a matter of seconds because the pre-built scipy@1.8.0 wheel is now being used.

I think the root cause of all this (at least in my case) is the fact that Poetry originally chose scipy@1.6.1 to satisfy statsmodels@0.13.1 (which required building scipy from source) instead of a later version that has a pre-built wheel available.

err, wheels 😉

Right, so at a guess there are pre compiled eggs for everything for python 3.9, but not for 3.10.