PermissionError with pip3

52,289

Solution 1

You need to use sudo to install globally or have permissions to write to the folder. Or as @Alasdair commented using a virtualenv is a better option.

Solution 2

just install them using --user option which install the package only for the current user and not for all

pip install xxxxxx --user

Solution 3

use --user at last of your install command, so that the package will be installed only for the current user, not for all.

pip install xxxxxx --user

or

pip3 install xxxxxx --user

Solution 4

pip3 install --user <package_name>

No need to write your username in place of --user.

Share:
52,289
Meghdeep Ray
Author by

Meghdeep Ray

Loved programming ever since I started at the age of 10. Love Python3, passionate about Artificial Intelligence, Machine Learning and Big Data Analytics. Completed my Undergraduate Degree in Computer Science and Engineering from PES University, Bangalore.

Updated on August 08, 2022

Comments

  • Meghdeep Ray
    Meghdeep Ray over 1 year

    This is the error when I try to get anything with pip3 I'm not sure what to do

    Exception:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
        status = self.run(options, args)
      File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
        requirement_set.install(install_options, global_options, root=options.root_path)
      File "/usr/lib/python3/dist-packages/pip/req.py", line 1435, in install
        requirement.install(install_options, global_options, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/pip/req.py", line 671, in install
        self.move_wheel_files(self.source_dir, root=root)
      File "/usr/lib/python3/dist-packages/pip/req.py", line 901, in move_wheel_files
        pycompile=self.pycompile,
      File "/usr/lib/python3/dist-packages/pip/wheel.py", line 206, in move_wheel_files
        clobber(source, lib_dir, True)
      File "/usr/lib/python3/dist-packages/pip/wheel.py", line 193, in clobber
        os.makedirs(destsubdir)
      File "/usr/lib/python3.4/os.py", line 237, in makedirs
        mkdir(name, mode)
    PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-                        packages/Django-1.7.2.dist-info'
    
    Storing debug log for failure in /home/omega/.pip/pip.log