Skip to content

Commit

Permalink
Introduce NVIDIA_PIP_INDEX_URL env var
Browse files Browse the repository at this point in the history
Signed-off-by: ddelange <14880945+ddelange@users.noreply.github.com>
  • Loading branch information
ddelange committed Jul 6, 2023
1 parent e89d6b5 commit 0f13ecd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/packaging/frontend_sdist/setup.py
Expand Up @@ -28,6 +28,7 @@
"{}_libs=={}".format(tensorrt_module, tensorrt_version),
"{}_bindings=={}".format(tensorrt_module, tensorrt_version),
]
nvidia_pip_index_url = os.environ.get("NVIDIA_PIP_INDEX_URL", "https://pypi.nvidia.com")


class InstallCommand(install):
Expand All @@ -38,7 +39,7 @@ def run(self):
"{}/bin/pip".format(sys.exec_prefix),
"install",
"--extra-index-url",
"https://pypi.nvidia.com",
nvidia_pip_index_url,
*tensorrt_submodules,
]
)
Expand Down Expand Up @@ -77,7 +78,7 @@ def parent_command_line():


# use pip-inside-pip hack only if the nvidia index is not set in the environment
if "pypi.nvidia.com" in pip_config_list() or "pypi.nvidia.com" in parent_command_line():
if nvidia_pip_index_url in pip_config_list() or nvidia_pip_index_url in parent_command_line():
install_requires = tensorrt_submodules
cmdclass = {}
else:
Expand All @@ -89,18 +90,18 @@ def parent_command_line():
name=tensorrt_module,
version=tensorrt_version,
description="A high performance deep learning inference library",
long_description="""A high performance deep learning inference library
long_description=f"""A high performance deep learning inference library
To install, please execute the following:
```
pip install tensorrt --extra-index-url https://pypi.nvidia.com
pip install tensorrt --extra-index-url {nvidia_pip_index_url}
```
Or put the index URL in the (comma-separated) PIP_EXTRA_INDEX_URL environment variable:
```
export PIP_EXTRA_INDEX_URL=https://pypi.nvidia.com
export PIP_EXTRA_INDEX_URL={nvidia_pip_index_url}
pip install tensorrt
```
When the extra index url does not contain `pypi.nvidia.com`, a nested `pip install` will run with the proper extra index url hard-coded.
When the extra index url does not contain `{nvidia_pip_index_url}`, a nested `pip install` will run with the proper extra index url hard-coded.
""",
long_description_content_type="text/markdown",
author="NVIDIA Corporation",
Expand Down

0 comments on commit 0f13ecd

Please sign in to comment.