Thursday, 17 December 2020

Webcam capture with ffmpeg and OpenCV from Jupyter Notebook

I want to share here my experience with using OpenCV and ffmpeg to capture a webcam output.


Setup:
  • Jupyter notebook running in jupyter-lab
  • Ubuntu 20.04
  • USB web camera
Goal:
  • Capture and display frames from the webcam

OpenCV: Video I/O with OpenCV Overview says that OpenCV: cv::VideoCapture Class calls video I/O backends (APIs) depending on which one is available.

To find out what backends (VideoCaptureAPIs) are available we can use the following code:

import cv2

# cv2a.videoio_registry.getBackends() returns list of all available backends.
availableBackends = [cv2.videoio_registry.getBackendName(b) for b in cv2.videoio_registry.getBackends()]
print(availableBackends)

# Returns list of available backends which works via cv::VideoCapture(int index)
availableCameraBackends = [cv2.videoio_registry.getBackendName(b) for b in cv2.videoio_registry.getCameraBackends()]
print(availableBackends)

The output in my case was: 

['FFMPEG', 'GSTREAMER', 'CV_IMAGES', 'CV_MJPEG']
['FFMPEG', 'GSTREAMER', 'CV_IMAGES', 'CV_MJPEG']

Let's see what is each of these backends:

• FFMPEG is a multimedia framework which can record, convert and stream audio and video.

It contains libavcodec, libavutil, libavformat, libavfilter, libavdevice, libswscale and libswresample which can be used by applications. As well as ffmpeg, ffplay and ffprobe which can be used by end users for transcoding and playing.

• GSTREAMER is a pipeline-based multimedia framework with similar capabilities as ffmpeg.

• CV_IMAGES -  OpenCV Image Sequence (e.g. img_%02d.jpg). Matches cv2.CAP_IMAGES API ID.

• CV_MJPEG - Built-in OpenCV MotionJPEG codec (used for reading video files). Matches cv2.CAP_OPENCV_MJPEG video capture API.

I was surprised to see GSTREAMER listed above as VideoCaptureAPIs documentation says

Backends are available only if they have been built with your OpenCV binaries. 

...and OpenCV package installed in my environment was built only with FFMPEG support:

>>> import cv2
>>> cv2.getBuildInformation()
...
Video I/O:\n    DC1394:                      NO\n    FFMPEG:                      YES\n      avcodec:                   YES (58.35.100)\n      avformat:                  YES (58.20.100)\n      avutil:                    YES (56.22.100)\n      swscale:                   YES (5.3.100)\n      avresample:                YES (4.0.0)\n\n  
...

...which can also be verifed by looking the cmake config in the repository (opencv-feedstock/build.sh at master · conda-forge/opencv-feedstock):

-DWITH_FFMPEG=1     \
-DWITH_GSTREAMER=0  \

Although my conda environment contained all relevant packages:

(my-env) $ conda list | grep 'opencv\|ffmpeg\|gstreamer'
ffmpeg                    4.1.3                h167e202_0    conda-forge
gstreamer                 1.14.5               h36ae1b5_2    conda-forge
opencv                    4.1.0            py36h79d2e43_1    conda-forge

...it is important to know that having ffmpeg and gstreamer packages installed means only that we have their binaries installed (executables and .so libraries) but not Python bindings (modules) or their OpenCV plugins. We are able to launch these applications from terminal but can't import them in Python code.

I tried to force using FFMPEG:

import cv2

deviceId = "/dev/video0"

# videoCaptureApi = cv2.CAP_ANY       # autodetect default API
videoCaptureApi = cv2.CAP_FFMPEG
# videoCaptureApi = cv2.CAP_GSTREAMER 
cap = cv2.VideoCapture("/dev/video2", videoCaptureApi)

cap = cv2.VideoCapture(deviceId)
cap.open(deviceId)
if not cap.isOpened():
    raise RuntimeError("ERROR! Unable to open camera")

try:
    while True:
        ret, frame = cap.read()
        cv2.imshow('frame', frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
finally:        
    cap.release()
    cv2.destroyAllWindows()

...but cell execution would fail with:

RuntimeError: ERROR! Unable to open camera

I checked ($ v4l2-ctl --list-devices) - my webcam was indeed with index 2. As this was failing at the very beginning I decided to open python interpreter console and debug there only the isolated code snippet which opens the camera:

(my-env) $ export OPENCV_LOG_LEVEL=DEBUG; export OPENCV_VIDEOIO_DEBUG=1

(my-env) $ python 
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cap = cv2.VideoCapture("/dev/video2", cv2.CAP_FFMPEG)
[ WARN:0] VIDEOIO(FFMPEG): trying capture filename='/dev/video2' ...
[ WARN:0] VIDEOIO(FFMPEG): can't create capture

I also tried to force using Gstreamer to no avail (which was expected):

>>> cap = cv2.VideoCapture("/dev/video2", cv2.CAP_GSTREAMER)
[ WARN:0] VIDEOIO(GSTREAMER): trying capture filename='/dev/video2' ...
[ INFO:0] VideoIO pluigin (GSTREAMER): glob is 'libopencv_videoio_gstreamer*.so', 1 location(s)
[ INFO:0]     - /home/bojan/anaconda3/envs/my-env/lib/python3.6/site-packages/../..: 0
[ INFO:0] Found 0 plugin(s) for GSTREAMER
[ WARN:0] VIDEOIO(GSTREAMER): backend is not available (plugin is missing, or can't be loaded due dependencies or it is not compatible)

Indeed ~/anaconda3/envs/my-env/lib did not contain ffmpeg plugin (libopencv_videoio_ffmpeg*.so files) or Gstreamer plugin (libopencv_videoio_gstreamer*.so files).

These plugins are installed only if OpenCV is build with following CMake options:

- DWITH_FFMPEG=1     \
-DVIDEOIO_PLUGIN_LIST=ffmpeg

...or (for Gstreamer):

-DWITH_GSTREAMER=1 \
-DVIDEOIO_PLUGIN_LIST=gstreamer \

...and apart from WITH_FFMPEG no other were used in the cmake config that was used to build OpenCV package installed in my environment.

As I didn't want to compile OpenCV myself but to achieve my goal with what I have I decided to see if I can run ffmpg process to stream camera output into a pipe and then read the binary information from it and convert it into frames:

import os
import tempfile
import subprocess
import cv2
import numpy as np

# To get this path execute:
#    $ which ffmpeg
FFMPEG_BIN = '/home/bojan/anaconda3/envs/my-env/bin/ffmpeg'


# To find allowed formats for the specific camera:
#    $ ffmpeg -f v4l2 -list_formats all -i /dev/video3
#    ...
#    [video4linux2,v4l2 @ 0x5608ac90af40] Raw: yuyv422: YUYV 4:2:2: 640x480 1280x720 960x544 800x448 640x360 424x240 352x288 320x240 800x600 176x144 160x120 1280x800
#    ...

def run_ffmpeg(fifo_path):
    ffmpg_cmd = [
        FFMPEG_BIN,
        '-i', '/dev/video2',
        '-video_size', '640x480',
        '-pix_fmt', 'bgr24',        # opencv requires bgr24 pixel format
        '-vcodec', 'rawvideo',
        '-an','-sn',                # disable audio processing
        '-f', 'image2pipe',
        '-',                        # output to go to stdout
    ]
    return subprocess.Popen(ffmpg_cmd, stdout = subprocess.PIPE, bufsize=10**8)

def run_cv_window(process):
    while True:
        # read frame-by-frame
        raw_image = process.stdout.read(640*480*3)
        if raw_image == b'':
            raise RuntimeError("Empty pipe")
        
        # transform the bytes read into a numpy array
        frame =  np.frombuffer(raw_image, dtype='uint8')
        frame = frame.reshape((480,640,3)) # height, width, channels
        if frame is not None:
            cv2.imshow('Video', frame)
        
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
        process.stdout.flush()
    
    cv2.destroyAllWindows()
    process.terminate()
    print(process.poll())

def run():
    ffmpeg_process = run_ffmpeg()
    run_cv_window(ffmpeg_process)

run()

Et voila! I got the camera capture from Python notebook thanks to ffmpeg and OpenCV.



Monday, 16 November 2020

Introduction to Linux Networking

 

What is the difference between curl and wget?
curl vs Wget
How to download files in Linux from command line with dynamic url

to download a file when it is pointed by a dynamic url, all you need to to is to use single quotes for the url; -O = specify the output filename

$ wget 'http://some.site.com/download?id=234&status=download' -O output_filename


What to do if ping does not help? 

Options are:

  • wget
  • curl
  • traceroute
    • installation: $ sudo apt install traceroute
  • lft
    • "layer 4 traceroute"
    • $ lft -S 192.168.0.20


$ ping example.com
$ traceroute example.com
$ curl -v example.com
$ wget example.com


How to find what DNS servers are used on the local machine?

$ cat /etc/resolv.conf 
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0
search whatever.example.com

To find out which DNS servers are used by each network adapter:

$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 137 (enxa44cc8e41d0f)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 136 (vethed1f504)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 38 (br-53b4f1b3fbda)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 5 (br-3c8c9487a095)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 4 (docker0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: x.y.z.q
                      x.y.z.v
          DNS Domain: ~.
                      whatever.example.com

Link 2 (enp0s31f6)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
lines 44-81/81 (END)

Another way:

$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]:                             x.y.z.q
IP4.DNS[2]:                             x.y.z.v

DNS on Ubuntu 18.04

How to block some domain?

Add entry e.g.

0.0.0.0 domain.to.be.blocked

to /etc/hosts and then flush DNS cache:

How To Flush Linux / UNIX DNS Cache - nixCraft

How to direct network traffic use Proxy server?

Use environment variables

export http_proxy=10.21.32.70:8080
export https_proxy=10.21.32.70:8080

Domain names can be used instead of IP addresses.

How To Use Proxy Server To Access Internet at Shell Prompt With http_proxy Variable - nixCraft

How to test proxy?

curl -v -x 11.22.33.44:8080 -L 'https://www.example.com/examples/1'

       -x, --proxy [protocol://]host[:port]
              Use the specified proxy.

              The  proxy string can be specified with a protocol:// prefix. No
              protocol specified or http:// will be treated as HTTP proxy. Use
              socks4://, socks4a://, socks5:// or socks5h:// to request a spe‐
              cific SOCKS version to be used.  (The protocol support was added
              in curl 7.21.7)

              HTTPS  proxy  support  via https:// protocol prefix was added in
              7.52.0 for OpenSSL, GnuTLS and NSS.

To let cURL follow redirects (3xx statuses) add -L:

       -L, --location
              (HTTP)  If  the server reports that the requested page has moved
              to a different location (indicated with a Location: header and a
              3XX  response code), this option will make curl redo the request
              on the new place.

To see HTTP status code, use verbose flag:
     -v, --verbose

How to get public IP address of the computer?


$ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'

3rd party GeoIP service (its web API) can be accessed via curl:

$ curl -m 30 -X GET "https://api.ipify.org?format=json"
{"ip":"197.44.76.233"}

The output of this command (an IP address) can be assigned to a variable

AGENT_IP=$(curl -s -m 30 -X GET "https://api.ipify.org?format=json")
echo "This build agent '%teamcity.agent.name%' has public IP: $AGENT_IP"



Sunday, 8 November 2020

Conda, OpenCV and GUI backends

It is possible to manage OpenCV package installation via conda manager.




I have an environment defined by e.g. my_env_config.yml:

name: my_env
channels:
  - menpo
  - conda-forge
  - defaults
dependencies:
  ...
  - opencv=3.4.2
  ...


This installs the following packages:

(my_env) $ conda list
...
libopencv                 3.4.2                hb342d67_1 
opencv                    3.4.2            py36h6fd60c2_1  
py-opencv                 3.4.2            py36hb342d67_1 
...

In Jupyter Notebook:

import cv2
img = cv2.imread('../data/test.jpg')
cv2.imshow('Test, img)
cv2.waitKey()

...fails with:

Output:
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-1-da1c1c679272> in <module>
      1 import cv2
      2 img = cv2.imread('../data/test.jpg')
----> 3 cv2.imshow('Test', img)
      4 cv2.waitKey()

error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'


Trying to display an image also fails when trying to do that from python terminal:

import cv2    
import numpy as np
cv2.imshow('darkness', np.zeros((100, 100)))
cv2.waitKey()

...fails with:

(my-env) $ python 
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy as np
>>> cv2.imshow('test', np.zeros((100, 100)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'


So the issue here is that OpenCV 3.4.2 for Ubuntu is not built against UI framework (e.g. GTK) which is required for cvShowImage() function to be defined. I am not sure why this error message suggests using only GTK as UI backend when there is another UI framework, Qt, which is also commonly used and which provides richer UI experience [GTK or QT when build OpenCV - OpenCV Q&A Forum]. In fact, OpenCV in conda-forge channel is built against it. We can check that by looking the source code https://github.com/conda-forge/opencv-feedstock/blob/master/recipe/build.sh:

QT="5"
...
cmake -LAH -G "Ninja"                                                     \
   ...
   -DWITH_GTK=0                                                          \
   -DWITH_QT=$QT                                                         \
   ...


Let's try to install OpenCV from that channel. First we need to remove the current OpenCV package:

(my-env) $ conda remove opencv
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/bojan/anaconda3/envs/my-env

  removed specs:
    - opencv


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    absl-py-0.10.0             |           py36_0         168 KB
    argon2-cffi-20.1.0         |   py36h7b6447c_1          46 KB
    astor-0.8.1                |           py36_0          47 KB
    async_generator-1.10       |   py36h28b3542_0          39 KB
    attrs-20.2.0               |             py_0          42 KB
    bleach-3.2.1               |             py_0         112 KB
    c-ares-1.16.1              |       h7b6447c_0         108 KB
    cffi-1.14.0                |   py36h2e261b9_0         223 KB
    cycler-0.10.0              |           py36_0          13 KB
    dbus-1.13.18               |       hb2f20db_0         504 KB
    decorator-4.4.2            |             py_0          14 KB
    defusedxml-0.6.0           |             py_0          23 KB
    entrypoints-0.3            |           py36_0          12 KB
    expat-2.2.10               |       he6710b0_2         153 KB
    freetype-2.10.4            |       h5ab3b9f_0         596 KB
    gast-0.4.0                 |             py_0          15 KB
    glib-2.63.1                |       h5a9c865_0         2.9 MB
    grpcio-1.14.1              |   py36h9ba97e2_0         944 KB
    gstreamer-1.14.0           |       hb453b48_1         3.1 MB
    h5py-2.10.0                |   py36hd6299e0_1         901 KB
    hdf5-1.10.6                |       hb1b8bf9_0         3.7 MB
    importlib-metadata-2.0.0   |             py_1          35 KB
    importlib_metadata-2.0.0   |                1          11 KB
    intel-openmp-2019.4        |              243         729 KB
    ipykernel-5.3.4            |   py36h5ca1d4c_0         181 KB
    ipython-7.16.1             |   py36h5ca1d4c_0         999 KB
    ipython_genutils-0.2.0     |           py36_0          39 KB
    ipywidgets-7.5.1           |             py_1          98 KB
    jedi-0.17.2                |           py36_0         916 KB
    jsonschema-3.2.0           |             py_2          47 KB
    jupyter_client-6.1.7       |             py_0          77 KB
    jupyter_console-6.2.0      |             py_0          26 KB
    jupyter_core-4.6.3         |           py36_0          71 KB
    jupyterlab_launcher-0.13.1 |             py_2          23 KB
    jupyterlab_pygments-0.1.2  |             py_0           8 KB
    keras-applications-1.0.4   |           py36_1          45 KB
    keras-preprocessing-1.0.2  |           py36_1          44 KB
    kiwisolver-1.2.0           |   py36hfd86e86_0          84 KB
    libffi-3.2.1               |    hf484d3e_1007          48 KB
    libprotobuf-3.13.0.1       |       hd408876_0         2.0 MB
    libxml2-2.9.10             |       hb55368b_3         1.2 MB
    lz4-c-1.9.2                |       heb0550a_3         175 KB
    markdown-3.3.2             |           py36_0         125 KB
    markupsafe-1.1.1           |   py36h7b6447c_0          29 KB
    mistune-0.8.4              |   py36h7b6447c_0          55 KB
    mkl-2018.0.3               |                1       126.9 MB
    mkl_fft-1.0.6              |   py36h7dd41cf_0         135 KB
    mkl_random-1.0.1           |   py36h4414c95_1         324 KB
    nbclient-0.5.1             |             py_0          58 KB
    nbconvert-6.0.7            |           py36_0         480 KB
    nbformat-5.0.8             |             py_0          88 KB
    nest-asyncio-1.4.1         |             py_0          10 KB
    notebook-6.1.4             |           py36_0         4.1 MB
    numpy-1.15.1               |   py36h1d66e8a_0          36 KB
    numpy-base-1.15.1          |   py36h81de0dd_0         3.4 MB
    pandoc-2.11                |       hb0f4dca_0         9.6 MB
    pandocfilters-1.4.2        |           py36_1          13 KB
    pexpect-4.8.0              |           py36_0          82 KB
    pickleshare-0.7.5          |           py36_0          13 KB
    pip-20.2.4                 |           py36_0         1.8 MB
    prompt-toolkit-3.0.8       |             py_0         248 KB
    prompt_toolkit-3.0.8       |                0          12 KB
    protobuf-3.13.0.1          |   py36he6710b0_1         633 KB
    ptyprocess-0.6.0           |           py36_0          23 KB
    pygments-2.7.1             |             py_0         671 KB
    pyqt-5.6.0                 |   py36h22d08a2_6         4.4 MB
    pyrsistent-0.17.3          |   py36h7b6447c_0          89 KB
    python-dateutil-2.8.1      |             py_0         215 KB
    pyyaml-5.3.1               |   py36h7b6447c_1         180 KB
    pyzmq-19.0.2               |   py36he6710b0_1         434 KB
    qt-5.6.3                   |       h8bf5577_3        36.4 MB
    qtconsole-4.7.7            |             py_0          96 KB
    qtpy-1.9.0                 |             py_0          38 KB
    readline-7.0               |       h7b6447c_5         324 KB
    scikit-learn-0.19.1        |   py36hedc7406_0         3.9 MB
    scipy-1.1.0                |   py36hfa4b5c9_1        13.2 MB
    send2trash-1.5.0           |           py36_0          16 KB
    setuptools-50.3.0          |   py36hb0f4dca_1         713 KB
    sip-4.18.1                 |   py36hf484d3e_2         261 KB
    sqlite-3.33.0              |       h62c20be_0         1.1 MB
    tbb-2020.3                 |       hfd86e86_0         1.1 MB
    tbb4py-2020.3              |   py36hfd86e86_0         200 KB
    termcolor-1.1.0            |           py36_1           8 KB
    terminado-0.9.1            |           py36_0          27 KB
    testpath-0.4.4             |             py_0          82 KB
    tornado-6.0.4              |   py36h7b6447c_1         597 KB
    traitlets-4.3.3            |           py36_0         140 KB
    webencodings-0.5.1         |           py36_1          19 KB
    wheel-0.35.1               |             py_0          37 KB
    widgetsnbextension-3.5.1   |           py36_0         862 KB
    zeromq-4.3.3               |       he6710b0_3         500 KB
    zipp-3.3.1                 |             py_0          12 KB
    zstd-1.4.5                 |       h9ceee32_0         619 KB
    ------------------------------------------------------------
                                           Total:       234.4 MB

The following NEW packages will be INSTALLED:

  gst-plugins-base   pkgs/main/linux-64::gst-plugins-base-1.14.0-hbbd80ab_1
  intel-openmp       pkgs/main/linux-64::intel-openmp-2019.4-243
  libedit            pkgs/main/linux-64::libedit-3.1.20191231-h14c3975_1
  libgfortran-ng     pkgs/main/linux-64::libgfortran-ng-7.3.0-hdf63c60_0
  mkl                pkgs/main/linux-64::mkl-2018.0.3-1
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.0.6-py36h7dd41cf_0
  mkl_random         pkgs/main/linux-64::mkl_random-1.0.1-py36h4414c95_1
  numpy-base         pkgs/main/linux-64::numpy-base-1.15.1-py36h81de0dd_0
  tbb                pkgs/main/linux-64::tbb-2020.3-hfd86e86_0
  tbb4py             pkgs/main/linux-64::tbb4py-2020.3-py36hfd86e86_0

The following packages will be REMOVED:

  _openmp_mutex-4.5-1_gnu
  atk-2.25.90-hf2eb9ee_1001
  backports-1.0-py_2
  backports.functools_lru_cache-1.6.1-py_0
  bzip2-1.0.8-h516909a_3
  cairo-1.14.12-h80bd089_1005
  ffmpeg-4.0.2-ha0c5888_2
  freeglut-3.0.0-hf484d3e_1005
  gdk-pixbuf-2.36.12-h4f1c04b_1001
  gettext-0.19.8.1-hc5be6a0_1002
  gmp-6.1.2-hf484d3e_1000
  gnutls-3.5.19-h2a4e5f8_1
  gobject-introspection-1.56.1-py36h9e29830_1001
  graphite2-1.3.13-he1b5a44_1001
  gtk2-2.24.31-h5baeb44_1000
  harfbuzz-1.9.0-he243708_1001
  jasper-2.0.14-habb8e15_1
  libgfortran-3.0.0-1
  libglu-9.0.0-he1b5a44_1001
  libgomp-9.3.0-h5dbcf3e_17
  libiconv-1.16-h516909a_0
  libopencv-3.4.2-hb342d67_1
  libwebp-base-1.1.0-h516909a_3
  nettle-3.3-0
  openblas-0.2.20-8
  opencv-3.4.2-py36h6fd60c2_1
  openh264-1.8.0-hdbcaa40_1000
  pango-1.40.14-hf0c64fd_1003
  pixman-0.34.0-h14c3975_1003
  pthread-stubs-0.4-h14c3975_1001
  py-opencv-3.4.2-py36hb342d67_1
  python_abi-3.6-1_cp36m
  x264-1!152.20180806-h14c3975_0
  xorg-fixesproto-5.0-h14c3975_1002
  xorg-inputproto-2.3.2-h14c3975_1002
  xorg-kbproto-1.0.7-h14c3975_1002
  xorg-libice-1.0.10-h516909a_0
  xorg-libsm-1.2.3-h84519dc_1000
  xorg-libx11-1.6.12-h516909a_0
  xorg-libxau-1.0.9-h14c3975_0
  xorg-libxdmcp-1.1.3-h516909a_0
  xorg-libxext-1.3.4-h516909a_0
  xorg-libxfixes-5.0.3-h516909a_1004
  xorg-libxi-1.7.10-h516909a_0
  xorg-libxrender-0.9.10-h516909a_1002
  xorg-libxt-1.2.0-h516909a_0
  xorg-renderproto-0.11.1-h14c3975_1002
  xorg-xextproto-7.3.0-h14c3975_1002
  xorg-xproto-7.0.31-h14c3975_1007

The following packages will be UPDATED:

  dbus               conda-forge::dbus-1.13.0-h4e0c4b3_1000 --> pkgs/main::dbus-1.13.18-hb2f20db_0
  expat                 conda-forge::expat-2.2.9-he1b5a44_2 --> pkgs/main::expat-2.2.10-he6710b0_2
  freetype           conda-forge::freetype-2.10.2-he06d7ca~ --> pkgs/main::freetype-2.10.4-h5ab3b9f_0
  glib               conda-forge::glib-2.56.2-had28632_1001 --> pkgs/main::glib-2.63.1-h5a9c865_0
  gstreamer          conda-forge::gstreamer-1.12.5-h0cc048~ --> pkgs/main::gstreamer-1.14.0-hb453b48_1
  h5py               conda-forge::h5py-2.8.0-py36h3010b51_~ --> pkgs/main::h5py-2.10.0-py36hd6299e0_1
  hdf5                  conda-forge::hdf5-1.10.2-hc401514_3 --> pkgs/main::hdf5-1.10.6-hb1b8bf9_0
  importlib-metadata conda-forge/linux-64::importlib-metad~ --> pkgs/main/noarch::importlib-metadata-2.0.0-py_1
  importlib_metadata conda-forge::importlib_metadata-2.0.0~ --> pkgs/main::importlib_metadata-2.0.0-1
  jsonschema         conda-forge/linux-64::jsonschema-3.2.~ --> pkgs/main/noarch::jsonschema-3.2.0-py_2
  libprotobuf        conda-forge::libprotobuf-3.13.0-h8b12~ --> pkgs/main::libprotobuf-3.13.0.1-hd408876_0
  libxcb             conda-forge::libxcb-1.13-h14c3975_1002 --> pkgs/main::libxcb-1.14-h7b6447c_0
  libxml2             conda-forge::libxml2-2.9.9-h13577e0_2 --> pkgs/main::libxml2-2.9.10-hb55368b_3
  markdown           conda-forge/noarch::markdown-3.2.2-py~ --> pkgs/main/linux-64::markdown-3.3.2-py36_0
  nbclient                 conda-forge::nbclient-0.5.0-py_0 --> pkgs/main::nbclient-0.5.1-py_0
  nbformat                 conda-forge::nbformat-5.0.7-py_0 --> pkgs/main::nbformat-5.0.8-py_0
  pandoc              conda-forge::pandoc-2.10.1-h516909a_0 --> pkgs/main::pandoc-2.11-hb0f4dca_0
  pip                   conda-forge/noarch::pip-20.2.3-py_0 --> pkgs/main/linux-64::pip-20.2.4-py36_0
  prompt-toolkit     conda-forge::prompt-toolkit-3.0.7-py_0 --> pkgs/main::prompt-toolkit-3.0.8-py_0
  prompt_toolkit        conda-forge::prompt_toolkit-3.0.7-0 --> pkgs/main::prompt_toolkit-3.0.8-0
  protobuf           conda-forge::protobuf-3.13.0-py36h831~ --> pkgs/main::protobuf-3.13.0.1-py36he6710b0_1
  pyyaml             conda-forge::pyyaml-5.3.1-py36h8c4c3a~ --> pkgs/main::pyyaml-5.3.1-py36h7b6447c_1
  pyzmq              conda-forge::pyzmq-19.0.2-py36h9947db~ --> pkgs/main::pyzmq-19.0.2-py36he6710b0_1
  qt                    conda-forge::qt-5.6.2-hbe13537_1012 --> pkgs/main::qt-5.6.3-h8bf5577_3
  setuptools         conda-forge::setuptools-49.6.0-py36h9~ --> pkgs/main::setuptools-50.3.0-py36hb0f4dca_1
  sqlite              conda-forge::sqlite-3.28.0-h8b20d00_0 --> pkgs/main::sqlite-3.33.0-h62c20be_0
  zeromq               conda-forge::zeromq-4.3.3-he1b5a44_1 --> pkgs/main::zeromq-4.3.3-he6710b0_3
  zipp                         conda-forge::zipp-3.2.0-py_0 --> pkgs/main::zipp-3.3.1-py_0

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex      conda-forge::_libgcc_mutex-0.1-conda_~ --> pkgs/main::_libgcc_mutex-0.1-main
  absl-py            conda-forge::absl-py-0.10.0-py36h9f0a~ --> pkgs/main::absl-py-0.10.0-py36_0
  argon2-cffi        conda-forge::argon2-cffi-20.1.0-py36h~ --> pkgs/main::argon2-cffi-20.1.0-py36h7b6447c_1
  astor              conda-forge/noarch::astor-0.8.1-pyh9f~ --> pkgs/main/linux-64::astor-0.8.1-py36_0
  async_generator    conda-forge/noarch::async_generator-1~ --> pkgs/main/linux-64::async_generator-1.10-py36h28b3542_0
  attrs              conda-forge::attrs-20.2.0-pyh9f0ad1d_0 --> pkgs/main::attrs-20.2.0-py_0
  backcall           conda-forge::backcall-0.2.0-pyh9f0ad1~ --> pkgs/main::backcall-0.2.0-py_0
  blas                       conda-forge::blas-1.1-openblas --> pkgs/main::blas-1.0-mkl
  bleach             conda-forge::bleach-3.2.1-pyh9f0ad1d_0 --> pkgs/main::bleach-3.2.1-py_0
  c-ares              conda-forge::c-ares-1.16.1-h516909a_3 --> pkgs/main::c-ares-1.16.1-h7b6447c_0
  cffi               conda-forge::cffi-1.14.3-py36h0ff685e~ --> pkgs/main::cffi-1.14.0-py36h2e261b9_0
  cycler             conda-forge/noarch::cycler-0.10.0-py_2 --> pkgs/main/linux-64::cycler-0.10.0-py36_0
  decorator                                     conda-forge --> pkgs/main
  defusedxml                                    conda-forge --> pkgs/main
  entrypoints        conda-forge::entrypoints-0.3-py36h9f0~ --> pkgs/main::entrypoints-0.3-py36_0
  fontconfig         conda-forge::fontconfig-2.13.1-he4413~ --> pkgs/main::fontconfig-2.13.0-h9420a91_0
  gast                 conda-forge::gast-0.4.0-pyh9f0ad1d_0 --> pkgs/main::gast-0.4.0-py_0
  grpcio             conda-forge::grpcio-1.16.0-py36h4f00d~ --> pkgs/main::grpcio-1.14.1-py36h9ba97e2_0
  icu                   conda-forge::icu-58.2-hf484d3e_1000 --> pkgs/main::icu-58.2-he6710b0_3
  ipykernel          conda-forge::ipykernel-5.3.4-py36h95a~ --> pkgs/main::ipykernel-5.3.4-py36h5ca1d4c_0
  ipython            conda-forge::ipython-7.16.1-py36h95af~ --> pkgs/main::ipython-7.16.1-py36h5ca1d4c_0
  ipython_genutils   conda-forge/noarch::ipython_genutils-~ --> pkgs/main/linux-64::ipython_genutils-0.2.0-py36_0
  ipywidgets         conda-forge::ipywidgets-7.5.1-pyh9f0a~ --> pkgs/main::ipywidgets-7.5.1-py_1
  jedi               conda-forge::jedi-0.17.2-py36h9f0ad1d~ --> pkgs/main::jedi-0.17.2-py36_0
  jinja2             conda-forge::jinja2-2.11.2-pyh9f0ad1d~ --> pkgs/main::jinja2-2.11.2-py_0
  jpeg                      conda-forge::jpeg-9d-h516909a_0 --> pkgs/main::jpeg-9b-h024ee3a_2
  jupyter_client                                conda-forge --> pkgs/main
  jupyter_console                               conda-forge --> pkgs/main
  jupyter_core       conda-forge::jupyter_core-4.6.3-py36h~ --> pkgs/main::jupyter_core-4.6.3-py36_0
  jupyterlab_launch~                            conda-forge --> pkgs/main
  jupyterlab_pygmen~ conda-forge::jupyterlab_pygments-0.1.~ --> pkgs/main::jupyterlab_pygments-0.1.2-py_0
  keras-applications conda-forge/noarch::keras-application~ --> pkgs/main/linux-64::keras-applications-1.0.4-py36_1
  keras-preprocessi~ conda-forge/noarch::keras-preprocessi~ --> pkgs/main/linux-64::keras-preprocessing-1.0.2-py36_1
  kiwisolver         conda-forge::kiwisolver-1.2.0-py36hdb~ --> pkgs/main::kiwisolver-1.2.0-py36hfd86e86_0
  libffi             conda-forge::libffi-3.2.1-he1b5a44_10~ --> pkgs/main::libffi-3.2.1-hf484d3e_1007
  libgcc-ng          conda-forge::libgcc-ng-9.3.0-h5dbcf3e~ --> pkgs/main::libgcc-ng-9.1.0-hdf63c60_0
  libpng              conda-forge::libpng-1.6.37-hed695b0_2 --> pkgs/main::libpng-1.6.37-hbc83047_0
  libsodium          conda-forge::libsodium-1.0.18-h516909~ --> pkgs/main::libsodium-1.0.18-h7b6447c_0
  libstdcxx-ng       conda-forge::libstdcxx-ng-9.3.0-h2ae2~ --> pkgs/main::libstdcxx-ng-9.1.0-hdf63c60_0
  libtiff             conda-forge::libtiff-4.1.0-hc7e4089_6 --> pkgs/main::libtiff-4.1.0-h2733197_1
  libuuid            conda-forge::libuuid-2.32.1-h14c3975_~ --> pkgs/main::libuuid-1.0.3-h1bed415_2
  lz4-c                 conda-forge::lz4-c-1.9.2-he1b5a44_3 --> pkgs/main::lz4-c-1.9.2-heb0550a_3
  markupsafe         conda-forge::markupsafe-1.1.1-py36h8c~ --> pkgs/main::markupsafe-1.1.1-py36h7b6447c_0
  mistune            conda-forge::mistune-0.8.4-py36h8c4c3~ --> pkgs/main::mistune-0.8.4-py36h7b6447c_0
  nbconvert          conda-forge::nbconvert-6.0.7-py36h9f0~ --> pkgs/main::nbconvert-6.0.7-py36_0
  ncurses               conda-forge::ncurses-6.2-he1b5a44_1 --> pkgs/main::ncurses-6.2-he6710b0_1
  nest-asyncio                                  conda-forge --> pkgs/main
  notebook           conda-forge::notebook-6.1.4-py36h9f0a~ --> pkgs/main::notebook-6.1.4-py36_0
  numpy              conda-forge::numpy-1.15.1-py36_blas_o~ --> pkgs/main::numpy-1.15.1-py36h1d66e8a_0
  packaging          conda-forge::packaging-20.4-pyh9f0ad1~ --> pkgs/main::packaging-20.4-py_0
  pandocfilters      conda-forge/noarch::pandocfilters-1.4~ --> pkgs/main/linux-64::pandocfilters-1.4.2-py36_1
  parso               conda-forge::parso-0.7.1-pyh9f0ad1d_0 --> pkgs/main::parso-0.7.0-py_0
  pcre                    conda-forge::pcre-8.44-he1b5a44_0 --> pkgs/main::pcre-8.44-he6710b0_0
  pexpect            conda-forge::pexpect-4.8.0-py36h9f0ad~ --> pkgs/main::pexpect-4.8.0-py36_0
  pickleshare        conda-forge::pickleshare-0.7.5-py36h9~ --> pkgs/main::pickleshare-0.7.5-py36_0
  prometheus_client  conda-forge::prometheus_client-0.8.0-~ --> pkgs/main::prometheus_client-0.8.0-py_0
  ptyprocess         conda-forge/noarch::ptyprocess-0.6.0-~ --> pkgs/main/linux-64::ptyprocess-0.6.0-py36_0
  pycparser          conda-forge::pycparser-2.20-pyh9f0ad1~ --> pkgs/main::pycparser-2.20-py_2
  pygments                                      conda-forge --> pkgs/main
  pyparsing          conda-forge::pyparsing-2.4.7-pyh9f0ad~ --> pkgs/main::pyparsing-2.4.7-py_0
  pyqt               conda-forge::pyqt-5.6.0-py36h13b7fb3_~ --> pkgs/main::pyqt-5.6.0-py36h22d08a2_6
  pyrsistent         conda-forge::pyrsistent-0.17.3-py36h8~ --> pkgs/main::pyrsistent-0.17.3-py36h7b6447c_0
  python-dateutil                               conda-forge --> pkgs/main
  pytz                conda-forge::pytz-2020.1-pyh9f0ad1d_0 --> pkgs/main::pytz-2020.1-py_0
  qtconsole          conda-forge::qtconsole-4.7.7-pyh9f0ad~ --> pkgs/main::qtconsole-4.7.7-py_0
  qtpy                                          conda-forge --> pkgs/main
  readline           conda-forge::readline-7.0-hf8c457e_10~ --> pkgs/main::readline-7.0-h7b6447c_5
  scikit-learn       conda-forge::scikit-learn-0.19.1-py36~ --> pkgs/main::scikit-learn-0.19.1-py36hedc7406_0
  scipy              conda-forge::scipy-1.1.0-py36_blas_op~ --> pkgs/main::scipy-1.1.0-py36hfa4b5c9_1
  send2trash         conda-forge/noarch::send2trash-1.5.0-~ --> pkgs/main/linux-64::send2trash-1.5.0-py36_0
  sip                conda-forge::sip-4.18.1-py36hf484d3e_~ --> pkgs/main::sip-4.18.1-py36hf484d3e_2
  six                  conda-forge::six-1.15.0-pyh9f0ad1d_0 --> pkgs/main::six-1.15.0-py_0
  termcolor          conda-forge/noarch::termcolor-1.1.0-p~ --> pkgs/main/linux-64::termcolor-1.1.0-py36_1
  terminado          conda-forge::terminado-0.9.1-py36h9f0~ --> pkgs/main::terminado-0.9.1-py36_0
  testpath                                      conda-forge --> pkgs/main
  tk                      conda-forge::tk-8.6.10-hed695b0_0 --> pkgs/main::tk-8.6.10-hbc83047_0
  tornado            conda-forge::tornado-6.0.4-py36h8c4c3~ --> pkgs/main::tornado-6.0.4-py36h7b6447c_1
  traitlets          conda-forge::traitlets-4.3.3-py36h9f0~ --> pkgs/main::traitlets-4.3.3-py36_0
  wcwidth            conda-forge::wcwidth-0.2.5-pyh9f0ad1d~ --> pkgs/main::wcwidth-0.2.5-py_0
  webencodings       conda-forge/noarch::webencodings-0.5.~ --> pkgs/main/linux-64::webencodings-0.5.1-py36_1
  werkzeug           conda-forge::werkzeug-1.0.1-pyh9f0ad1~ --> pkgs/main::werkzeug-1.0.1-py_0
  wheel              conda-forge::wheel-0.35.1-pyh9f0ad1d_0 --> pkgs/main::wheel-0.35.1-py_0
  widgetsnbextension conda-forge::widgetsnbextension-3.5.1~ --> pkgs/main::widgetsnbextension-3.5.1-py36_0
  xz                       conda-forge::xz-5.2.5-h516909a_1 --> pkgs/main::xz-5.2.5-h7b6447c_0
  yaml                   conda-forge::yaml-0.2.5-h516909a_0 --> pkgs/main::yaml-0.2.5-h7b6447c_0
  zlib               conda-forge::zlib-1.2.11-h516909a_1009 --> pkgs/main::zlib-1.2.11-h7b6447c_3
  zstd                   conda-forge::zstd-1.4.5-h6597ccf_2 --> pkgs/main::zstd-1.4.5-h9ceee32_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
testpath-0.4.4       | 82 KB     | ################################################################################################ | 100% 
zstd-1.4.5           | 619 KB    | ################################################################################################ | 100% 
mkl-2018.0.3         | 126.9 MB  | ################################################################################################ | 100% 
grpcio-1.14.1        | 944 KB    | ################################################################################################ | 100% 
jupyterlab_pygments- | 8 KB      | ################################################################################################ | 100% 
readline-7.0         | 324 KB    | ################################################################################################ | 100% 
bleach-3.2.1         | 112 KB    | ################################################################################################ | 100% 
markupsafe-1.1.1     | 29 KB     | ################################################################################################ | 100% 
async_generator-1.10 | 39 KB     | ################################################################################################ | 100% 
python-dateutil-2.8. | 215 KB    | ################################################################################################ | 100% 
ipykernel-5.3.4      | 181 KB    | ################################################################################################ | 100% 
argon2-cffi-20.1.0   | 46 KB     | ################################################################################################ | 100% 
freetype-2.10.4      | 596 KB    | ################################################################################################ | 100% 
mistune-0.8.4        | 55 KB     | ################################################################################################ | 100% 
scikit-learn-0.19.1  | 3.9 MB    | ################################################################################################ | 100% 
traitlets-4.3.3      | 140 KB    | ################################################################################################ | 100% 
sip-4.18.1           | 261 KB    | ################################################################################################ | 100% 
pandoc-2.11          | 9.6 MB    | ################################################################################################ | 100% 
jupyterlab_launcher- | 23 KB     | ################################################################################################ | 100% 
kiwisolver-1.2.0     | 84 KB     | ################################################################################################ | 100% 
importlib_metadata-2 | 11 KB     | ################################################################################################ | 100% 
pexpect-4.8.0        | 82 KB     | ################################################################################################ | 100% 
nest-asyncio-1.4.1   | 10 KB     | ################################################################################################ | 100% 
keras-applications-1 | 45 KB     | ################################################################################################ | 100% 
zipp-3.3.1           | 12 KB     | ################################################################################################ | 100% 
libxml2-2.9.10       | 1.2 MB    | ################################################################################################ | 100% 
decorator-4.4.2      | 14 KB     | ################################################################################################ | 100% 
jedi-0.17.2          | 916 KB    | ################################################################################################ | 100% 
zeromq-4.3.3         | 500 KB    | ################################################################################################ | 100% 
defusedxml-0.6.0     | 23 KB     | ################################################################################################ | 100% 
setuptools-50.3.0    | 713 KB    | ################################################################################################ | 100% 
webencodings-0.5.1   | 19 KB     | ################################################################################################ | 100% 
ipython_genutils-0.2 | 39 KB     | ################################################################################################ | 100% 
lz4-c-1.9.2          | 175 KB    | ################################################################################################ | 100% 
pyzmq-19.0.2         | 434 KB    | ################################################################################################ | 100% 
pandocfilters-1.4.2  | 13 KB     | ################################################################################################ | 100% 
cycler-0.10.0        | 13 KB     | ################################################################################################ | 100% 
termcolor-1.1.0      | 8 KB      | ################################################################################################ | 100% 
mkl_random-1.0.1     | 324 KB    | ################################################################################################ | 100% 
protobuf-3.13.0.1    | 633 KB    | ################################################################################################ | 100% 
qtpy-1.9.0           | 38 KB     | ################################################################################################ | 100% 
prompt-toolkit-3.0.8 | 248 KB    | ################################################################################################ | 100% 
nbformat-5.0.8       | 88 KB     | ################################################################################################ | 100% 
markdown-3.3.2       | 125 KB    | ################################################################################################ | 100% 
scipy-1.1.0          | 13.2 MB   | ################################################################################################ | 100% 
h5py-2.10.0          | 901 KB    | ################################################################################################ | 100% 
expat-2.2.10         | 153 KB    | ################################################################################################ | 100% 
jupyter_core-4.6.3   | 71 KB     | ################################################################################################ | 100% 
libffi-3.2.1         | 48 KB     | ################################################################################################ | 100% 
ptyprocess-0.6.0     | 23 KB     | ################################################################################################ | 100% 
wheel-0.35.1         | 37 KB     | ################################################################################################ | 100% 
pip-20.2.4           | 1.8 MB    | ################################################################################################ | 100% 
nbconvert-6.0.7      | 480 KB    | ################################################################################################ | 100% 
libprotobuf-3.13.0.1 | 2.0 MB    | ################################################################################################ | 100% 
pyyaml-5.3.1         | 180 KB    | ################################################################################################ | 100% 
entrypoints-0.3      | 12 KB     | ################################################################################################ | 100% 
jupyter_console-6.2. | 26 KB     | ################################################################################################ | 100% 
pyqt-5.6.0           | 4.4 MB    | ################################################################################################ | 100% 
tornado-6.0.4        | 597 KB    | ################################################################################################ | 100% 
hdf5-1.10.6          | 3.7 MB    | ################################################################################################ | 100% 
attrs-20.2.0         | 42 KB     | ################################################################################################ | 100% 
tbb4py-2020.3        | 200 KB    | ################################################################################################ | 100% 
jsonschema-3.2.0     | 47 KB     | ################################################################################################ | 100% 
qtconsole-4.7.7      | 96 KB     | ################################################################################################ | 100% 
numpy-1.15.1         | 36 KB     | ################################################################################################ | 100% 
gstreamer-1.14.0     | 3.1 MB    | ################################################################################################ | 100% 
qt-5.6.3             | 36.4 MB   | ################################################################################################ | 100% 
mkl_fft-1.0.6        | 135 KB    | ################################################################################################ | 100% 
send2trash-1.5.0     | 16 KB     | ################################################################################################ | 100% 
pickleshare-0.7.5    | 13 KB     | ################################################################################################ | 100% 
widgetsnbextension-3 | 862 KB    | ################################################################################################ | 100% 
sqlite-3.33.0        | 1.1 MB    | ################################################################################################ | 100% 
ipywidgets-7.5.1     | 98 KB     | ################################################################################################ | 100% 
cffi-1.14.0          | 223 KB    | ################################################################################################ | 100% 
ipython-7.16.1       | 999 KB    | ################################################################################################ | 100% 
tbb-2020.3           | 1.1 MB    | ################################################################################################ | 100% 
glib-2.63.1          | 2.9 MB    | ################################################################################################ | 100% 
keras-preprocessing- | 44 KB     | ################################################################################################ | 100% 
absl-py-0.10.0       | 168 KB    | ################################################################################################ | 100% 
c-ares-1.16.1        | 108 KB    | ################################################################################################ | 100% 
pyrsistent-0.17.3    | 89 KB     | ################################################################################################ | 100% 
importlib-metadata-2 | 35 KB     | ################################################################################################ | 100% 
jupyter_client-6.1.7 | 77 KB     | ################################################################################################ | 100% 
astor-0.8.1          | 47 KB     | ################################################################################################ | 100% 
notebook-6.1.4       | 4.1 MB    | ################################################################################################ | 100% 
terminado-0.9.1      | 27 KB     | ################################################################################################ | 100% 
prompt_toolkit-3.0.8 | 12 KB     | ################################################################################################ | 100% 
numpy-base-1.15.1    | 3.4 MB    | ################################################################################################ | 100% 
gast-0.4.0           | 15 KB     | ################################################################################################ | 100% 
nbclient-0.5.1       | 58 KB     | ################################################################################################ | 100% 
pygments-2.7.1       | 671 KB    | ################################################################################################ | 100% 
intel-openmp-2019.4  | 729 KB    | ################################################################################################ | 100% 
dbus-1.13.18         | 504 KB    | ################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: | Uninstalling jupyter-js-widgets jupyter-js-widgets/extension
Removing: /home/bojan/anaconda3/envs/my-env/share/jupyter/nbextensions/jupyter-js-widgets

done


Let's now install it from conda-forge channel:

(my-env) $ conda install -c conda-forge opencv
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: done

## Package Plan ##

  environment location: /home/bojan/anaconda3/envs/my-env

  added / updated specs:
    - opencv


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    giflib-5.2.1               |       h36c2ea0_2          77 KB  conda-forge
    gmp-6.2.0                  |       h58526e2_4         818 KB  conda-forge
    graphite2-1.3.13           |    h58526e2_1001         102 KB  conda-forge
    pixman-0.40.0              |       h36c2ea0_0         627 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         1.6 MB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/linux-64::bzip2-1.0.8-h516909a_3
  cairo              pkgs/main/linux-64::cairo-1.14.12-h8948797_3
  ffmpeg             conda-forge/linux-64::ffmpeg-4.1.3-h167e202_0
  giflib             conda-forge/linux-64::giflib-5.2.1-h36c2ea0_2
  gmp                conda-forge/linux-64::gmp-6.2.0-h58526e2_4
  gnutls             conda-forge/linux-64::gnutls-3.6.13-h79a8f9a_0
  graphite2          conda-forge/linux-64::graphite2-1.3.13-h58526e2_1001
  harfbuzz           pkgs/main/linux-64::harfbuzz-2.4.0-hca77d97_0
  jasper             conda-forge/linux-64::jasper-1.900.1-h07fcdf6_1006
  lame               conda-forge/linux-64::lame-3.100-h14c3975_1001
  libblas            conda-forge/linux-64::libblas-3.8.0-8_h6e990d7_netlib
  libcblas           conda-forge/linux-64::libcblas-3.8.0-8_h6e990d7_netlib
  libiconv           conda-forge/linux-64::libiconv-1.16-h516909a_0
  liblapack          conda-forge/linux-64::liblapack-3.8.0-8_h6e990d7_netlib
  liblapacke         conda-forge/linux-64::liblapacke-3.8.0-8_h6e990d7_netlib
  libwebp            conda-forge/linux-64::libwebp-1.0.2-h56121f0_5
  nettle             conda-forge/linux-64::nettle-3.4.1-h1bed415_1002
  opencv             conda-forge/linux-64::opencv-4.1.0-py36h79d2e43_1
  openh264           conda-forge/linux-64::openh264-1.8.0-hdbcaa40_1000
  pixman             conda-forge/linux-64::pixman-0.40.0-h36c2ea0_0
  x264               conda-forge/linux-64::x264-1!152.20180806-h14c3975_0

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    pkgs/main::ca-certificates-2020.10.14~ --> conda-forge::ca-certificates-2020.6.20-hecda079_0
  certifi            pkgs/main/noarch::certifi-2020.6.20-p~ --> conda-forge/linux-64::certifi-2020.6.20-py36h9880bd3_2
  h5py                pkgs/main::h5py-2.10.0-py36hd6299e0_1 --> conda-forge::h5py-2.9.0-nompi_py36hcafd542_1103
  hdf5                    pkgs/main::hdf5-1.10.6-hb1b8bf9_0 --> conda-forge::hdf5-1.10.4-nompi_h3c11f04_1106
  openssl              pkgs/main::openssl-1.0.2u-h7b6447c_0 --> conda-forge::openssl-1.0.2u-h516909a_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
graphite2-1.3.13     | 102 KB    | ################################################################################################ | 100% 
gmp-6.2.0            | 818 KB    | ################################################################################################ | 100% 
pixman-0.40.0        | 627 KB    | ################################################################################################ | 100% 
giflib-5.2.1         | 77 KB     | ################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done


After this we have only this OpenCV package:

(my-env) $ conda list | grep opencv
opencv                    4.1.0            py36h79d2e43_1    conda-forge
 

NOTE: If we want to install specific version of the package it can be specified like here:

(my-env) $ conda install -c conda-forge opencv=4.1.0


Let's check details of GUI support in this build:

(my-env) $ python
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.getBuildInformation()
'\nGeneral configuration for OpenCV 4.1.0 =====================================\n  Version control:               90416df\n\n  Extra modules:\n    Location (extra):            /home/conda/feedstock_root/build_artifacts/opencv_1556233957555/work/opencv_contrib/modules\n    Version control (extra):     90416df\n\n  Platform:\n    Timestamp:                   2019-04-25T23:17:35Z\n    Host:                        Linux 4.15.0-1041-azure x86_64\n    GUI: \n    QT:                          YES (ver 5.6.2)\n      QT OpenGL support:         NO\n    GTK+:                        NO\n\n  Media I/O: \n    
>>> 


This now opens an image in its own window:

(my-env) $ python
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy as np
>>> cv2.imshow('darkness', np.zeros((100, 100)))
>>> cv2.waitKey()
82
>>> Killed


We can specify desired channel and version of the package in the environment yml file:

my_env_config.yml:

name: my_env
channels:
  - menpo
  - conda-forge
  - defaults
dependencies:
  ...
  - conda-forge::opencv=4.1.0 # required for Ubuntu. This cv2 package has Qt as GUI backend
  ...