python3 not working in Ubuntu 14.04

My builds require python3 and they worked fine yesterday but are failing today, my guess its caused by the switch to Ubuntu 14.04 but obviously could be something else. My previously working build is build 319 where all was well and then it broke in build 320 when running:

pyenv global 3.5.1

I tried various thing and it appears the problem has something to do with the /opt/circleci/.pyenv setup.

ubuntu@box974:~$ which python3 /opt/circleci/.pyenv/shims/python3

Anybody got any suggestions?

I’m working on getting 3.5.1 working also. Here is what we’re seeing.

I confirmed that this works on 12.04, but not 14.04

Hi,

Can you try specifying the specific version of Python in your circle.yml file again? A.k.a uncomment what you have already?

I’m also trying hard to get Python 3.5.1 running but I seems to always end up with 2.7 when trying to install pylint.

Se configuration of build 46.

Any hints?

Is it not odd to have this? The preinstalled pylint looks lite pylint 3.5 but linked with python 2.7?

$ which pylint
/home/ubuntu/virtualenvs/venv-3.5.1/bin/pylint
$ pylint --version
pylint 1.5.5, 
astroid 1.4.5
Python 2.7.11 (default, Jan 29 2016, 18:11:08) 
[GCC 4.8.4]

Any hint?

I got python 3.5.1 installed by building from sources only took 13 tries, see here :slight_smile: . The instructions I used were from here and my circle.yml file is:

# Circle.yml for testing python3 with Ubuntu 14.04
machine:
  environment:
    SRC_PREFIX_DIR: ${HOME}/src
    INSTALL_PREFIX_DIR: ${HOME}/opt
    PATH: ${INSTALL_PREFIX_DIR}/py-351/bin:${PATH}

test:
  pre:
    # Install python3 from sources
    - mkdir -p ${SRC_PREFIX_DIR}
    - mkdir -p ${INSTALL_PREFIX_DIR}/py-351
    - wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
    - tar -xf Python-3.5.1.tgz -C ${SRC_PREFIX_DIR}
    - cd ${SRC_PREFIX_DIR}/Python-3.5.1/ ; ./configure --prefix=${INSTALL_PREFIX_DIR}/py-351
    - cd ${SRC_PREFIX_DIR}/Python-3.5.1/ ; make
    #- cd ${SRC_PREFIX_DIR}/Python-3.5.1/ ; make test
    - cd ${SRC_PREFIX_DIR}/Python-3.5.1/ ; make install

    #- pyenv global 3.5.1
    - which python
    - python --version
    - which python2
    - python2 --version
    - which python3
    - python3 --version

  override:
    - python3 -c 'print("OK")'

Hopefully circleci will fix it so all you have to do is indicate you want python 3.5.1 installed with something like:

machine
  python:
    version: 3.5.1

FYI: Here is a github repo with a shell script to install python and a circle.yml example

Hi, I’m now looking at the issue. I’ll give you update once I have a better workaround/fix.

@winksaville

It seems the issue is our use of pyenv global to set the python version.

You can read more details in the github issue, but to workaround this, you need to delete .pyenv-version file manually before CircleCI changes python version like this.

machine:
  pre:
    - rm .python-version

  python:
    version: 3.5.1

Here is a working build: https://circleci.com/gh/kimh/trusty-test/329

There are a few options to fix this permanently and I need to think a bit to decide which path we want to go. Please use the workaround until we fix the issue.

Thank you for your patience.

This is a regression introduced in the last image update.

We’ll ship a new build image and fix the issue ASAP. Ubuntu 14.04 Build Image Update 201605-03

We just shipped a new Ubuntu 14.04 image and now the issue should be fixed. Please let us know if you still see the issue.

I’ve verified the latest image works, see build 36. To have all three versions of python available I added “pyenv global 2.7.11 3.5.11”: Here is my circle.yml file:

# Circle.yml for testing python3 with Ubuntu 14.04
machine:
  pre:
    - cat /etc/*release
    - pyenv global 2.7.11 3.5.1

test:
  pre:
    - which python
    - v=$(python --version 2>& 1); if [ "$v" == "Python 2.7.11" ]; then echo "$v OK"; else ! echo "$v ERR"; fi
    - which python2
    - v=$(python2 --version 2>& 1); if [ "$v" == "Python 2.7.11" ]; then echo "$v OK"; else ! echo "$v ERR"; fi
    - which python3
    - v=$(python3 --version 2>& 1); if [ "$v" == "Python 3.5.1" ]; then echo "$v OK"; else ! echo "$v ERR"; fi

  override:
    - python3 -c 'print("OK")'
1 Like