-1

I am trying to install opencv following the tutorial - https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

I got through till 'make -j4' and made 100% compile.

After this step, when I try ls /usr/local/python/cv2/python-3.6, I get the following error - ls: cannot access '/usr/local/python/cv2/python-3.6': No such file or directory

cd /usr/local/python/cv2
ls -l

total 16
-rw-r--r-- 1 root root 98 Jul 3 13:55 config.py
-rw-r--r-- 1 root root 2857 Nov 17 2018 init.py
-rw-r--r-- 1 root root 151 Nov 17 2018 load_config_py2.py
-rw-r--r-- 1 root root 262 Nov 17 2018 load_config_py3.py

which python
/home/ciaran/.virtualenvs/cv/bin/python

I have looked at multiple forums online and tried troubleshooting but I still can't get past this step.

loki
  • 976
  • 1
  • 10
  • 22

3 Answers3

0

The error is appearing because python is not set in your path, so your system doesn't know where python is. Run the below command in your terminal and it should fix it:

export PATH="$PATH:/usr/local/bin/python"
Evan Bloemer
  • 1,051
  • 2
  • 11
  • 31
  • Thanks Evan! I tried it and its still the same. ls: cannot access '/usr/local/python/cv2/python-3.6': No such file or directory ls /usr/local/python/cv2/ config.py __init__.py load_config_py2.py load_config_py3.py – loki Jul 03 '19 at 06:39
  • echo $PATH /home/ciaran/.virtualenvs/cv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/bin/python:/usr/local/bin/python – loki Jul 03 '19 at 06:43
  • Ahhhh, I think I know what's happening. When you run this part `mkvirtualenv cv -p python3` are you activating the virtual environment you are creating? – Evan Bloemer Jul 03 '19 at 06:43
  • The instruction asks for the virtualenv cv to be activated after that line. – loki Jul 03 '19 at 06:45
  • To this point '$ pkg-config --modversion opencv' everything works exactly as per instructions in the page - https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/ .. After this, when I try ls /usr/local/python/cv2/python-3.6 , I get the error – loki Jul 03 '19 at 06:48
  • Can run `cd /usr/local/python/cv2` and then `ls -l` in your terminal and past the results? – Evan Bloemer Jul 03 '19 at 06:51
  • total 16 -rw-r--r-- 1 root root 98 Jul 3 13:55 config.py -rw-r--r-- 1 root root 2857 Nov 17 2018 __init__.py -rw-r--r-- 1 root root 151 Nov 17 2018 load_config_py2.py -rw-r--r-- 1 root root 262 Nov 17 2018 load_config_py3.py – loki Jul 03 '19 at 06:52
  • Haha sorry, please edit your question with the response. I don't think it'll fit in a comment. – Evan Bloemer Jul 03 '19 at 06:53
0

Solved this.

"If your compile chokes and hangs, it may be due to a threading race condition. In the event you run into this problem, simply delete your build directory, recreate it, and re-run cmake and make . This time do not include the flag next to make."

Used $ make in place of $ make -j4 in the tutorial.

loki
  • 976
  • 1
  • 10
  • 22
0

Having the same issue with Python 3.6, managed to find the file using the search tool in the GUI.

Mine is in:

/usr/local/lib/python3.6/site-packages/cv2/python-3.6/

Named cv2.cpython-36m-aarch64-linux-gnu.so

Then it worked corrrectly

ventaquil
  • 2,780
  • 3
  • 23
  • 48