Can`t use "opencv-python" in my project
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?
I manged to get it working. The issue is opencv-python from package manager seems to depend on a version of numpy that is incompatible with python 3.8. So is going to fail. You cannot use the package manager. You need to go to console and do pip install opencv-python then pip install numpy right after that. You might also want to instal opencv-python from package manager to get it failing once just so that replit recognizes cv2. It will NOT show up in the package manager list but python code seems to recognize it regardless.
If you read the error it literally tells you what the issue is. "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." ie the version that is trying to install is not compatible with python 3.7+
Someone should report it . I am guessing the issue is the package requirements are wrong for opencv-python and uses an incorrect version of numpy for Python 3.8.2.
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...
I try to do it thru Package Search from the left side. And when I try -- I see error with dependencies about "numpy" package.
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
'''
I need more, can you write more about it?
run 3
I'm having the same issue and it's driving me crazy!