0

18.04.2 pip install script as sudo was executed per instructions:

wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
rm get-pip.py

and an error (in bold below) was observed however the final pip --version seems to work correctly.

Is there any reason to be concerned regarding the error? If so, what corrective action is needed?

user@nanite:/$ sudo python3 get-pip.py WARNING: The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. WARNING: The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting pip Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB) |████████████████████████████████| 1.4MB 368kB/s Collecting setuptools Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB) |████████████████████████████████| 583kB 11.3MB/s Collecting wheel Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl

ERROR: launchpadlib 1.10.6 requires test resources, which is not installed.

Installing collected packages: pip, setuptools, wheel Successfully installed pip-19.1.1 setuptools-41.0.1 wheel-0.33.4 user@nanite:/$ pip --version pip 19.1.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

2

You are installing pip with sudo but its using your user's home folder's python staging area. This can cause issues later on where paths added by the sudo'd process are not writable by non-sudo'd processes.

sudo -H ... will avoid those errors.

     -H, --set-home
                 Request that the security policy set the HOME environment variable to the home directory specified by the
                 target user's password database entry.  Depending on the policy, this may be the default behavior.

Would it not be preferable to install pip3 via apt?

sudo apt install python3-pip -y && sudo -H pip3 install --upgrade pip

This way any dependencies are met in accordance with the 18.04.2 LTS release.

| improve this answer | |
  • Excellent post: the root cause is concisely summarized in the first sentence and the questions are addressed. Please clarify why there is ']' character in the instruction and why it is preferable to install pip3 via apt? I am a little surprised that the prescribed script does not meet dependencies – gatorback Jun 29 '19 at 11:02
  • Sorry the ] character was a holdover from a multiple-line block and was used to indicate a prompt you type things at. Regarding installing via apt it is less likely to have unresolved dependency issues. Using what is effectively a 3rd party (to canonical) script relies on that group knowing exactly how your system is configured... which does not seem to have worked out in the case of get-pip.py. – SHawarden Jun 30 '19 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.