Jump to content

openCV 4.0


Recommended Posts

OrangePI PC
Armbian_5.75_Orangepipc_Debian_stretch_next_4.19.20.img

 

I'm trying to install openCV 4.0 from the following link:

https://www.alatortsev.com/2018/11/21/installing-opencv-4-0-on-raspberry-pi-3-b/

 

This complete command:

https://pastebin.com/JPuTprVf

 

Not work, but i have not errors during compiling.


The problem is:

 

1)  apt-get  install libjasper-dev libpng12-dev   (Not Found)
2) But I seem to remember that even with Raspberry and raspbian there was the same error.

 

pip3 install numpy scipy

Collecting numpy

  Downloading https://files.pythonhosted.org/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip (5.1MB)

    100% |████████████████████████████████| 5.1MB 49kB/s

    Complete output from command python setup.py egg_info:

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

    ImportError: No module named 'setuptools'

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

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gvktejse/numpy/

 

3) I don't find a file anywhere cv2.so

 

Can you help me ?
I'm a beginner with Linux.

Link to comment
Share on other sites

1 hour ago, martinayotte said:

For this, I think you simply has to do "apt-get install python-setuptools".

 

Same:

 

root@orangepipc:~# sudo pip3 install numpy scipy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named 'setuptools'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rqglwc6c/numpy/
 

 

 

And after make install

 

root@orangepipc:~# python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>>

Link to comment
Share on other sites

Spoiler

 

8 hours ago, martinayotte said:

For this, I think you simply has to do "apt-get install python3-setuptools".

Quote

 

apt-get purge python2.7

apt-get purge python2.7-minimal

apt-get install python3-setuptools

sudo pip3 install numpy scipy 

 

Collecting numpy>=1.8.2 (from scipy)
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 937, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 799, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 583, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 393, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 313, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 630, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 630, in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 190, in resolve_redirects
    **adapter_kwargs
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

 

 

Edited by Tido
added spoiler - please add a spoiler nexttime yourself, thx
Link to comment
Share on other sites

23 minutes ago, Giorgio Evangelista said:

requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)

Were you able to "ping pypi.org" ?

Maybe this server is down ...

Link to comment
Share on other sites

Ok, now download, but it crashes.

Also after reboot.
Can I clean and restart ?


 

Spoiler


Using username "root".
root@192.168.1.21's password:
  ___                               ____  _   ____   ____
 / _ \ _ __ __ _ _ __   __ _  ___  |  _ \(_) |  _ \ / ___|
| | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | |_) | |
| |_| | | | (_| | | | | (_| |  __/ |  __/| | |  __/| |___
 \___/|_|  \__,_|_| |_|\__, |\___| |_|   |_| |_|    \____|
                       |___/

Welcome to ARMBIAN 5.75 stable Debian GNU/Linux 9 (stretch) 4.19.20-sunxi
System load:   0.00 0.00 0.00   Up time:       33 min
Memory usage:  7 % of 1000MB    IP:            192.168.1.21
CPU temp:      23°C
Usage of /:    51% of 15G

[ General system configuration (beta): armbian-config ]

Last login: Fri Mar 29 17:49:47 2019 from 192.168.1.30

root@orangepipc:~# ping pypi.org
PING pypi.org (151.101.0.223) 56(84) bytes of data.
64 bytes from 151.101.0.223 (151.101.0.223): icmp_seq=1 ttl=54 time=16.6 ms
64 bytes from 151.101.0.223 (151.101.0.223): icmp_seq=2 ttl=54 time=15.0 ms
64 bytes from 151.101.0.223 (151.101.0.223): icmp_seq=3 ttl=54 time=14.9 ms
64 bytes from 151.101.0.223 (151.101.0.223): icmp_seq=4 ttl=54 time=14.9 ms
64 bytes from 151.101.0.223 (151.101.0.223): icmp_seq=5 ttl=54 time=15.0 ms
^C
--- pypi.org ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 8051ms
rtt min/avg/max/mdev = 14.966/15.350/16.691/0.681 ms
root@orangepipc:~#
root@orangepipc:~#
root@orangepipc:~# sudo pip3 install numpy scipy
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages
Collecting scipy
  Using cached https://files.pythonhosted.org/packages/a9/b4/5598a706697d1e2929eaf7fe68898ef4bea76e4950b9efbe1ef396b8813a/scipy-1.2.1.tar.gz
Building wheels for collected packages: scipy
  Running setup.py bdist_wheel for scipy ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tq5e1qtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpucfiue48pip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for scipy
  Running setup.py clean for scipy
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tq5e1qtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported).


  ----------------------------------------
  Failed cleaning build dir for scipy
Failed to build scipy
Installing collected packages: scipy
  Running setup.py install for scipy ... /

 

 

Link to comment
Share on other sites

23 hours ago, martinayotte said:

Were you able to "ping pypi.org" ?

Maybe this server is down ...

 

I made a clean new installation.

 

Spoiler

 

Collecting scipy
  Using cached https://files.pythonhosted.org/packages/a9/b4/5598a706697d1e2929eaf7fe68898ef4bea76e4950b9efbe1ef396b8813a/scipy-1.2.1.tar.gz
Building wheels for collected packages: scipy
  Running setup.py bdist_wheel for scipy ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-l7w5utzc/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpis71vwt_pip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for scipy
  Running setup.py clean for scipy
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-l7w5utzc/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported).


  ----------------------------------------
  Failed cleaning build dir for scipy
Failed to build scipy
Installing collected packages: scipy
  Running setup.py install for scipy ... \

 

 

After an hour, ssh closes and loses IP

After another hour it restarts.

 

This is the script that I run on root user.
  

Spoiler

 

apt-get install build-essential cmake pkg-config

apt-get install libjpeg-dev libtiff-dev

 

apt-get  install libjasper-dev libpng12-dev   (Not Found)

 

apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

apt-get install libxvidcore-dev libx264-dev

apt-get install libgtk2.0-dev libgtk-3-dev

apt-get install libatlas-base-dev gfortran

 

apt-get install python3-dev

apt-get install python3-pip

 

 

wget -O opencv.zip https://github.com/opencv/opencv/archive/4.0.0.zip

wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.0.0.zip

unzip opencv.zip

unzip opencv_contrib.zip

mv opencv_contrib-4.0.0  opencv_contrib

mv opencv-4.0.0  opencv

 

apt-get purge python2.7

apt-get purge python2.7-minimal

apt-get install python3-setuptools

sudo pip3 install numpy scipy

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines