im trying to install autopep8 using pip install. I am getting a permission denied when its trying to install pycodestyle
Collecting autopep8
Using cached autopep8-1.3.2-py2.py3-none-any.whl
Collecting pycodestyle>=2.3 (from autopep8)
Using cached pycodestyle-2.3.1-py2.py3-none-any.whl
Installing collected packages: pycodestyle, autopep8
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 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pycodestyle.py'
You don't have a problem with python but with your user's permissions on the linux box.
Try sudo pip install package instead of just pip install package.
Related
When I try to upgrade my pip, using the command prompt, to the newest version I get the errors in the picture below. Is there an administrative step I have overlooked?
An image of my command prompt is located at this link (I don't have a reputation of 10 which is required to include images).
C:\Users\hassa>python -m pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 455kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\shutil.py", line 538, in move
os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\anaconda3\\lib\\site-packages\\pip' -> 'C:\\Users\\hassa\\AppData\\Local\\Temp\\pip-uazegy0h-uninstall\\program files\\anaconda3\\lib\\site-packages\\pip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Anaconda3\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "C:\Program Files\Anaconda3\lib\site-packages\pip\req\req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files\Anaconda3\lib\site-packages\pip\req\req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files\Anaconda3\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
renames(path, new_path)
File "C:\Program Files\Anaconda3\lib\site-packages\pip\utils\__init__.py", line 267, in renames
shutil.move(old, new)
File "C:\Program Files\Anaconda3\lib\shutil.py", line 550, in move
rmtree(src)
File "C:\Program Files\Anaconda3\lib\shutil.py", line 488, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files\Anaconda3\lib\shutil.py", line 383, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Program Files\Anaconda3\lib\shutil.py", line 381, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\anaconda3\\lib\\site-packages\\pip\\basecommand.py'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\hassa>
____________________________________
It appears you are using Anaconda. You should use the conda command to update pip in that case:
conda update pip
If that doesn't work, try opening your cmd.exe as Administrator and try again.
Here's the output of my shell:
Hannahs-MacBook-Pro:Downloads hannah$ pip install virtualenv
Collecting virtualenv
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |████████████████████████████████| 1.8MB 195kB/s
Installing collected packages: virtualenv
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 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'
You need root access to install (or update) virtualenv, try:
sudo pip install virtualenv
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'
You don't have permission to install, use sudo pip install virtualenv.
Whenever you get this error IOError: [Errno 13] Permission denied:, it means that you need to use sudo.
I am using python 3.5.3, and now I want to install pandas and numpy but not able to, following is the error in cmd, anyone can help me?
C:\Program Files\Python35\Scripts>py -3.5 -m pip install pandas
Collecting pandas
Using cached pandas-0.20.1-cp35-cp35m-win_amd64.whl
Collecting python-dateutil>=2 (from pandas)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting numpy>=1.7.0 (from pandas)
Using cached numpy-1.12.1-cp35-none-win_amd64.whl
Collecting pytz>=2011k (from pandas)
Using cached pytz-2017.2-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2->pandas)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, numpy, pytz, pandas
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Program Files\Python35\lib\site-packages\pip\wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "C:\Program Files\Python35\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Python35\\Lib\\site-packages\\six.py'
As others have pointed out you need to run the command with admin privileges.
How to do this varies by windows version, but on Windows 8 and 10 you can just press Windows+X (or just right-clicking the Start button). On the menu, choose “Command Prompt (Admin).”
The command line you're using does not have access to C:\\Program Files\\Python35\\Lib\\site-packages\\six.py.
Run the command in a command line with administrative priveleges.
Run command line in admin mode and then :
pip instal pandas
I want to install praw with pip install praw command but before I want to install pip, couldn't manage to do it.
Collecting pip Using cached pip-9.0.1-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/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/basecommand.py",
line 215, in main
status = self.run(options, args) File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/commands/install.py",
line 342, in run
prefix=options.prefix_path, File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/req/req_set.py",
line 784, in install
**kwargs File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/req/req_install.py",
line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File
"/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/req/req_install.py",
line 1064, in move_wheel_files
isolated=self.isolated, File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/wheel.py",
line 345, in move_wheel_files
clobber(source, lib_dir, True) File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/pip.zip/pip/wheel.py",
line 316, in clobber
ensure_dir(destdir) File "/var/folders/vv/v2drs0vd7jz6wlywr02cr3480000gn/T/tmpDdYH0a/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'
Seems like you don't have permission to the Python folder.
Try
sudo chown -R $USER /Library/Python/2.7/site-packages/pip
It says it can't write to '/Library/Python/2.7/site-packages/pip'. Adapt read-write rights on that folder or try sudo pip install praw
Try using virtualenv or --user option for pip command
`pip install praw --user`
I'm trying to install a virtualenv package -
First, I directly try to install but get permission denied error
Second, the same user(has sudo access) with sudo command tells pip2.7 is not a command.
why is it pip2.7 is visible for the user but not using the sudo command?
[lduser#q-dev-5461-4f3c-9d98-7af28dfc3ec6 bin]$ pip2.7 install virtualenv
Collecting virtualenv
Using cached virtualenv-14.0.6-py2.py3-none-any.whl
Installing collected packages: virtualenv
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 731, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 841, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1040, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 343, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 321, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/local/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/virtualenv.pyc'
[duser#q-dev-5461-4f3c-9d98-7af28dfc3ec6 bin]$ sudo pip2.7 install virtualenv
sudo: pip2.7: command not found