This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.
When you provide your app’s Python dependencies in a requirements.txt
file, your app looks for
the packages on PyPI.org by default. This guide can help you customize this behavior when your app
depends on a package that is not available on PyPI.org, or when your organization does not allow fetching packages from PyPI.org.
See also: Handling dependencies when Dash Enterprise is internet-restricted.
There are two common approaches: Including the Python packages directly in your app’s files or using a private Python package index provided by your organization. If your administrator
has configured a private Python package index at the system level,
then no action is needed for your apps to fetch packages from it.
By placing the package tar.gz
(tarball) or .whl
(wheel) file directly in your app’s code, your app can install the package using this file.
Here’s an example where a tarball is placed at the root of the app:
-- .gitignore
-- app.py
-- Procfile
-- requirements.txt
-- myPackage.tar.gz
Make sure the requirements.txt
entry matches the name of the file you added, including the extension. In the example above, you would list the package in requirements.txt
with:
myPackage.tar.gz
Important: If your package depends on other packages that are not available on PyPI.org, you’ll need to add them to your app as well.
If you’re including a lot of packages in your app, you may want to organize them in a directory like packages
. Your
requirements.txt
would then look like:
packages/myPackageA.tar.gz
packages/myPackageB.tar.gz
packages/myPackageC.tar.gz
If your organization manages a private Python package index, you can set it as an extra index that your app checks
when installing dependencies.
Important: Dash Enterprise requires that the private Python package index have a TLS/SSL certificate from a globally trusted certificate authority (CA).
To install a package from a private Python package index:
At the top of requirements.txt
, add the following line:
txt
--extra-index-url <private-package-index> --trusted-host <private-package-index>
where <private-package-index>
is the URL to your organization’s private Python package index. You can omit the --trusted-host
flag if the index uses HTTPS.
List the package name in requirements.txt
on its own line the same way you would for a public package. For example:
txt
my-private-package
Your app continues to look for packages on PyPI.org, but it now also looks in your private Python package index for any
packages it can’t find on PyPI.org.
If you are an administrator with access to the KOTS Admin Console, you can set an PIP_EXTRA_INDEX_URL
environment variable that will be applied to all apps and workspaces on Dash Enterprise.
To configure a private Python package index at the system level:
Go to the KOTS Admin Console at (https://admin-<your-dash-enterprise-server>
).
Enter the password that was stored as part of your Dash Enterprise installation.
Go to the Config tab.
In PIP_EXTRA_INDEX_URL, enter the URL of your private Python package index.
<img>
Once the config is saved, a confirmation message appears.
In the confirmation message, select Go to updated version. You are taken to the version history.
Next to the available version labelled Config change, verify that there is only one changed file:
<img>
Important: If there is more than one changed file, deploying the version performs a Dash Enterprise upgrade at the same time as applying your config change. In addition to incurring downtime, some upgrades have prerequisites that you must first meet. Continue if there is one changed file; otherwise, contact us.
Apps and workspaces created on Dash Enterprise after this change will automatically pick up the private Python package index via the PIP_EXTRA_INDEX_URL
environment variable.
To apply this change to existing apps and workspaces, redeploy the apps and rebuild or recreate the workspaces.