Apt-get installation problem

#1

I get the following error trying to install my requirements:

   ERROR: running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.22 -I/usr/local/include/python3.6m -c src/params.cpp -o build/temp.linux-x86_64-3.6/src/params.o -Wno-write-strings
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from src/params.cpp:10:0:
    src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
     #include <sql.h>
                     ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

The solution for this is supposed to be like so:

sudo apt-get install -y python3-dev

but when i add it to my config.yml I get the following error from the console:

#!/bin/bash -eo pipefail
sudo apt-get install -y python3-dev
Reading package lists... Done


Building dependency tree       


Reading state information... Done

    Package python3-dev is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package 'python3-dev' has no installation candidate
    Exited with code 100

my config.yml file:

version: 2

jobs:
  test:
    docker:
      - image: circleci/python:3.6.5
        environment:
          ENV: test
    steps:
      - run: |
          sudo rm /etc/apt/sources.list
          echo "deb http://archive.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list
          echo "deb-src http://archive.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list
          echo "Acquire::Check-Valid-Until false;" | sudo tee -a /etc/apt/apt.conf.d/10-nocheckvalid
          echo 'Package: *\nPin: origin "archive.debian.org"\nPin-Priority: 500' | sudo tee -a /etc/apt/preferences.d/10-archive-pin
          sudo apt-get update
      - run:
          name: installation
          command: |
            sudo apt-get install -y python3-dev
      - checkout
      - run:
          name: run_unittests
          command: 'pipenv install --skip-lock && pipenv run run_tests.py'

workflows:
  version: 2
  unittests:
    jobs:
      - test
#2

My advice is to move off Jessie, and any downstream images based upon it:

#3

I tried using the stretched version as well.

Same error.

#4

Did you remove all of this for the later version of Python?

          sudo rm /etc/apt/sources.list
          echo "deb http://archive.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list
          echo "deb-src http://archive.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list
          echo "Acquire::Check-Valid-Until false;" | sudo tee -a /etc/apt/apt.conf.d/10-nocheckvalid
          echo 'Package: *\nPin: origin "archive.debian.org"\nPin-Priority: 500' | sudo tee -a /etc/apt/preferences.d/10-archive-pin

That stuff is a fix to get Jessie images working, and it will break a Stretch image.

#5

I did, see under jobs -> test -> steps -> run in the conf.yml that I copied to the post :confused:

#6

It’s still in there. To be clear, you removed it? :slight_smile:

#7

its still there.

I first ran sudo apt-get update and ran into problems, found the lines you suggested to fix the update and put them in.

The update works, but i now have issues with installing python3-dev

#8

Apologies, perhaps I was not sufficiently clear. You need to remove this for Stretch images.

#9

lol, thanks a lot! this works :slight_smile:

1 Like