What is the format to use in pip requirements.txt file to download a package from a…
- User
What is the format to use in pip requirements.txt file to download a package from a specific url ?
Assistant
To specify a package from a specific URL in a
requirements.txtfile forpip, you can use the following format:Basic Syntax
plaintext<package_name> @ <url_to_package_file>Example
If you want to install
requestsfrom a direct download URL (e.g., a.whlor.tar.gzfile), you can write:plaintextrequests @ https://example.com/packages/requests-2.28.1.tar.gzAlternative (Direct URL without Package Name)
If the package name is already in the filename, you can also use:
plaintexthttps://example.com/packages/requests-2.28.1.tar.gz- User
I am not speaking about git but about actual whl url like https://download.pytorch.org/whl/cu128
Assistant
If you want to specify a
.whl(wheel) file from a direct URL (like PyTorch's official download URL) in arequirements.txtfile, you can use one of these formats:1. Direct URL (Simplest)
plaintexthttps://download.pytorch.org/whl/cu128/torch-2.3.0%2Bcu128-cp310-cp310-linux_x86_64.whl(Note:
%2Bis the URL-encoded version of+in the filename.)2. With Package Name (Recommended)