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 .
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.
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: