Skip to content
Can`t use "opencv-python" in my project
Profile icon
Igor-Belskiy

Consol show me this:

Replit: Updating package configuration

--> python3 -m poetry add opencv-python
Using version ^4.5.4 for opencv-python

Updating dependencies
Resolving dependencies...

SolverProblemError

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

Because no versions of numpy match >1.21.2,<1.21.3 || >1.21.3,<1.21.4 || >1.21.4
and numpy (1.21.2) requires Python >=3.7,<3.11, numpy is forbidden.
And because numpy (1.21.3) requires Python >=3.7,<3.11
and numpy (1.21.4) requires Python >=3.7,<3.11, numpy is forbidden.
Because no versions of opencv-python match >=4.5.4,<4.5.4.58 || >4.5.4.58,<5.0.0
and opencv-python (4.5.4.58) depends on numpy (>=1.21.2), opencv-python (>=4.5.4,<5.0.0) requires numpy (>=1.21.2).
Thus, opencv-python is forbidden.
So, because repl-python3-computervision-hands depends on opencv-python (^4.5.4), version solving failed.

at /opt/virtualenvs/python3/lib/python3.8/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 numpy, a possible solution would be to set the `python` property to ">=3.8,<3.11" For numpy, a possible solution would be to set the `python` property to ">=3.8,<3.11" For numpy, a possible solution would be to set the `python` property to ">=3.8,<3.11" https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies, https://python-poetry.org/docs/dependency-specification/#using-environment-markers

exit status 1

Replit: Package operation failed.


Looks like numpy can`t work with python 3.8 version.

Have any ideas how to solve this problem?

You are viewing a single comment. View All
Profile icon
AlexeyMokhov

Hi Igor,
How do you installing opencv? if using "pip install opencv-python" in command line, ensure to type it in replit Shell and NOT Console...

Profile icon
Igor-Belskiy

@AlexeyMokhov

I try to do it thru Package Search from the left side. And when I try -- I see error with dependencies about "numpy" package.

Profile icon
scenicsteve

@AlexeyMokhov
I'm experience the same thing when importing pandas. Thought this (https://forum.freecodecamp.org/t/python-pandas-replit-boilerplate-error/467707) might be the solution (specifically attempting to install an older version of Pandas, but no dice.

I also tried installing pandas in the Shell with pip and that was successful, but when attempting to run the code I get the same error.

'''
Package operations: 1 install, 1 update, 0 removals

• Updating numpy (1.21.2 -> 1.21.5)

RuntimeError

Unable to find installation candidates for numpy (1.21.5)

at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/installation/chooser.py:72 in choose_for
68│
69│ links.append(link)
70│
71│ if not links:
→ 72│ raise RuntimeError(
73│ "Unable to find installation candidates for {}".format(package)
74│ )
75│
76│ # Get the best link

Failed to add packages, reverting the pyproject.toml file to its original content.
exit status 1
'''