Permission denied when trying to run pip install ipython

Solution 1:

You can have both the default version of IPython from the default Ubuntu repositories and IPython 2.3.1 installed at the same time.

  1. Install IPython from the default Ubuntu repositories using the following command:

    sudo apt-get install ipython ipython3 # ipython is available in 18.04 and earlier
    
  2. Install IPython 2.3.1 in a virtual environment. virtualenv allows you to create a sandboxed and isolated environment where Python packages can be installed without interfering with other packages on the same machine. Install Python virtual environment creator (virtualenv):

    sudo apt-get install python-virtualenv virtualenv 
    

    Set up a virtual environment for Python (Information about virtualenv basic usage), activate your Python virtual environment from the terminal, and then install the current version of IPython using pip install.

    pip install --user ipython 
    

This is working on my Ubuntu 14.04 using IPython from the default Ubuntu repositories and IPython 2.3.0 installed inside a Python virtual environment (virtualenv).

Solution 2:

First, you should enter as root:

sudo -i

and then run your command

pip install ipython