Please activate Python 3 by default for non Python build

Python 3.6 is the default Python when language: python.
But when not language: python, Python 3 can not be used by default.

There is pip (/usr/bin/pip), but not pip3.

We can use pyenv global 3.7.1 to activate Python 3.7.1 and we can use pip3.

Please do it by default, or please document it in xenial environment at least.
Python 2 will be EOL in 6 months later. pip3 should be recommended for installing Python tools.

See also: https://dev.to/methane/use-pip3-to-install-awscli-44pk

1 Like

What prevents you from using language: python?

1 Like

Without language: python, Travis has whatever Python versions are provided by the distro.
For Xenial, these are 2.7.12 and 3.5.1, for Bionic – 2.7.15 and 3.6.7.

When you pyenv install another version, pyenv makes a completely new installation that is not Travis-provided – as such, you are the one responsible for managing it.


You can use

addons:
  apt:
    packages:
      - python3-pip

to install pip3. But it would belong to the distro-provided python3 – would that really be useful for you?

My goal is navigating people to use Python 3 before Python 2 EOL (2020-01-01).
Currently, about 50% of downloads from PyPI are using Python 2 yet.

Xenial image has 3.6.7 and 3.7.1 even when language is not Python. No need to make new installation. See The Xenial Build Environment - Travis CI

Python 3.5 is bit old. Python 3.6+ is preferred.

https://travis-ci.com/methane/travis-test/builds/116895160

This is an example build to use Python 3 for installing awscli.

Then I fail to see what you want. You can already do all you need.
Do you want 3.7.1 to be the default python/python3 or something?


Documentation-wise, you can submit improvements using the “Improve this page on Github” links on top of doc pages.

That said, I would wholeheartedly support the latter. Available Python versions and how to use them (export PATH="/opt/python/3.7.1/bin:$PATH"? Would never guess that. Do I need to do the same for all the other versions, or just some of them?) are completely undocumented, see https://travis-ci.community/t/document-supported-pypy-versions .

Sorry, but how does that affect your choice of the language value?

My goal is navigate people to use Python 3. I never said “I want to use Python 3”. I use Python 3 always.

That’s what I want. I need a recommended and documented way to use Python 3 on non Python build.

Currently, it’s hard to say “use Python 3 to install awscli” to Travis users.

Then you know what to do.The ways are already there, you only need to document them. If Travis staff has any opinions on what is and isn’t supported, you can sort them out in the process of discussing a PR.

For example because I use language: cpp.

3 Likes

Dude, thanks for this! Really helped me refactor some of my steps to be easier