Showing posts with label conda. Show all posts
Showing posts with label conda. Show all posts

Friday, 15 January 2021

Using Python Virtual Environments

Different Python projects depend on different packages. To keep them separated and avoid polluting the global space with package installations we can use the concept of virtual environments. There are several ways to work with virtual environments in Python:
  • virtualenv
  • virtualenvwrapper
  • Conda (part of Anaconda)

virtualenv



To use virtualenv we first need to install all necessary components:

$ sudo apt update
$ sudo apt install python3-dev python3-pip
$ sudo pip3 install -U virtualenv  # system-wide install

Verification:

$ python3 --version
$ pip3 --version
$ virtualenv --version

or

$ virtualenv
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: the following arguments are required: dest
SystemExit: 2

or

$ virtualenv --help
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest

optional arguments:
  --version                     display the version of the virtualenv package and its location, then exit
  --with-traceback              on failure also display the stacktrace internals of virtualenv (default: False)
  --read-only-app-data          use app data folder in read-only mode (write operations will fail with error) (default: False)
  --app-data APP_DATA           a data folder used as cache by the virtualenv (default: /home/bojan/.local/share/virtualenv)
  --reset-app-data              start with empty app data folder (default: False)
  --upgrade-embed-wheels        trigger a manual update of the embedded wheels (default: False)
  -h, --help                    show this help message and exit

verbosity:
  verbosity = verbose - quiet, default INFO, mapping => CRITICAL=0, ERROR=1, WARNING=2, INFO=3, DEBUG=4, NOTSET=5

  -v, --verbose                 increase verbosity (default: 2)
  -q, --quiet                   decrease verbosity (default: 0)

discovery:
  discover and provide a target interpreter

  --discovery {builtin}         interpreter discovery method (default: builtin)
  -p py, --python py            interpreter based on what to create environment (path/identifier) - by default use the interpreter where the tool is installed - first found wins (default: [])
  --try-first-with py_exe       try first these interpreters before starting the discovery (default: [])

creator:
  options for creator builtin

  --creator {builtin,cpython3-posix,venv}
                                create environment via (builtin = cpython3-posix) (default: builtin)
  dest                          directory to create virtualenv at
  --clear                       remove the destination directory if exist before starting (will overwrite files otherwise) (default: False)
  --no-vcs-ignore               don't create VCS ignore directive in the destination directory (default: False)
  --system-site-packages        give the virtual environment access to the system site-packages dir (default: False)
  --symlinks                    try to use symlinks rather than copies, when symlinks are not the default for the platform (default: True)
  --copies, --always-copy       try to use copies rather than symlinks, even when symlinks are the default for the platform (default: False)

seeder:
  options for seeder app-data

  --seeder {app-data,pip}       seed packages install method (default: app-data)
  --no-seed, --without-pip      do not install seed packages (default: False)
  --no-download, --never-download
                                pass to disable download of the latest pip/setuptools/wheel from PyPI (default: True)
  --download                    pass to enable download of the latest pip/setuptools/wheel from PyPI (default: False)
  --extra-search-dir d [d ...]  a path containing wheels to extend the internal wheel list (can be set 1+ times) (default: [])
  --pip version                 version of pip to install as seed: embed, bundle or exact version (default: bundle)
  --setuptools version          version of setuptools to install as seed: embed, bundle or exact version (default: bundle)
  --wheel version               version of wheel to install as seed: embed, bundle or exact version (default: bundle)
  --no-pip                      do not install pip (default: False)
  --no-setuptools               do not install setuptools (default: False)
  --no-wheel                    do not install wheel (default: False)
  --no-periodic-update          disable the periodic (once every 14 days) update of the embedded wheels (default: False)
  --symlink-app-data            symlink the python packages from the app-data folder (requires seed pip>=19.3) (default: False)

activators:
  options for activation scripts

  --activators comma_sep_list   activators to generate - default is all supported (default: bash,cshell,fish,powershell,python,xonsh)
  --prompt prompt               provides an alternative prompt prefix for this environment (default: None)

config file /home/bojan/.config/virtualenv/virtualenv.ini missing (change via env var VIRTUALENV_CONFIG_FILE)


Create virtual environment (we chose to use python3 as Python interpreter and venv as the directory where to store virtual environment):

virtualenv -p python3 ./venv_dir_name

or

virtualenv --system-site-packages -p python3 ./venv_dir_name


If you build with virtualenv --system-site-packages ENV, your virtual environment will inherit packages from /usr/lib/python2.7/site-packages (or wherever your global site-packages directory is).

This can be used if you have control over the global site-packages directory, and you want to depend on the packages there. If you want isolation from the global system, do not use this flag. BK: This flag should be avoided as it defeats the entire point of virtualenvs (which is why --no-site-packages was made the default).

