GitHub user chrish42 opened a pull request:
https://github.com/apache/incubator-beam/pull/962
[BEAM-] Use sys.executable and "-m pip" to ensure we use the
same Python and â¦
The current Python codebase runs subprocesses to call Python and pip. This
is fine when not running in a virtualenv, or in a virtualenv that was activated
through modifying the PATH. But it fails if running in a virtualenv either via
an IDE (I use IntelliJ) or simply when invoking the Python from the virtualenv
directly (which is a supported way of using a virtualenv).
Instead of relying on the PATH to invoke a Python and hope it's the same
python executable as the one currently running, Python provides a
`sys.executable` variable (which gives the full path of the currently running
python) just for that purpose. Using that, the code will work in all the cases
described above.
Also, the recommended way of calling `pip` is now `python -m pip`, which
makes explicit which Python is being used. Switching over to that at the same
time.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/chrish42/incubator-beam use_sys.executable
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-beam/pull/962.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #962
commit 557265b1decd1611d7134ac0d73f0c70da2fe9e3
Author: Christian Hudon
Date: 2016-09-15T19:10:57Z
Use sys.executable and "-m pip" to ensure we use the same Python and pip as
the currently running one.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---