sdevis
sdevis

Reputation: 31

I am trying to install ipython but get permission error

I use command pip3 install ipython but getting these error may I need to install virtualenv ?

Exception:
Traceback (most recent call last):
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/saurabh/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/IPython'

Upvotes: 2

Views: 730

Answers (2)

Tanmay
Tanmay

Reputation: 111

Whenever any permission issues/error are there during installation of any package always add sudo before your installation command. Hence command will be:

sudo pip3 install IPython

Upvotes: 0

Duc Filan
Duc Filan

Reputation: 7157

The error message reveals the problem: You don't have permission to write to the folder since /usr/... is a system folder.

PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/IPython'

You need to use sudo to install globally or just install them using --user option which installs the package only for the current user and not for all:

pip install ipython --user

Or maybe a better option is to use a virtual environment which isolates packages for you.

Upvotes: 2

Related Questions