Repository: lucidsushi/gs_pip_install

Issue:
gs_pip_install v0.2.4 installs in incorrect location
* gs_pip_install version: 0.2.4
* Python version: 3.6.8
* Operating System: Linux (Ubuntu)

### Description
when running gs_pip_install, it does not install in correct python system site package. The site package in my virtualenv was `/home/matthewwong/.local/share/virtualenvs/airflow-dag-utilities-W9jupXEt/lib/python3.6/site-packages` but it was installed in `/home/matthewwong/.pyenv/versions/3.6.8/lib/python3.6/site-packages`.

I suspect the reason it does this because `gs-pip-install` uses a different python to run `pip install`.
- gs_pip_install uses: `/home/matthewwong/.pyenv/shims/python`
- current venv uses: `/home/matthewwong/.local/share/virtualenvs/airflow-dag-utilities-W9jupXEt/bin/python`

### What I Did
Use version 0.2.3 instead


Discussion:

Patch:
diff --git a/gs_pip_install/gs_pip_install.py b/gs_pip_install/gs_pip_install.py
index c17a315..fab8ce9 100644
--- a/gs_pip_install/gs_pip_install.py
+++ b/gs_pip_install/gs_pip_install.py
@@ -13,9 +13,7 @@ from google.cloud import storage
 @click.command()
 @click.option('-b', "--bucket_name", help="(str) Name of GCS bucket")
 @click.option(
-    '-r',
-    "--requirement",
-    help="(str) Name of Python package or requirements file",
+    '-r', "--requirement", help="(str) Name of Python package or requirements file",
 )
 @click.option(
     '-d',
@@ -80,10 +78,9 @@ def install_packages(
         if extras.get(package):
             install_path = f"{install_path}{extras[package]}"
 
-        shims_python = f"{os.environ['HOME']}/.pyenv/shims/python"
         if not target_dir:
             install_command = [
-                shims_python,
+                sys.executable,
                 "-m",
                 "pip",
                 "install",
@@ -93,7 +90,7 @@ def install_packages(
             ]
         else:
             install_command = [
-                shims_python,
+                sys.executable,
                 "-m",
                 "pip",
                 "install",
@@ -108,15 +105,15 @@ def install_packages(
             subprocess.check_output(install_command)
         except Exception as e:
             logging.error(f"install failed using: {install_command}")
-            logging.warning(f"{e}\nAttempting pip install with sys.executable\n")
-            install_command[0] = sys.executable
+            logging.warning(f"Attempting pip install with pyenv python:\n {e}")
+            install_command[0] = f"{os.environ['HOME']}/.pyenv/shims/python"
             subprocess.check_output(install_command)
+        except Exception as e:
+            logging.error(f"install failed using: {install_command}")
 
 
 def download_packages(
-    packages_download_dir: str,
-    bucket_name: str,
-    package_list: List[str],
+    packages_download_dir: str, bucket_name: str, package_list: List[str],
 ):
     """Download Python packages from GCS into a local directory.
 
@@ -148,10 +145,10 @@ def download_packages(
 
 def _strip_extras(path: str) -> Tuple[str, Optional[str]]:
     """
-    The function splits a package name into package without extras
-    and extras.
-    Function obtained from PIP Source Code
-    https://github.com/pypa/pip/blob/5bc7b33d41546c218e2ae786b02a7d30c2d1723c/src/pip/_internal/req/constructors.py#L42
+        The function splits a package name into package without extras
+        and extras.
+        Function obtained from PIP Source Code
+        https://github.com/pypa/pip/blob/5bc7b33d41546c218e2ae786b02a7d30c2d1723c/src/pip/_internal/req/constructors.py#L42
     """
     m = re.match(r'^(.+)(\[[^\]]+\])$', path)
     extras = None


Test patch:
diff --git a/tests/test_gs_pip_install.py b/tests/test_gs_pip_install.py
index e58ab71..a03a95f 100644
--- a/tests/test_gs_pip_install.py
+++ b/tests/test_gs_pip_install.py
@@ -4,6 +4,7 @@ import unittest
 import tempfile
 import shutil
 import os
+import sys
 from unittest import mock
 
 from click.testing import CliRunner
@@ -104,7 +105,7 @@ class TestInstall(unittest.TestCase):
             mock_subprocess.call_count == 2
             mock_subprocess.assert_any_call(
                 [
-                    f"{os.environ['HOME']}/.pyenv/shims/python",
+                    sys.executable,
                     "-m",
                     "pip",
                     "install",
@@ -126,7 +127,7 @@ class TestInstall(unittest.TestCase):
             mock_subprocess.call_count == 2
             mock_subprocess.assert_any_call(
                 [
-                    f"{os.environ['HOME']}/.pyenv/shims/python",
+                    sys.executable,
                     "-m",
                     "pip",
                     "install",
@@ -150,7 +151,7 @@ class TestInstall(unittest.TestCase):
         )
         mock_subprocess.assert_called_once_with(
             [
-                f"{os.environ['HOME']}/.pyenv/shims/python",
+                sys.executable,
                 "-m",
                 "pip",
                 "install",