diff --git a/README.md b/README.md
index 13e2baa..b3654f3 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,11 @@ To specify an alternative profile that has been defined in `~/.aws/credentials`
 lambda-uploader --profile=alternative-profile
 ```
 
+To specify an alternative, prexisting virtualenv use the `--virtualenv` parameter.
+```shell
+lambda-uploader --virtualenv=~/.virtualenv/my_custom_virtualenv
+```
+
 If you would prefer to upload another way you can tell the uploader to ignore the upload.
 This will create a package and leave it in the project directory.
 ```shell
diff --git a/README.rst b/README.rst
index ad7b199..db1a8b3 100644
--- a/README.rst
+++ b/README.rst
@@ -63,6 +63,12 @@ To specify an alternative profile that has been defined in
 
     lambda-uploader --profile=alternative-profile
 
+To specify an alternative, prexisting virtualenv use the ``--virtualenv`` parameter.
+
+.. code:: shell
+
+    lambda-uploader --virtualenv=~/.virtualenv/my_custom_virtualenv
+
 If you would prefer to upload another way you can tell the uploader to
 ignore the upload. This will create a package and leave it in the
 project directory.
diff --git a/lambda_uploader/package.py b/lambda_uploader/package.py
index 083077f..8bbbf54 100644
--- a/lambda_uploader/package.py
+++ b/lambda_uploader/package.py
@@ -26,28 +26,38 @@ TEMP_WORKSPACE_NAME = ".lamba_uploader_temp"
 ZIPFILE_NAME = 'lambda_function.zip'
 
 
-def build_package(path, requirements):
-    pkg = Package(path)
+def build_package(path, requirements, virtualenv=None):
+    pkg = Package(path, virtualenv)
 
     pkg.clean_workspace()
     pkg.clean_zipfile()
     pkg.prepare_workspace()
-    pkg.install_requirements(requirements)
+    if virtualenv:
+        if not os.path.isdir(virtualenv):
+            raise Exception("supplied virtualenv %s not found" % virtualenv)
+        LOG.info("Using existing virtualenv found in %s" % virtualenv)
+    else:
+        LOG.info('Building new virtualenv and installing requirements')
+        pkg.prepare_virtualenv()
+        pkg.install_requirements(requirements)
     pkg.package()
     return pkg
 
 
 class Package(object):
-    def __init__(self, path):
+    def __init__(self, path, virtualenv=None):
         self._path = path
         self._temp_workspace = os.path.join(path,
                                             TEMP_WORKSPACE_NAME)
         self.zip_file = os.path.join(path, ZIPFILE_NAME)
 
-        self._pkg_venv = os.path.join(self._temp_workspace, 'venv')
-        self._venv_pip = 'bin/pip'
-        if sys.platform == 'win32' or sys.platform == 'cygwin':
-            self._venv_pip = 'Scripts\pip.exe'
+        if virtualenv:
+            self._pkg_venv = virtualenv
+        else:
+            self._pkg_venv = os.path.join(self._temp_workspace, 'venv')
+            self._venv_pip = 'bin/pip'
+            if sys.platform == 'win32' or sys.platform == 'cygwin':
+                self._venv_pip = 'Scripts\pip.exe'
 
     def clean_workspace(self):
         if os.path.isdir(self._temp_workspace):
@@ -61,6 +71,7 @@ class Package(object):
         # Setup temporary workspace
         os.mkdir(self._temp_workspace)
 
+    def prepare_virtualenv(self):
         proc = Popen(["virtualenv", self._pkg_venv], stdout=PIPE, stderr=PIPE)
         stdout, stderr = proc.communicate()
         LOG.debug("Virtualenv stdout: %s" % stdout)
diff --git a/lambda_uploader/shell.py b/lambda_uploader/shell.py
index 027685f..5b57967 100644
--- a/lambda_uploader/shell.py
+++ b/lambda_uploader/shell.py
@@ -50,7 +50,7 @@ def _execute(args):
     cfg = config.Config(pth, args.config, role=args.role)
 
     _print('Building Package')
-    pkg = package.build_package(pth, cfg.requirements)
+    pkg = package.build_package(pth, cfg.requirements, args.virtualenv)
 
     if not args.no_clean:
         pkg.clean_workspace()
@@ -97,6 +97,9 @@ def main(arv=None):
                         action='store_const',
                         help='publish an upload to an immutable version',
                         const=True)
+    parser.add_argument('--virtualenv', '-e',
+                        help='use specified virtualenv instead of making one',
+                        default=None)
     parser.add_argument('--role', dest='role',
                         default=getenv('LAMBDA_UPLOADER_ROLE'),
                         help=('IAM role to assign the lambda function, '

Allow a virtualenv for another platform to be included
Instead of building a virtualenv with requirements.txt, allow an existing virtualenv to be used. This would allow us to build a virtualenv for Amazon Linux, and then still deploy lambda functions using lambda-uploader from client machines or other automation that may not be the same architecture as what Lambda runs on.

This is needed for me due to PyPi's cryptography package using different shared libraries on Ubuntu (my desktop) and Amazon Linux (where the function will run).
diff --git a/test/test_package.py b/test/test_package.py
index 88cc9f6..1a64572 100644
--- a/test/test_package.py
+++ b/test/test_package.py
@@ -39,6 +39,7 @@ def test_prepare_workspace():
 
     pkg = package.Package(TESTING_TEMP_DIR)
     pkg.prepare_workspace()
+    pkg.prepare_virtualenv()
     assert path.isdir(temp_workspace)
     assert path.isdir(path.join(temp_workspace, 'venv'))
     if sys.platform == 'win32' or sys.platform == 'cygwin':
@@ -63,6 +64,11 @@ def test_install_requirements():
     assert path.isdir(path.join(site_packages, '_pytest'))
 
 
+def test_existing_virtualenv():
+    pkg = package.Package(TESTING_TEMP_DIR, 'abc')
+    assert pkg._pkg_venv == 'abc'
+
+
 def test_package():
     pkg = package.Package(TESTING_TEMP_DIR)
     pkg.package()

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio pytest
apt-get update apt-get install -y gcc
3.7
tests/pksetup_data/pksetupunit1/requirements.txt tests/pksetup_data/pksetupunit2/requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
boto3==1.1.4
botocore==1.2.11
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
distlib==0.3.9
docutils==0.20.1
exceptiongroup==1.2.2
execnet==2.0.2
filelock==3.12.2
futures==2.2.0
importlib-metadata==6.7.0
iniconfig==2.0.0
jmespath==0.10.0
-e git+https://github.com/rackerlabs/lambda-uploader.git@abf7e64f20294e7f6f44169ccb496f61018667b7#egg=lambda_uploader
packaging==24.0
platformdirs==4.0.0
pluggy==1.2.0
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-xdist==3.5.0
python-dateutil==2.9.0.post0
six==1.17.0
tomli==2.0.1
typing_extensions==4.7.1
virtualenv==20.26.6
zipp==3.15.0

name: lambda-uploader
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - boto3==1.1.4
      - botocore==1.2.11
      - coverage==7.2.7
      - distlib==0.3.9
      - docutils==0.20.1
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - filelock==3.12.2
      - futures==2.2.0
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - jmespath==0.10.0
      - packaging==24.0
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - python-dateutil==2.9.0.post0
      - six==1.17.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - virtualenv==20.26.6
      - zipp==3.15.0
prefix: /opt/conda/envs/lambda-uploader

test/test_package.py::test_prepare_workspace test/test_package.py::test_existing_virtualenv
test/test_package.py::test_install_requirements
test/test_package.py::test_package_zip_location test/test_package.py::test_package_clean_workspace test/test_package.py::test_package
README.rst lambda_uploader/package.py README.md lambda_uploader/shell.py
README.rst lambda_uploader/package.py README.md lambda_uploader/shell.py