OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pelican-3.6.3.dist-info'

16,994

Although it is possible to install it as a global site-package, I think it is better to look into python virtual environments.

1. use virtualenv:

Install virtualenv using sudo

apt-get install python-virtualenv

then you can create a virtual environment:

virtualenv pelican

and activate it:

. pelican/bin/activate

(note the dot+space at the begining). You can then run

pip install pelican markdown

to install it at this virtual environment. After done working with this you can run

deactivate

to deactivate the environment. When you want to work on your project again, you'll have to activate that environment again.

2. virtualenvwrapper

virtualenvwrapper is a tool for making it easier to manage multiple virtual environments. You can install it by typing

sudo apt-get install virtualenvwrapper

then create a virtual environment using

mkvirtualenv pelican

and install your packages

pip install pelican markdown

You can then deactivate this environment with

deactivate

When you want to work with this environment again run:

workon pelican

Installation as a global site-package

If you insist to install it as a global site-package run

sudo pip install pelican markdown
Share:
16,994
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I run pip install pelican markdown

    I got this error message:

    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 1436, in install
        requirement.install(install_options, global_options, *args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
        self.move_wheel_files(self.source_dir, root=root)
      File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, 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/pelican-3.6.3.dist-info'
    
    Storing debug log for failure in /home/begueradj/.pip/pip.log
    

    How to fix this?

  • Admin
    Admin over 8 years
    Thank you, but the main issue I asked about is not addressed by your answer. I upvoted for the other alternatives you gave me though.
  • Admin
    Admin over 8 years
    @Begueradj, thanks for the upvote. Since you want to install it as a global site-package, use the last option ("Installation as a global site-package").
  • Admin
    Admin over 8 years
    Yes, I will try your solution in the coming hours. If one of them works I will accept your answer. Thank you