Installing wheel with different users
See original GitHub issueWhen attempting to install a wheel pip install package.whl
with user user2, when the package had previously been installed with user1, I am seeing a OSError: [Errno 1] Operation not permitted: 'filname'
.
This is on Ubuntu 14.10, user1 and user2 are both in group group, and the file which fails has permissions -rw-rw-r--
, owned by user1 and group, so I would expect this to not fail.
This appears to be caused by shutil.copy2
in clobber()
in wheel.py. Specifically, I am seeing the following behaviour (file is owned by user2 and group, running python as user1).
os.utime("file", None) -> Succeeds
os.utime("file", (1415962103.9824536, 1415962103.9384534)) -> Fails
Exception:
Traceback (most recent call last):
File "/home/user2/env/local/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/user2/env/local/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/home/user2/env/local/lib/python2.7/site-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/home/user2/env/local/lib/python2.7/site-packages/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/home/user2/env/local/lib/python2.7/site-packages/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/home/user2/env/local/lib/python2.7/site-packages/pip/wheel.py", line 141, in move_wheel_files
if not scheme:
File "/home/user2/env/local/lib/python2.7/site-packages/pip/wheel.py", line 210, in clobber
shutil.copy2(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/usr/lib/python2.7/shutil.py", line 98, in copystat
os.utime(dst, (st.st_atime, st.st_mtime))
OSError: [Errno 1] Operation not permitted: '/home/user2/env/lib/python2.7/site-packages/package/extensions.py'
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:25 (12 by maintainers)
Top Results From Across the Web
How to install, download and build Python wheels - ActiveState
How to Download Wheels. Most packages provide multiple wheels – one for each version of Python and operating system the author supports. If...
Read more >Is it possible to embed a wheel inside another Python wheel
I want users of my package to just pip install my-package and have openbabel installed as well. If they use Python 3.7 on...
Read more >User Guide — wheel 0.38.4 documentation
To build a wheel for your project: python -m pip install build python -m build --wheel. This will build any C extensions in...
Read more >Wheel group in permissions for an app ins… - Apple Community
Download and Install are combined into one operation. macOS create a group permission entry for the app with the Name 'wheel'; Privilege 'Read ......
Read more >What Are Python Wheels and Why Should You Care?
This metadata helps with building and installing the package, but user's don't ... Another example of the compatibility check used for wheel installation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I do not think pip should be trying to set
atime
andmtime
to arbitrary values when installing wheels, at least not when file owners do not match, as it would seem that this is something UNIX (or Linux at least) expressly forbids when operating on files owned by someone other than the current user (a common scenario in shared virtualenv environments.)Setting atime/mtime to current time of files you do not own is allowed (as long as you have write permission on the containing dir)
Setting atime/mtime to an arbitrary value (here taken from file_1) is not allowed (more or less permissive permissions have no effect)
I agree, I’d say this isn’t supported usage. We expect the user to have permission to install files in the target directory, this is just a manifestation of that.