I'm getting some exceptions while trying to install praw using pip. Following is the error messages I get:
MacBook:usr name_r$ pip install praw
Downloading/unpacking praw
Downloading praw-2.1.20-py2.py3-none-any.whl (74kB): 74kB downloaded
Downloading/unpacking requests>=2.3.0 (from praw)
Downloading requests-2.5.1-py2.py3-none-any.whl (464kB): 464kB downloaded
Downloading/unpacking update-checker>=0.11 (from praw)
Downloading update_checker-0.11-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /Library/Python/2.7/site-packages/six-1.8.0-py2.7.egg (from praw)
Installing collected packages: praw, requests, update-checker
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/praw'
Storing debug log for failure in /var/folders/qz/q26gj5zx62d3d206hdnn_rwm0000gn/T/tmp_wCuvN
Could someone tell me whats going on here? Do I need to update Python somehow or is something wrong with pip?
How can I get it to install praw properly?
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/praw'
It seems you are running on Mac, you need to change to the root user for installation, otherwise you don't have the write privilege for the folder. "sudo -s" will change to root.
Related
I'm trying to install the requests module on Mac following this tutorial http://docs.python-requests.org/en/master/user/install/
when I do the command pip install I get the following error:
Processing /Users/thomasmakkink/Documents/Acsone/Obfg/requests
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.18.4)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests==2.18.4)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests==2.18.4)
Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests==2.18.4)
Using cached certifi-2018.1.18-py2.py3-none-any.whl
Installing collected packages: chardet, idna, urllib3, certifi, requests
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/chardet-3.0.4.dist-info'
How can I solve this?
sudo pip install requests
works well
I can't install packages in PyCharm
throws this error
Collecting oktaauth
Downloading oktaauth-0.2-py2-none-any.whl
Requirement already satisfied: requests>=2.8 in /Library/Python/2.7/site-packages (from oktaauth)
Collecting argparse (from oktaauth)
Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting beautifulsoup4>=4.4 (from oktaauth)
Downloading beautifulsoup4-4.6.0-py2-none-any.whl (86kB)
Installing collected packages: argparse, beautifulsoup4, oktaauth
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/locations.py", line 153, in distutils_scheme
i.finalize_options()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 346, in finalize_options
self.create_home_path()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 565, in create_home_path
os.makedirs(path, 0700)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Users/karanj/Library/Python/2.7'
I found soltutions by asking me to try installing it by being root or trying sudo with the command and try installing the package. But I don't want to install the package by appending sudo to it.
Any solutions?
When you start a python project, always use Python virtual environemnt. Avoid using use sudo pip install.
You can either
create Pycharm virtual environment, or
Create your typical virtualenv, then add external virtualenv to Pycharm, or
Use pycharm with conda, another virtual environment.
Try with sudo
If there is a requirement file e.g. sudo pip install -r requirements.txt
Or for standalone package
sudo pip install <package-name>
I'm trying to install pip using this command:
python get-pip.py
The error it's spitting out is this - can you help? (I'm running macOS 10.12.1)
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Collecting wheel
Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/req/req_set.py", line 742, in install
**kwargs
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/var/folders/by/db2rdr7n1753qbfz0rlgk7hw0000gn/T/tmptA1AVr/pip.zip/pip/utils/init.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
To install pip you on Mac OSX you can try :
sudo easy_install pip
The "sudo" keyword is what will grant you root privileges.
You need root access. Activate your root account and try from there.
I want to install simpleaudio but can't upgrade or install anything with pip, here's what it gives me:
Downloading/unpacking pip from https://pypi.python.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799b d798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl#md5=0570520434c5b600d89ec95393b2650b
Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.5.6
Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Can't roll back pip; was not uninstalled
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 295, 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 214, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 204, in clobber
os.makedirs(destdir)
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/pip-8.1.2.dist-info'
Storing debug log for failure in /home/pi/.pip/pip.log
I'm using Rasbian with NOOBS if that help figuring this out. I've just started studying programming so I have no clue what I need to do since using the guides results to above, so please explain this to an idiot.
pip fails to access some system paths and shows clearly that the user used to run pip does not have enough privileges to access them.
To solve this, try to run these commands as root using sudo:
sudo pip <options>
Otherwise, if you don't have sudo installed (this is almost impossible) or if you're just curious and know the root's password, simply log in as root and execute your commands without sudo:
su # or su root
# type the root's password
pip <options>
If you use this option, don't forget to log out after you've installed everything!
abcdefg#HAL9000:~$ pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Downloading beautifulsoup4-4.1.3.tar.gz (131Kb): 131Kb downloaded
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 955, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1072, in unpack_url
return unpack_http_url(link, location, self.download_cache, only_download)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 447, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 468, in unpack_file
untar_file(filename, location)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 393, in untar_file
os.makedirs(location)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/abcdefg/build/beautifulsoup4'
Storing complete log in /home/abcdefg/.pip/pip.log
Since I was getting permission denied, I tried running it with sudo,
abcdefg#HAL9000:~$ sudo pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement beautifulsoup4
No distributions at all found for beautifulsoup4
Storing complete log in /root/.pip/pip.log
I know I can install it without pip as well, but I encountered this problem while installing requests as well, so I want to know the solution
Thanks!