4

When I used

pip install ipython

or

pip install "ipython[notebook]"

I get the following error:

Downloading/unpacking ipython
  Downloading ipython-2.3.1-py27-none-any.whl (2.8MB): 2.8MB downloaded
Installing collected packages: ipython
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 671, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 901, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
    os.makedirs(destsubdir)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/IPython'

Storing debug log for failure in /home/username/.pip/pip.log

What does this error mean? How do I fix it?

4

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

  1. Install IPython from the Ubuntu Software Center or from the terminal using the following command:

    sudo apt-get install ipython ipython3
    
  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 ipython 
    

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

  • What is the difference between the IPython from the Ubuntu Software Center and IPython 2.3.1? – Flair Dec 1 '14 at 4:50
  • 2
    The principal milestones of IPython 2.0 are: interactive widgets for the IPython notebook (used by many people as a web-based user interface for numpy, scipy, and sympy), directory navigation in the notebook dashboard, persistent URLs for notebooks, a new modal user interface in the notebook and a security model for notebooks. IPython notebook export to pdf – karel Dec 1 '14 at 5:10
3

First, you should enter as root:

sudo -i

and then run your command

pip install ipython
3

I used this on Ubuntu 14.04.2 LTS.

Run the following command:

Install:

sudo apt-get install ipython3 ipython3-notebook

Startup:

sudo ipython3 notebook
  • 1
    replace sudo ipython3 notebook with ipython3 notebook, sudo is not needed. – auraham Aug 12 '16 at 18:05
0

This is a permission problem. Let's illustrate this by checking the permissions on /usr/local/lib/python2.7:

ls -ld /usr/local/lib/python2.7
>> drwxr-xr-x 4 root root 4096 Aug  1  2014 /usr/local/lib/python2.7

We can see here that this directory belongs to the user root. In order to install ipython into this directory, you're either going to have to make this directory user-writable or run your installation command as root. Running as root is the easiest method:

sudo pip install ipython

Alternatively, you can make this directory and all of its contents writable by your current user:

sudo chown -R `whoami` /usr/local/lib/python2.7

I'm not sure if this directory should be owned by a nonroot user, but this will allow you to install with pip as a nonroot user.

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.