Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient memory #957

Open
Dhruv00710 opened this issue Feb 25, 2024 · 11 comments
Open

Insufficient memory #957

Dhruv00710 opened this issue Feb 25, 2024 · 11 comments

Comments

@Dhruv00710
Copy link

sir I made OMR program in python version 3.11.4 32 bit version and its get problem about memory. and i am not use python 64 bit version because i also use twain library for scan OMR sheet and twain library is work on 32 bit and in 64 bit python its not show the scanner. so i use 32 bit library.
Error like :
res = cv2.matchTemplate(
^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 4380856 bytes in function 'cv::OutOfMemoryError'
and sir please replay me.

@Sadegh-Kalami
Copy link

did u find the solution?

@Dhruv00710
Copy link
Author

did u find the solution?

no i don't find solution. if you have any solution please give me.

@Sadegh-Kalami
Copy link

Sadegh-Kalami commented Mar 16, 2024

Well Iam trying to test opencv 4.5.4 or 4.2.0 they should work.
I'll keep u in touch, but it may take a day to reach u.
I suggest u to test 4.5.4.

@Dhruv00710
Copy link
Author

Well Iam trying to test opencv 4.5.4 or 4.2.0 they should work. I'll keep u in touch, but it may take a day to reach u. I suggest u to test 4.5.4.

ok. i try 4.5.4 version and after i tell you.

@Dhruv00710
Copy link
Author

4.5.4

i try version 4.5.4 and its get error like

Collecting opencv-python==4.5.4.60
Downloading opencv-python-4.5.4.60.tar.gz (89.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.8/89.8 MB 861.2 kB/s eta 0:00:00
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "linux" and platform_machine == "aarch64"' don't match your environment
Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "darwin" and platform_machine == "arm64"' don't match your environment
Ignoring numpy: markers 'python_version == "3.9" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment Collecting setuptools
Downloading setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB)
Collecting wheel
Downloading wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
Collecting scikit-build
Downloading scikit_build-0.17.6-py3-none-any.whl.metadata (14 kB)
Collecting cmake
Downloading cmake-3.28.3-py2.py3-none-win32.whl.metadata (6.5 kB)
Collecting pip
Using cached pip-24.0-py3-none-any.whl.metadata (3.6 kB)
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement numpy==1.21.2 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0rc1, 1.24.0rc2, 1.24.0, 1.24.1, 1.24.2, 1.24.3, 1.24.4, 1.25.0rc1, 1.25.0, 1.25.1, 1.25.2, 1.26.0b1, 1.26.0rc1, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 2.0.0b1)
ERROR: No matching distribution found for numpy==1.21.2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

@Sadegh-Kalami
Copy link

Sadegh-Kalami commented Mar 16, 2024 via email

@Sadegh-Kalami
Copy link

Sadegh-Kalami commented Mar 16, 2024

Oh darling
I am sorry. I'm on linux platform.
If u wanna try other opencv version u would better to build from source.

@Dhruv00710
Copy link
Author

Oh darling I am sorry. I'm on linux platform. If u wanna try other opencv version u would better to build from source.

which version i use.

@Sadegh-Kalami
Copy link

Tell me about your OS.
to install opencv first:

sudo apt update
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev

mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
cd opencv 
git checkout 4.2.0
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 4.2.0
cd ..

cd ~/opencv_build/opencv
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
      -D BUILD_EXAMPLES=ON ..

make -j$(nproc)
sudo make install
sudo ldconfig

@Dhruv00710
Copy link
Author

Tell me about your OS. to install opencv first:

sudo apt update
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev
mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
cd opencv 
git checkout 4.2.0
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 4.2.0
cd ..
cd ~/opencv_build/opencv
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
      -D BUILD_EXAMPLES=ON ..
make -j$(nproc)
sudo make install
sudo ldconfig

i use windows 10 pro 64 bit operating system

@Sadegh-Kalami
Copy link

Finding out the bug took me 1 day and i didn't sleep 20hours.
The problem for me was having 2 opencvs version.
Libopencv-dev and custom installation of opencv 4.8.0.
Choose 1 opencv and stick to it.
GL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants