-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts installed with wrong shebang under subprocess #845
Comments
does
Give same, or different results? And same question with
? |
Hmm, there was code in pip / distlib to perhaps deal with this, but it got commented out a year ago- |
In both cases, invoking pip directly results in a proper shebang:
Also, invoking with an empty env works:
|
According to the commit, that workaround was commented with inclusion of distlib 0.2.0 released in pip 6.0. |
That commit references pip 2031. |
Also, I've installed Python from the python.org Mac installer, not through homebrew or other methods. |
The code was removed from distlib in this commit, which provides little rationale for the change. |
I guess it's to be "expected" given that your initial Also could be similar / same issue as was reported in #620 @jaraco it could be worth modifying a |
I traced that venv detection code back to this commit, which unfortunately doesn't elucidate the origins of the idea. |
I've found this explanation. |
My inclination was similar to what Ronald suggested here. |
@vsajip could you give any advice? |
Some thoughts:
|
A(nother) simple demonstration of the problem, which Homebrew rediscovered in Homebrew/homebrew-core#8129:
|
Fixes #104. This is caused by a Python bug that's specific to OS X. Refer to pypa/virtualenv#845 for more information.
I was just bitten by this exact bug. It's quite a severe bug in my opinion, mostly because it's so extremely confusing and hard to figure out when it hits. |
I've been hit by what I think is a more severe manifestation of this issue. I've started using xonsh as my daily shell. But when I try to use virtualenv under xonsh, it's unusable:
All installed scripts seem to be getting the system prefix and not the virtualenv prefix. This probably stems from the fact that xonsh is running under Python 3.7 (system prefix) and so has this in the env:
If I instead launch zsh and run the same commands or if I first invoke Should xonsh be clearing that environment variable when it starts up? |
There is a possible bugfix at python/cpython#9516 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions. |
I still see this same behavior on Mojave with Python 3.7.6 (installed via Homebrew). |
Can you check with the rewrite branch? |
@gaborbernat Attempting to build the
which looks unrelated to this issue. |
You should use pip to do the build - |
The error you're getting is setuptools way of saying I don't support the new standard way of building python libraries (PEP-517/518). It's a setuptools bug at best, but as @pfmoore pointed you should use pip to build a wheel, or even better to point it to the virtualenv folder to install it (it will automatically build a wheel and install it in one go). |
Testcase:
This fails under python3+virtualenv 16.7.9, and passes under python3+virtualenv-16.7.10.dev11+gfbdd782 (ie, the |
Fixed in the rewrite as per above. |
On Python 3.5.1 but not on 2.7.10, when I invoke pip through a subprocess in a virtualenv, the scripts are created with the wrong shebang and thus fail to run:
One would expect the py.test script to have a shebang with 'env' in it.
Using pyvenv instead is not subject to the issue. Removing the
__PYVENV_LAUNCHER__
environment variable before launching the subprocess works around the issue, as reported here. The issue was observed with 13.1.2 and 14.0.0.Is this behavior expected? If so, is removing the environment variable the appropriate thing for a parent process to do to work around the issue?
The text was updated successfully, but these errors were encountered: