MAC version not working in python

when i checking if my code works on MAC In travis,i am getting error like
“Unable to download 3.4 archieve. This version may not exist.Please try different version”.This happens for 3.3,3.4,3.5,3.6,2.7 versions in python.What might be the reason

2 Likes

Yeah, i am also having the same issue… Guys please help!

It’s not officially supported, but you can hack it by specifying generic lang + installing python yourself

@webknjaz Is there any way to configure different versions for different OS in the .travis.yml file?

Most likely you’ll have to use jobs.include. Depending on your requirements in might be possible to make it work with matrix expansion. But in general, I’d just list all job specs there

Here’s a few examples of before_install for macOS dependent on PYTHON_VERSION env var being set

  env: &env_osx_base
    PYTHON_VERSION: &py36 3.6.6
  before_install: &install-from-pyenv
  - brew update
  - brew install pyenv || brew upgrade pyenv
  - &ensure_pyenv_preloaded |
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
  - &install_python pyenv install --skip-existing --keep --verbose "$PYTHON_VERSION"
  - &switch_python pyenv shell "$PYTHON_VERSION"
  - &python_version python --version
  before_install: &install-from-python_org
  - export PYTHON_VERSION_LONG=$(git ls-remote --tags git://github.com/python/cpython.git "${PYTHON_VERSION}*" "v${PYTHON_VERSION}*" | grep -v '\^{}$' | awk '{print$2}' | sed 's#^refs/tags/##;s#^v##' | grep -v '[abcepr]' | tail -n1)
  - export PYTHON_VERSION_SHORT=$(echo ${PYTHON_VERSION_LONG} | awk -F. '{print$1"."$2}')
  - echo "Selected version vars are:"
  - echo "PYTHON_VERSION=${PYTHON_VERSION}"
  - echo "PYTHON_VERSION_SHORT=${PYTHON_VERSION_SHORT}"
  - echo "PYTHON_VERSION_LONG=${PYTHON_VERSION_LONG}"
  - export PYTHON_INSTALL_PATH="/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION_SHORT}"
  - export PYTHON_INSTALL_EXE="${PYTHON_INSTALL_PATH}/bin/python${PYTHON_VERSION_SHORT}"
  - export PATH="${PYTHON_INSTALL_PATH}/bin:${PATH}"
  - export PYTHON_VENV_PATH="${HOME}/virtualenv/python${PYTHON_VERSION_SHORT}"
  - export PYTHON_INSTALLER_PATH="${PYTHON_INSTALLER_DIR_PATH}/python-${PYTHON_VERSION_LONG}.pkg"
  - env
  - curl -Lo "${PYTHON_INSTALLER_PATH}" -C - "https://www.python.org/ftp/python/${PYTHON_VERSION_LONG}/python-${PYTHON_VERSION_LONG}-macosx10.6.pkg" && sudo installer -pkg "${PYTHON_INSTALLER_PATH}" -target /
  - ls "${PYTHON_INSTALL_PATH}/bin"
  - export VENV_CMD=$(command -v virtualenv 2>/dev/null || command -v pyvenv 2>/dev/null || echo "${PYTHON_INSTALL_EXE} -m venv")
  - |
    if [[ "${VENV_CMD}" =~ virtualenv$ ]]
    then
        export VENV_CMD="${VENV_CMD} -p '${PYTHON_INSTALL_EXE}'"
    fi
  - echo "${VENV_CMD}"
  - ${VENV_CMD} "${PYTHON_VENV_PATH}"
  - . "${PYTHON_VENV_PATH}/bin/activate"
  - curl https://bootstrap.pypa.io/get-pip.py | python
  - *python_version
  - pip --version