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

Failed to install fatal error: opencv2/opencv.hpp: No such file or directory #3

Open
PATAPOsha opened this issue Jun 2, 2020 · 3 comments

Comments

@PATAPOsha
Copy link

PATAPOsha commented Jun 2, 2020

Using python 3.6.10 pip install stasm on Ubuntu
Getting following error:

Collecting stasm
  Using cached https://files.pythonhosted.org/packages/32/f5/3d7cecf2b85bb56bf621e434217f62f814c163c938aa199c7db64b6594ee/stasm-2.0.2.tar.gz
Requirement already satisfied: numpy>=1.10 in /home/pata/.pyenv/versions/3.6.10/envs/vk_pic/lib/python3.6/site-packages (from stasm) (1.15.4
)
Installing collected packages: stasm
  Running setup.py install for stasm ... error
    Complete output from command /home/pata/.pyenv/versions/3.6.10/envs/vk_pic/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/t
mp/pip-install-vmhfovj_/stasm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compi
le(code, __file__, 'exec'))" install --record /tmp/pip-record-ft1fu3in/install-record.txt --single-version-externally-managed --compile --in
stall-headers /home/pata/.pyenv/versions/3.6.10/envs/vk_pic/include/site/python3.6/stasm:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/stasm
    copying stasm/__init__.py -> build/lib.linux-x86_64-3.6/stasm
    running egg_info
    writing stasm.egg-info/PKG-INFO
    writing dependency_links to stasm.egg-info/dependency_links.txt
    writing requirements to stasm.egg-info/requires.txt
    writing top-level names to stasm.egg-info/top_level.txt
    reading manifest file 'stasm.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'stasm.egg-info/SOURCES.txt'
    creating build/lib.linux-x86_64-3.6/stasm/data
    copying stasm/data/README.txt -> build/lib.linux-x86_64-3.6/stasm/data
    copying stasm/data/haarcascade_frontalface_alt2.xml -> build/lib.linux-x86_64-3.6/stasm/data
    copying stasm/data/haarcascade_mcs_lefteye.xml -> build/lib.linux-x86_64-3.6/stasm/data
    copying stasm/data/haarcascade_mcs_righteye.xml -> build/lib.linux-x86_64-3.6/stasm/data
    copying stasm/data/testface.jpg -> build/lib.linux-x86_64-3.6/stasm/data
    running build_ext
    building '_stasm' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    creating build/temp.linux-x86_64-3.6/src/MOD_1
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/usr/local/Cellar/opencv/3.4.1
_5/include -I/usr/local/include/opencv4 -I/home/pata/.pyenv/versions/3.6.10/envs/vk_pic/include -I/home/pata/.pyenv/versions/3.6.10/include/
python3.6m -I/home/pata/.pyenv/versions/3.6.10/envs/vk_pic/lib/python3.6/site-packages/numpy/core/include -c src/asm.cpp -o build/temp.linux
-x86_64-3.6/src/asm.o
    In file included from src/asm.cpp:5:0:
    src/stasm.h:33:10: fatal error: opencv2/opencv.hpp: No such file or directory
     #include "opencv2/opencv.hpp"
              ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------

cv2 is installed and imported succesffully:

(vk_pic) pata@pata_pc:/mnt/c/Users/pata/PycharmProjects/test$ python
Python 3.6.10 (default, Apr 16 2020, 14:35:54)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.4.5'
>>>

@PATAPOsha PATAPOsha changed the title Failed to install Failed to install fatal error: opencv2/opencv.hpp: No such file or directory Jun 2, 2020
@dmnc-net
Copy link

dmnc-net commented Feb 1, 2021

Arch Linux
Python 3.9.1
pip 21.0.1
opencv-python 4.5.1.48
... same result (file not found)

@dmnc-net
Copy link

dmnc-net commented Feb 1, 2021

#4 same error under MacOS env.

@github-BR-admin
Copy link

github-BR-admin commented Sep 9, 2022

MacOS, same issue here. Additional info, brew seems to install cv2 in a different location ... /opt/homebrew/opt/opencv@3.

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

3 participants