Pip path? jinja2 was not found in your path!

How do you install pip packages? I think I’ve gone through all the flags for pip with zero success

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      services:
      - docker

#language: node_js
#node_js:
#  - "8"
language: python
python:
    - "3.6"

before_install:
# install nsenter which is required for port forwarding
#- sudo -H pip3 install --upgrade --ignore-installed --user --install-option="--prefix=$HELM_INSTALL_DIR" jinja2
#- sudo -H pip3 install --upgrade --ignore-installed --user jinja2
#- pip install jinja2
- pip install --upgrade --ignore-installed --install-option="--prefix=$HELM_INSTALL_DIR" jinja2

script:
  - export PATH=/home/travis/.local/bin:$PATH
  - echo "export PATH=/home/travis/.local/bin:$PATH" >> /home/travis/.bashrc
  - env
  - which jinja2

Just pip install should be fine. Travis CI creates and activates a virtualenv before execution of your steps.

Another question would be is jinja2 shipped with a script now? Never heard of it…

ah you are correct, I was looking for jinja2-cli! My mistake entirely.

I will add that I had to add the --user or the prefix, or use sudo

It is strongly discouraged to use sudo. You’ll mess up your system python installation this way.

So do use --user but not if you specified language: python

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      services:
      - docker

language: python
python:
    - "3.6"

before_install:
- pip install --user jinja2-cli

script:
  - which jinja2

results in:

pip install --user jinja2-cli
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
The command "pip install --user jinja2-cli" failed and exited with 1 during .

however if you use something else like node:

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required

language: node_js
node_js:
  - "8"

before_install:
- pip install --user jinja2-cli

script:
  - which jinja2

so use sudo only if you want to break your system python in this ephemeral system that is about to be deleted, don’t use --user with pip if your language is speciffied as python, but feel free elsewhere.

I’m glad this is perfectly clear :wink: