Installing pywin32 - win32api.pyd permission denied - python

I need to use win32api for rpy2. So I went to http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32 and tried to install it with pip. However, I have got the errors below. How can I overcome this permission denied problem?
C:\Anaconda\Scripts\pip-script.py run on 07/09/15 16:48:30
Unpacking c:\users\myname\downloads\pywin32-219-cp34-none-win_amd64.whl
Installing collected packages: pywin32
Found existing installation: pywin32 218.4
Uninstalling pywin32:
Removing file or directory c:\anaconda\lib\site-packages\pywin32-218.4-py2.7.egg-info
Successfully uninstalled pywin32
Rolling back uninstall of pywin32
Replacing c:\anaconda\lib\site-packages\pywin32-218.4-py2.7.egg-info
Cleaning up...
Exception:
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\pip\basecommand.py", line 134, in main
status = self.run(options, args)
File "C:\Anaconda\lib\site-packages\pip\commands\install.py", line 241, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "C:\Anaconda\lib\site-packages\pip\req.py", line 1298, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "C:\Anaconda\lib\site-packages\pip\req.py", line 595, in install
self.move_wheel_files(self.source_dir)
File "C:\Anaconda\lib\site-packages\pip\req.py", line 815, in move_wheel_files
move_wheel_files(self.name, self.req, wheeldir, user=self.use_user_site, home=self.target_dir)
File "C:\Anaconda\lib\site-packages\pip\wheel.py", line 172, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Anaconda\lib\site-packages\pip\wheel.py", line 166, in clobber
shutil.move(srcfile, destfile)
File "C:\Anaconda\lib\shutil.py", line 301, in move
copy2(src, real_dst)
File "C:\Anaconda\lib\shutil.py", line 130, in copy2
copyfile(src, dst)
File "C:\Anaconda\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'C:\\Anaconda\\Lib\\site-packages\\win32\\win32api.pyd'

If it's only a "permission denied" situation, try adding sudo before pip (Note: must be # owner/administrator level)

Related

install/uninstall issue with pywin32

I'm trying simple uninstall/install for this package and getting following error followed by successful uninstallation.
python -m pip uninstall pywin32
...
Successfully uninstalled pywin32-227
...
PermissionError: [WinError 5] Access is denied: 'c:\\python36\\lib\\site-packages\\~0win32_system32\\pythoncom36.dll'
I tried following things:
Run the uninstallation as admin
moved my pip version to 20.0.2 as latest version 21.0.1 was giving same issue
Full traceback below:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Python36\lib\site-packages\pip\_internal\commands\uninstall.py", line 82, in run
uninstall_pathset.commit()
File "C:\Python36\lib\site-packages\pip\_internal\req\req_uninstall.py", line 450, in commit
self._moved_paths.commit()
File "C:\Python36\lib\site-packages\pip\_internal\req\req_uninstall.py", line 290, in commit
save_dir.cleanup()
File "C:\Python36\lib\site-packages\pip\_internal\utils\temp_dir.py", line 175, in cleanup
rmtree(self._path)
File "C:\Python36\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "C:\Python36\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
raise attempt.get()
File "C:\Python36\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "C:\Python36\lib\site-packages\pip\_vendor\six.py", line 703, in reraise
raise value
File "C:\Python36\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "C:\Python36\lib\site-packages\pip\_internal\utils\misc.py", line 136, in rmtree
onerror=rmtree_errorhandler)
File "C:\Python36\lib\shutil.py", line 500, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Python36\lib\shutil.py", line 395, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python36\lib\shutil.py", line 393, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'c:\\python36\\lib\\site-
packages\\~1win32_system32\\pythoncom36.dll'
I met the same problem on my Windows machine.
Try this
pip install --user pywin32
Plus, to upgrade pip
python -m pip install -U pip --user

Setup django/python with Jenkins

I currently configure Jenkins for my python/django application (i'm using python 3.5)
During the setup I open a Virtualenv and I activate it.
virtualenv -q wecover_platform .
./wecover_platform/bin/activate
Then i install all my requirements from my file requirement.txt
pip install -r $WORKSPACE/requirements.txt
I can't pass this step i always have a permission denied issue.
Installing collected packages: asn1crypto, pycparser, cffi, idna, cryptography, pyOpenSSL, olefile, pillow, reportlab, selenium, django-jenkins
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/dist-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python3.5/dist-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/asn1crypto'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
If somebody could help me I would really appreciate it!

Can't use pip on macbook

I got this when using pip install.
> pip install cognitive_face
Collecting cognitive_face
Using cached cognitive_face-1.2.5.tar.gz
Collecting requests (from cognitive_face)
Using cached requests-2.13.0-py2.py3-none-any.whl
Installing collected packages: requests, cognitive-face
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/requests'
I can find file "python3" and "python3.6" in my /usr/local/bin and folder "python3" in/usr/local/Cellar.
Also my emacs25 can't do run-python and showing:
Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python3.6" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list. Native completions have been disabled locally.
OS Version: 10.12.3
It's a permission issue. Use sudo
sudo pip install cognitive_face
You need admin rights. Use sudo pip ….

OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg'

I am trying to install and uninstall a package.I have written a setup.py script.While installing the script works fine and the package installs.But while uninstalling package uninstalls but throw some errors.I am using pip uninstall package_name for uninstalling.Here is the traceback
Uninstalling pyduino-0.0.0:
/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled pyduino-0.0.0
The directory '/home/billy/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 221, in main
return command.main(cmd_args)
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 252, in main
pip_version_check(session)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/outdated.py", line 102, in pip_version_check
installed_version = get_installed_version("pip")
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 848, in get_installed_version
working_set = pkg_resources.WorkingSet()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 619, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 675, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1942, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
return self.egg_info and self._has(self._fn(self.egg_info, name))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1824, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1704, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1644, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg'
Meanwhile package uninstalls.When i tried the command pip freeze package does not show up.So,why does the above errors show up?Thanks in advance for helping...
I found the solution.I didn't upgrade pip after installing.Later,I upgraded and works perfectly..

What is the error I am facing when I am installing Django via PIP in a virtualenv?

On my OSX 10.10.2, in a virtualenv, I tried to install Django via pip using the command:
pip install django
And this the responds I got:
Collecting django
Downloading Django-1.7.7-py2.py3-none-any.whl (7.4MB)
100% |################################| 7.4MB 58kB/s
Installing collected packages: django
Exception:
Traceback (most recent call last):
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/commands/install.py", line 347, in run
root=options.root_path,
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_set.py", line 549, in install
**kwargs
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_install.py", line 754, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_install.py", line 963, in move_wheel_files
isolated=self.isolated,
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/wheel.py", line 266, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/wheel.py", line 212, in clobber
shutil.copyfile(srcfile, destfile)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/shutil.py", line 109, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/Users/qmbp/.virtualenvs/demo/bin/django-admin.py'
I guess the issue is caused as I did not prefix sudo to the command. But I read that it was a good idea to use sudo in OSX. And that is why virtualenv is encouraged as sudo is not needed inside it.Here is a screenshot of my files as I could not find the "env" in the bin folder.
Looks like you forgot to activate your venv.
Try:
source path_to_your_venv/bin/activate
pip install django

Categories

Resources