PyPy3 won't install OpenCV - python

I am writing a program that splits a video into frames and extract the text of every nth frame using opencv-python and pytesseract. I managed to get the code working, but the program was working rather slowly. I tried to use PyPy3 to improve performance but ran into an issue installing the opencv library for pypy.
This is the error code:
Collecting opencv-python
Using cached opencv-python-4.6.0.66.tar.gz (90.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy>=1.14.5 in /usr/local/Cellar/pypy3/7.3.9/libexec/site-packages (from opencv-python) (1.21.6)
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (pyproject.toml): started
Building wheel for opencv-python (pyproject.toml): finished with status 'error'
Failed to build opencv-python
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
error: subprocess-exited-with-error
× Building wheel for opencv-python (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
Traceback (most recent call last):
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/cmaker.py", line 141, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/cmaker.py", line 96, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable
Problem with the CMake installation, aborting build. CMake executable is cmake
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for opencv-python
ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
I feel like I tried everything. I successfully installed all other dependencies using
pypy3 -m pip install [package]
Yes, I already upgraded my pip, setuptools and wheels to the latest version.
Any other relevant information:
interpreter path: /usr/local/bin/pypy3
Python version: PyPy 7.3.9 [Python 3.7.13]
OS: MacOS
What I understand is that the error lies with building the wheels and I read something about building the package myself. I couldn't figure it out tho. Any help would be much appreciated.
EDIT:
I installed cmake using brew install cmake. Now when I try to install opencv-python, instead of raising an ERROR, the cmd gets stuck at
Building wheel for opencv-python (pyproject.toml) ... |

The error message states that it may be linked to cmake, You can try to install it. -> https://cmake.org/install/

Related

I can't figure out pip tensorrt line 17 error

I couldn't install it in any way, I wonder what could be the cause of the error.
I installed C++ and other necessary stuff
I am using windows 11
I installed pip install nvidia-pyindex with no problem.
Same as tensorrt I can't install pycuda library and I get same error
\`
(base) PS C:\\Users\\byara\> pip install nvidia-tensorrt
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting nvidia-tensorrt
Downloading nvidia-tensorrt-0.0.1.dev5.tar.gz (7.9 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─\> \[17 lines of output\]
Traceback (most recent call last):
File "\<string\>", line 2, in \<module\>
File "\<pip-setuptools-caller\>", line 34, in \<module\>
File "C:\\Users\\byara\\AppData\\Local\\Temp\\pip-install-ak3sxwfw\\nvidia-tensorrt_a7512906bd3241728853c0e6a10bf9d4\\setup.py", line 150, in \<module\>
raise RuntimeError(open("ERROR.txt", "r").read())
RuntimeError:
\###########################################################################################
The package you are trying to install is only a placeholder project on PyPI.org repository.
This package is hosted on NVIDIA Python Package Index.
This package can be installed as:
`
$ pip install nvidia-pyindex
$ pip install nvidia-tensorrt
`your text`
###########################################################################################
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─\> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
\`
TensorRT is not available for Windows via pip. You can verify that by looking at the wheel files in PyPI, link. All the wheel files for the latest version are for Linux. Thus, trying to install on Windows will pick the previous releases, which were place-holder packages. Those releases just print the message you are seeing, on all OSes.
According to the documentation
The zip file is the only option currently for Windows.
You can find instructions on how to install at Zip File Installation.

Issues installing python typedb-client on macOs m1 architecture

When I try to install the python typedb-client using pip, I get several errors concerning grpcio:
Building wheels for collected packages: grpcio
Building wheel for grpcio (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21870 lines of output]
ASM Builds for BoringSSL currently not supported on: macosx-11.1-arm64
as well as many lines of:
...
distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
...
This happens both on global installation and in conda environments...
After searching for grpcio installation issues on the M1 architecture, the solution for me was to prepend the following to the pip command:
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install typedb-client==2.9.0
in some cases, should you see ssl errors, you can extend that command to:
CFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install typedb-client==2.9.0
assuming that you have openssl install via homebrew. This tells pip where to look for appropriate headers and code to build the grpcio pip package.

Heroku pip install suddenly started to return an error: use_2to3 is invalid

Heroku deploy started to return this error when trying to deploy a python app:
-----> Installing requirements with pip
Collecting amqp==2.6.1
Downloading amqp-2.6.1-py2.py3-none-any.whl (48 kB)
Collecting anyjson==0.3.3
Downloading anyjson-0.3.3.tar.gz (8.3 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in anyjson setup command: use_2to3 is invalid.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
! Push rejected, failed to compile Python app.
! Push failed
There was no change in requirements.txt
Heroku recently updated setuptools to 60.10.0 for python build pack
However, the setuptools upgrade also drops support for the deprecated
use_2to3 feature, which may be used be a small number of legacy
dependency versions. This change occurred in setuptools 58.0.0
(released 2021-09-04), which we have deliberately not updated to for
as long as possible, in order to give any affected packages time to be
fixed. However it's no longer viable to delay updating any longer, due
to the pipenv compatibility issues.
The above pull request have some options to fix affected packages. In my case we didn't need anyjson anyway, removing it from requirements.txt fixed the problem
I had the same error, unfortunately the downgrade setuptools didn't help me. In my case, the solution was to uninstall the kombu package (ofc if you don't use Celery in your project)

getting unexpected error while executing the code (with sr.Microphone() as source:)

I am making an Ai personal assistant on my laptop but i am getting this error.
I am using python version 3.10.4 and still i am getting this print error.
I am getting error in the line
with sr.Microphone() as source():
due to which even the microphone icon in the taskbar is not coming
plz do help to resolve it.
thanks.
i have installed pyaudio file from google
plz tell how to resolve this.
error coming while upgrading pip to the latest version ----
C:\Users\DELL>pip install --upgrade pyaudio
Requirement already satisfied: pyaudio in c:\users\dell\appdata\local\programs\python\python310\lib\site-packages (0.2.4)
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
copying src\pyaudio.py -> build\lib.win-amd64-3.10
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Attempting uninstall: pyaudio
Found existing installation: PyAudio 0.2.4
ERROR: Cannot uninstall 'PyAudio'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
error
In Python 2.xx, you can call print without parenthesis but in Python 3.xx, you need to call print with parenthesis. It seems like the version of pyaudio you are using is on Python 2.xx because the print statement where you are getting the error is missing parenthesis. Can you check your version of pyaudio? The latest version seems to be 0.2.11.
According to the error you are getting, you have not entered the other parenthesis at the end of the sentence. So try entering the missing parenthesis there.
If that doesn't work, try making another function like
def prn(text):
print(text)
And then calling that function instead of the print function there.

Failed/error to install psycopg2-binary on termux

u0_a439#localhost: /data/data/com.termux/files/home/storage/shared/z_termux
➜ pip3 install psycopg2-binary
i want to install psycopg2-binary on termux, but i got error like this.
Collecting psycopg2-binary
Using cached psycopg2-binary-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ayuu7y_q/psycopg2_binary.egg-info
writing /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ayuu7y_q/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ayuu7y_q/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ayuu7y_q/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ayuu7y_q/psycopg2_binary.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details. /2.4s
u0_a439#localhost: /data/data/com.termux/files/home/storage/shared/z_termux
➜
I'm very grateful if someone help solve this problem
I think psycopg2-binary package has been pre-built assuming that it would run on a Linux system which uses the glibc implementation as the standard C library. Termux runs on Android, which does not use glibc. So I think what is happening is that pip understands that and falls back to building psycopg from source, in which case the build dependencies should be installed before.
Try installing the build dependencies:
apt-get install libpq-dev gcc python3-dev musl-dev
See https://github.com/psycopg/psycopg2/issues/684
A web search for the same problem shows that this is also the case for other Linux systems that don't use glibc, like Alpine Linux.

Categories