# Pip path? jinja2 was not found in your path!

**URL:** https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044
**Category:** Python
**Created:** [November 24, 2018, 4:10pm UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044 "2018-11-24T16:10:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![joshuacox](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/joshuacox/32/543_2.png) [@joshuacox](https://travis-ci.community/u/joshuacox)
#### Post date: [November 24, 2018, 4:10pm UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/1 "2018-11-24T16:10:17Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

### Author: ![webknjaz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/webknjaz/32/34_2.png) [@webknjaz](https://travis-ci.community/u/webknjaz)
#### Post date: [November 24, 2018, 9:30pm UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/2 "2018-11-24T21:30:22Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![joshuacox](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/joshuacox/32/543_2.png) [@joshuacox](https://travis-ci.community/u/joshuacox)
#### Post date: [November 24, 2018, 11:18pm UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/3 "2018-11-24T23:18:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![webknjaz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/webknjaz/32/34_2.png) [@webknjaz](https://travis-ci.community/u/webknjaz)
#### Post date: [November 25, 2018, 1:32am UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/4 "2018-11-25T01:32:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![joshuacox](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/joshuacox/32/543_2.png) [@joshuacox](https://travis-ci.community/u/joshuacox)
#### Post date: [November 25, 2018, 2:22am UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/5 "2018-11-25T02:22:10Z")

</div>

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

```auto
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:

```auto
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:

```auto
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 😉

---

<div class="post-metadata">

### Author: ![Helveg](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/helveg/32/3372_2.png) [@Helveg](https://travis-ci.community/u/Helveg)
#### Post date: [October 11, 2020, 6:31am UTC](https://travis-ci.community/t/pip-path-jinja2-was-not-found-in-your-path/1044/6 "2020-10-11T06:31:30Z")

</div>

In case you’re still wondering why:

- Python installations have 2 “site packages”, locations where they install packages. The default one and the user one.
- When you specify the python language Travis sets up what’s known as a `virtual environment`. Since those are isolated environments they have their own site packages but they have just the default one, which is why `--user` will fail. (You’re already specifying an environment by being inside a virtualenv, `--user` is conceptually `n/a` here)
- When you don’t specify a python language you’re installing the packages to the system pythons which do have a user site packages

Never use sudo to pip install though:

- You expose yourself to arbitrary code execution through a variety of package manager attacks
- The installed files might not be readable to your regular user
- You might overwrite packages that your system python relied on and mess up your linux distro

If you don’t know which situation you’re in you could alwys try a user install and if it errors chain it to a normal install:

> pip install … --user || pip install …
