Installing python >=3.6 in a cpp image

I’m having trouble with installing python3.6 and python3.7 from deadsnakes in a cpp image.

Build: Installing APT Packages
10.75s$ travis_apt_get_update
0.51s$ sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install g++-4.8 libblas-dev liblapack-dev gfortran cmake libboost-all-dev libgsl0-dev libeigen3-dev python3.6
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'

Build link: https://travis-ci.com/scottgigante/nmslib/jobs/166355276
apt config:

addons:
  apt:
    update: true
    sources:
    - ubuntu-toolchain-r-test
    - deadsnakes
    packages: &core_build
    - g++-4.8
    - libblas-dev
    - liblapack-dev
    - gfortran
    - cmake
    - libboost-all-dev
    - libgsl0-dev
    - libeigen3-dev

matrix:
  fast_finish: true
  include:
  - os: linux
    env: PYTHON=3.6
    dist: xenial
    addons:
      apt:
        packages:
          - *core_build
          - python3.6

Xenial only provides Python 3.5.1 and unless your language: is python, Travis’ logic to install other versions is unavailable.

Use a 3rd-party library that can install various Python versions itself. I can name multibuild and pyenv from the top of my head.

Does that mean that travis is blocking deadsnakes from providing python3.6? 3.6 and 3.7 are available from ppa:deadsnakes which I have provided in my apt sources.

The problem here is the configuration. Your jobs are not getting the required APT source deadsnakes. In your configuration, you define apt at the top level but it is overridden by the jobs. YAML does not perform any deep merge like this.

Thanks very much! I moved the sources: - deadsnakes to the job level and that fixed it.

Imprint