Example:

$ virtualenv -p python3 ./venv
created virtual environment CPython3.8.5.final.0-64 in 253ms
  creator CPython3Posix(dest=/home/bojan/dev/github/python-demo/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/bojan/.local/share/virtualenv)
    added seed packages: pip==20.3.3, setuptools==51.1.2, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator


I once experienced this error when tried to create a virtual environment:

$ virtualenv -p python3 ./venv
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 5, in <module>
    from virtualenv.__main__ import run_with_catch
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/run/__init__.py", line 6, in <module>
    from ..app_data import make_app_data
  File "/usr/local/lib/python3.8/dist-packages/virtualenv/app_data/__init__.py", line 9, in <module>
    from appdirs import user_data_dir
ModuleNotFoundError: No module named 'appdirs'

I then installed the missing module via pip but this showed another error:

$ sudo pip3 install appdirs
Collecting appdirs
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
ERROR: virtualenv 20.3.1 requires filelock<4,>=3.0.0, which is not installed.
Installing collected packages: appdirs
Successfully installed appdirs-1.4.4

I resolved this by reinstalling the virtualenv:

$ sudo pip3 install virtualenv
Requirement already satisfied: virtualenv in /usr/local/lib/python3.8/dist-packages (20.3.1)
Requirement already satisfied: appdirs<2,>=1.4.3 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (1.4.4)
Requirement already satisfied: six<2,>=1.9.0 in /usr/lib/python3/dist-packages (from virtualenv) (1.14.0)
Requirement already satisfied: distlib<1,>=0.3.1 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (0.3.1)
Collecting filelock<4,>=3.0.0
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Installing collected packages: filelock
Successfully installed filelock-3.0.12

Once virtual environment is created, we'll have venv/bin/activate script created. Let's explore it:

$ cat venv/bin/activate
...

deactivate() {
...
}
...
VIRTUAL_ENV="/home/bojan/dev/github/tensorflow-demo/venv"
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
...
pydoc () {
    python -m pydoc "$@"
}
...


We can see that we'll now have a new environment variable set - VIRTUAL_ENV and also a deactivate commmand.

To activate virtual environment:

$ source ./venv/bin/activate

We can also use a dot command:

$ . ./venv/bin/activate

When virtual environment is active, your shell prompt is prefixed with its name in form: (venv).

(venv) $ which pip
/home/bojan/dev/github/python-demo/venv/bin/pip

(venv) $ which pip3
/home/bojan/dev/github/python-demo/venv/bin/pip3


If we've saved requirements.txt, we can install all dependencies now with on of the following commands (see Python Package Management with pip | My Public Notepad):

$ pip install -r requirements.txt
pip3 install -r requirements.txt

It is possible to install a single new package in the virtual environment:

$ pip install package_name


Example:

(venv) $ pip3 install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.8.6-cp38-cp38-linux_x86_64.whl
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.6

To verify installation path:

(venv) $ pip3 show psycopg2
Name: psycopg2
Version: 2.8.6
Summary: psycopg2 - Python-PostgreSQL Database Adapter
Home-page: https://psycopg.org/
Author: Federico Di Gregorio
Author-email: fog@initd.org
License: LGPL with exceptions
Location: /home/user/dev/my-app/venv/lib/python3.8/site-packages
Requires: 
Required-by: 

To check the version of the package installed in virtual environment:

(venv) $ pip3 list | grep psycopg
psycopg2          2.8.6


To exit virtual environment:

(venv) $ deactivate

How to rename virtual environment?

directory - How to rename a virtualenv in Python? - Stack Overflow

From inside active virtual environment:

$ pip freeze > requirements.txt
$ deactivate

From python - Pip freeze vs. pip list - Stack Overflow
pip list shows ALL packages. 
pip freeze shows packages YOU installed via pip (or pipenv if using that tool) command in a requirements format.
Also, be aware of `$ pip freeze > requirements.txt` considered harmful

Then delete old environment directory. E.g.

$ rm -r ~/python-envs/tensorrt-5.1.5.1-tensorflow-1.14.0/

...and create a new one with correct name:

$ python3 -m virtualenv -p python3 ~/python-envs/tensorrt-5.1.5.1-tensorflow-1.15.0
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/nvidia/python-envs/tensorrt-5.1.5.1-tensorflow-1.15.0/bin/python3
Also creating executable in /home/nvidia/python-envs/tensorrt-5.1.5.1-tensorflow-1.15.0/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

Activate it and install all packages from the saved list:

$ source ~/python-envs/tensorrt-5.1.5.1-tensorflow-1.15.0/bin/activate
$ pip install -r requirements.txt
$ pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow-gpu==1.15.0+nv19.12


virtualenvwrapper


TBD...


Conda



References


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
  ...