Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

By: @saurabhshri


Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.


  1. Download pip from an online repository : wget
  2. Install the downloaded package into a local directory : python --user This will install pip to your local directory (.local/bin).
  3. Now you may navigate to this directory (cd .local/bin) and then use pip or better set your $PATH variable this directory to use pip anywhere : PATH=$PATH:~/.local/bin followed by source ~/.bashrc to apply the changes.

And that's it. You may now install all python modules you require via pip in a local directory without root.

Gist of Gist

wget && python --user
cd .local/bin
./pip install <package_name> --user
Copy link

DeepaliKushwaha commented Jul 15, 2022

I'm getting an error when i run wget
ERROR: no certificate subject alternative name matches requested host name ‘’.
To connect to insecurely, use `--no-check-certificate'.

So I changed it to wget --no-check-certificate It worked.

But then python --user again gave error.

I'm unable to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment