Search code examples
pythondockerpython-bob

How to install bob python toolkit with docker?


I'm trying to install bob.learn.em, but there is not any documented straightforward approach to install bob.

There are some very old resources like these to install bob:

https://hub.docker.com/r/artimi/bob

https://github.com/Artimi/bob_docker_image/blob/master/Dockerfile

But none of them can not install bob.learn.em or any latest bob packages.

I am unsuccessful while trying both pip and conda, the official document (https://www.idiap.ch/software/bob/docs/bob/docs/stable/install.html) doesn't work (at least for my system, I even tried conda in a docker container)

Is there any docker container or reproducible recipe for installing bob and bob packages like bob.learn.em?

errors inside anaconda3 container,

 docker pull continuumio/anaconda3
Using default tag: latest
latest: Pulling from continuumio/anaconda3
7d63c13d9b9b: Pull complete
49c20f8a042a: Pull complete
Digest: sha256:d7b270f0460d03956a8bcc4d8bffe2426eec5d260fd5256e0a197d0e2e2f7941
Status: Downloaded newer image for continuumio/anaconda3:latest
SYS-1029GQ-TVRT:~$ docker run -i -t continuumio/anaconda3 /bin/bash
(base) root@b29e88642f09:/# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
(base) root@b29e88642f09:/# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
(base) root@b29e88642f09:/# conda --version
conda 4.10.1
(base) root@b29e88642f09:/# conda update -n base -c defaults conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/conda

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.10.3               |   py38h06a4308_0         2.9 MB
    xmltodict-0.12.0           |     pyhd3eb1b0_0          13 KB
    ------------------------------------------------------------
                                           Total:         2.9 MB

The following packages will be UPDATED:

  conda                               4.10.1-py38h06a4308_1 --> 4.10.3-py38h06a4308_0

The following packages will be DOWNGRADED:

  xmltodict                                     0.12.0-py_0 --> 0.12.0-pyhd3eb1b0_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
xmltodict-0.12.0     | 13 KB     | ##################################### | 100%
conda-4.10.3         | 2.9 MB    | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) root@b29e88642f09:/# conda config --set show_channel_urls True
(base) root@b29e88642f09:/# conda create --name bob_env1 --override-channels \
  -c https://www.idiap.ch/software/bob/conda -c defaults \
  python=3 bob.learn.em
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                       \

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package python conflicts for:
python=3
bob.learn.em -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|3.4.*']
bob.learn.em -> boost[version='>=1.73.0,<1.73.1.0a0'] -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0']The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.31=0
  - feature:|@/linux-64::__glibc==2.31=0
  - bob.learn.em -> bob.extension[version='>=6.0.0,<7.0a0'] -> __glibc[version='>=2.17|>=2.17,<3.0.a0']

Your installed version is: 2.31


(base) root@b29e88642f09:/# conda create -n bdt -c https://www.idiap.ch/software/bob/conda bob.devtools
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError:

(base) root@b29e88642f09:/# conda install \
-c https://www.idiap.ch/software/bob/conda \
-c defaults \
-c https://www.idiap.ch/software/bob/conda/label/archive \
bob=4.0.0 bob.io.base
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - bob.io.base -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0']
  - bob=4.0.0 -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package certifi conflicts for:
bob=4.0.0 -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
bob.io.base -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']

Package _libgcc_mutex conflicts for:
python=3.8 -> libgcc-ng[version='>=7.5.0'] -> _libgcc_mutex[version='*|0.1',build=main]
bob.io.base -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex[version='*|0.1',build=main]The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.31=0
  - feature:|@/linux-64::__glibc==2.31=0
  - bob.io.base -> bob.extension[version='>=6.0.0,<7.0a0'] -> __glibc[version='>=2.17|>=2.17,<3.0.a0']

Your installed version is: 2.31


(base) root@b29e88642f09:/# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
(base) root@b29e88642f09:/# mkdir bob
(base) root@b29e88642f09:/# cd bob
(base) root@b29e88642f09:/bob# wget https://www.idiap.ch/software/bob/docs/bob/docs/stable/_downloads/fb6ec72cab2ebaf2fbd8a4717d139e29/v300py36.yaml
--2021-10-21 16:35:26--  https://www.idiap.ch/software/bob/docs/bob/docs/stable/_downloads/fb6ec72cab2ebaf2fbd8a4717d139e29/v300py36.yaml
Resolving www.idiap.ch (www.idiap.ch)... 192.33.221.201
Connecting to www.idiap.ch (www.idiap.ch)|192.33.221.201|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7020 (6.9K) [application/octet-stream]
Saving to: ‘v300py36.yaml’

v300py36.yaml       100%[===================>]   6.86K  --.-KB/s    in 0s

2021-10-21 16:35:28 (18.7 MB/s) - ‘v300py36.yaml’ saved [7020/7020]

