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.

Verbose, somewhat misleading error trying to add `scipy`

See original GitHub issue

poetry init generates a pyproject.toml file with a reasonable python = "^3.9" tool dependency.

trying to poetry add scipy fails with an error:

> poetry add scipy
Using version ^1.7.0 for scipy

Updating dependencies
Resolving dependencies... (0.0s)

  SolverProblemError

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

  Because no versions of scipy match >1.7.0,<2.0.0
   and scipy (1.7.0) requires Python >=3.7,<3.10, scipy is forbidden.
  So, because randomness-testsuite depends on scipy (^1.7.0), version solving failed.

  at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For scipy, a possible solution would be to set the `python` property to ">=3.9,<3.10"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

for a new user, this is quite hard to understand:

  • at first it seems odd why poetry can’t find intersection between >=3.7,<3.10 and >=3.9,<4.0
  • then it’s quite confusing what >=3.10,<4.0 is
  • then there’s a traceback, which is a red herring
  • finally, there’s a practical advice about “python property”, which is useful
  • however, I feel that most users wouldn’t necessarily know what that is or where it is defined
  • the actual definition of “python property” is presented in a different format
  • ultimately, why does poetry complain about a hypothetical, future, unreleased version of python?

I wish this error was not tripped at all, given that current Python version is OK.

If it must be tripped, I wish that the error was more to the point and less verbose, e.g.:

  • the project is set up with python = "^3.9"
    • for Python 3.9.x, I would use scipy 1.7.0
    • for Python 3.10.x, I can’t find usable scipy version, STOP

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
clintonroycommented, Jul 28, 2021

I think: ^3.9 allows 3.10, which is incompatible with scipy. It’s nothing to do with your currently installed version of python, only to do with what’s specified in pyproject.toml. Try ~3.9 as the python version.

6reactions
lassepecommented, Aug 4, 2021

I guess what is confusing here is that python is a somewhat special dependency here: In contrast to normal package dependencies for which poetry only tries to find some version that satisfies all constraints, for python it requires that the specified dependencies work for all python versions in the specified bounds. I think that makes sense but it also took me a minute to figure out. Maybe the error message could be enhanced to clarify this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install Scipy through pip - Stack Overflow
After opening up an issue with the SciPy team, we found that you need to upgrade pip with: pip install --upgrade pip. And...
Read more >
SciPy 1.7.0 Release Notes — SciPy v1.9.3 Manual
SciPy 1.7.0 is the culmination of 6 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better...
Read more >
SciPy 1.9.0 Release Notes — SciPy v1.9.3 Manual
SphericalVoronoi now raises an error (not adding radius defaults to 1, ... will be a scalar or np.ndarray rather than a masked array...
Read more >
SciPy 1.8.0 Release Notes — SciPy v1.9.3 Manual
Add analog argument, default False , to zpk2sos , and add new pairing option ... #13922: Need Exception / Error for Incorrect and/or...
Read more >
SciPy 1.4.0 Release Notes — SciPy v1.9.3 Manual
x branch, and on adding new features on the master branch. This release requires Python 3.5+ and NumPy >=1.13.3 (for Python 3.5, 3.6),...
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