question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'scripts' lose executable priveleges from pip install

See original GitHub issue

Environment

  • pip version: 20.0.2
  • Python version: 2.7.5
  • OS: RHEL 7.7/SELinux
  • setuptools version: 44.0.0

Description

pip-installing a package that contains a setup.py that specifies the scripts argument causes the resulting file to lost its executable permission(s).

Reproducible example located at:

https://github.com/bsolomon1124/pip-scripts-hostbits-mvce

Expected behavior

The source repository bin/my_script is executable (via chmox a+rx bin/my_script). It loses this permission when installed by pip. It should maintain its executable permission for all users.

How to Reproduce

$ pip install git+ssh://git@github.com/bsolomon1124/pip-scripts-hostbits-mvce.git
$ ls -la /usr/bin/my_script  # or ls -la /usr/local/bin/my_script

Output

$ ls -la /usr/bin/my_script
-rw-r--r--. 1 root root 39 Jan 28 19:10 /usr/bin/my_script

Alternate example

$ yum install gcc python-devel
$ pip install uwsgi
$ ls -la /usr/bin/uwsgi
-rw-r--r--. 1 root root 1369984 Jan 28 18:53 /usr/bin/uwsgi
$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chrahuntcommented, Jan 29, 2020

Is /tmp mounted noexec? It may be related to #6364.

1reaction
bsolomon1124commented, Jan 29, 2020

Related helpful discussion for others with this issue: https://github.com/pypa/pip/issues/4462.

In this case,

mkdir pip-tmp
TMPDIR='./pip-tmp' pip install package_name && rmdir pip-tmp

works like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my pip-installed Python script not executable for ...
/usr/bin/vcard is only executable by root. What gives? On my up-to-date Arch Linux machine it works as expected: $ sudo pip2 install vcard ......
Read more >
How to specify execute permissions of scripts using Python ...
The package includes executable scripts, which use the scripts parameter of the setup() function. I'm installing like this: sudo python setup.py ...
Read more >
How come a python file is executable even though its ...
Run the script by its shebang does require the executable bit set, because it would start a new process, the Python interpreter.
Read more >
Install Python on a locked down PC without local admin
Learn how you can install Python on your PC even if you don't have local admin or if you are not able to...
Read more >
How to Install Python PIP on Windows, Mac, and Linux
By default, the Python installer places its executables in your AppData directory, so it doesn't need admin permissions. Or you can specify a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found