(base) root@b29e88642f09:/bob# ls
v300py36.yaml
(base) root@b29e88642f09:/bob# conda env create --file v300py36.yaml
Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound:
  - ncurses==5.9=10
  - yaml==0.1.6=0
  - cython==0.25.2=py36_0
  - pyyaml==3.12=py36_0
  - icu==54.1=0
  - sqlite==3.13.0=0
  - pkg-config==0.28=1
  - numpy==1.12.1=py36_0
  - alabaster==0.7.10=py36_0
  - decorator==4.1.2=py36_0
  - html5lib==0.9999999=py36_0
  - mpc==1.0.3=0
  - path.py==10.3.1=py36_0
  - pcre==8.39=1
  - libpng==1.6.27=0
  - pandocfilters==1.4.2=py36_0
  - lmdb==0.9.21=0
  - libffi==3.2.1=1
  - six==1.10.0=py36_0
  - ipython==5.3.0=py36_0
  - certifi==2016.2.28=py36_0
  - fontconfig==2.12.1=3
  - requests==2.14.2=py36_0
  - scikit-learn==0.18.1=np112py36_1
  - pip==9.0.1=py36_1
  - sip==4.18=py36_0
  - bzip2==1.0.6=3
  - simplegeneric==0.8.1=py36_1
  - llvmlite==0.18.0=py36_0
  - boost==1.61.0=py36_0
  - jupyter_client==5.1.0=py36_0
  - jupyter_console==5.2.0=py36_0
  - markupsafe==1.0=py36_0
  - wheel==0.29.0=py36_0
  - entrypoints==0.2.3=py36_0
  - zeromq==4.1.5=0
  - olefile==0.44=py36_0
  - libiconv==1.14=0
  - coverage==4.3.4=py36_0
  - h5py==2.7.0=np112py36_0
  - pywavelets==0.5.2=np112py36_0
  - notebook==5.0.0=py36_0
  - cytoolz==0.8.2=py36_0
  - dbus==1.10.20=0
  - gflags==2.2.0=1
  - matplotlib==2.0.2=np112py36_0
  - mistune==0.7.4=py36_0
  - tornado==4.5.2=py36_0
  - toolz==0.8.2=py36_0
  - libtiff==4.0.6=3
  - backports.weakref==1.0rc1=py36_0
  - bokeh==0.12.7=py36_0
  - dask==0.14.3=py36_1
  - libgcc==4.8.5=2
  - ipykernel==4.6.1=py36_0
  - protobuf==3.2.0=py36_0
  - glib==2.50.2=1
  - ipywidgets==6.0.0=py36_0
  - numba==0.33.0=np112py36_0
  - bleach==1.5.0=py36_0
  - leveldb==1.20=0
  - widgetsnbextension==3.0.2=py36_0
  - cloudpickle==0.4.0=py36_0
  - numexpr==2.6.2=np112py36_0
  - pexpect==4.2.1=py36_0
  - pyqt==5.6.0=py36_2
  - gmp==6.1.0=0
  - libxcb==1.12=1
  - pyzmq==16.0.2=py36_0
  - werkzeug==0.12.2=py36_0
  - virtualenv==15.1.0=py36_0
  - backports==1.0=py36_0
  - nbconvert==5.2.1=py36_0
  - gst-plugins-base==1.8.0=0
  - expat==2.1.0=0
  - curl==7.52.1=0
  - mkl==2017.0.1=0
  - jpeg==9b=0
  - jinja2==2.9.6=py36_0
  - nose==1.3.7=py36_1
  - libprotobuf==3.2.0=0
  - gcc==4.8.5=7
  - libgfortran==3.0.0=1
  - tk==8.5.18=0
  - hdf5==1.8.17=2
  - jupyter==1.0.0=py36_3
  - mpfr==3.1.5=0
  - caffe==1.0.0rc5=np112py36_0
  - pillow==4.1.1=py36_0
  - tensorflow==1.2.1=py36_0
  - sphinx_rtd_theme==0.2.4=py36_0
  - python-gflags==3.1.1=py36_0
  - sphinx==1.5.6=py36_0
  - jbig==2.1=0
  - terminado==0.6=py36_0
  - xz==5.2.3=0
  - jupyter_core==4.3.0=py36_0
  - python==3.6.2=0
  - scipy==0.19.0=np112py36_0
  - openblas==0.2.19=0
  - markdown==2.6.9=py36_0
  - setuptools==36.4.0=py36_1
  - qt==5.6.2=5
  - sqlalchemy==1.1.9=py36_0
  - readline==6.2=2
  - cmake==3.6.3=0
  - pandas==0.20.1=np112py36_0
  - freetype==2.5.5=2
  - openssl==1.0.2l=0
  - gstreamer==1.8.0=0
  - ptyprocess==0.5.2=py36_0
  - imagesize==0.7.1=py36_0
  - zlib==1.2.11=0
  - babel==2.5.0=py36_0
  - libsodium==1.0.10=0
  - snappy==1.1.6=0
  - pyparsing==2.2.0=py36_0
  - python-dateutil==2.6.1=py36_0
  - scikit-image==0.13.0=np112py36_0
  - pytz==2017.2=py36_0
  - glog==0.3.5=0
  - networkx==1.11=py36_0
  - python-leveldb==0.194=py36_1
  - libxml2==2.9.4=0


How to make it work?


Solution

  • Wrote this simple dockerfile.

    Dockerfile

    FROM continuumio/anaconda3:latest
    ARG DEBIAN_FRONTEND=noninteractive
    
    WORKDIR /bob
    COPY . /bob/
    RUN apt update
    RUN apt install -y build-essential libopencv-dev python3-opencv ffmpeg libsndfile1 libsndfile-dev wget git tmux
    
    RUN conda env create -f bob.yml
    # Make RUN commands use the new environment:
    SHELL ["conda", "run", "-n", "bob", "/bin/bash", "-c"]
    
    RUN conda config --add channels conda-forge
    RUN conda install -y -c conda-forge/label/broken bob.learn.em
    

    bob.yml

    name: bob
    channels:
      - conda-forge
    dependencies:
      - python=3.5
      - numpy
    

    ref: https://github.com/zabir-nabil/bob-plda-docker