I have stored both a Python package (mypackage.whl
) and an index.html
file (listing the package) in an Azure Storage Account (Blob Storage). I want to use pip install
with --index-url to install the package directly from Azure Storage. However, pip
does not recognize the Azure Storage URL as a valid package index.
My Azure Storage container (mycontainer
) contains:
.html .0.0-py3-none-any.whl
I attempted to install the package using:
pip install mypackage --index-url=/
But I got the error:
ERROR: Could not find a version that satisfies the requirement mypackage (from versions: none)
Questions:
- How can I configure the index.html file so that pip recognizes it as a valid package index?
- Are there alternative ways to host a pip-compatible package index in Azure Storage?
Note that the storage container is public and I do not want to use Azure Artifacts
—only Azure Blob Storage as Azure artifacts
supports only package uploading.
index.html looks like:
When I click on package 1, it lists all whl files.
I have stored both a Python package (mypackage.whl
) and an index.html
file (listing the package) in an Azure Storage Account (Blob Storage). I want to use pip install
with --index-url to install the package directly from Azure Storage. However, pip
does not recognize the Azure Storage URL as a valid package index.
My Azure Storage container (mycontainer
) contains:
https://mystorageaccount.blob.core.windows/mycontainer/index.html https://mystorageaccount.blob.core.windows/mycontainer/mypackage-1.0.0-py3-none-any.whl
I attempted to install the package using:
pip install mypackage --index-url=https://mystorageaccount.blob.core.windows/mycontainer/
But I got the error:
ERROR: Could not find a version that satisfies the requirement mypackage (from versions: none)
Questions:
- How can I configure the index.html file so that pip recognizes it as a valid package index?
- Are there alternative ways to host a pip-compatible package index in Azure Storage?
Note that the storage container is public and I do not want to use Azure Artifacts
—only Azure Blob Storage as Azure artifacts
supports only package uploading.
index.html looks like:
When I click on package 1, it lists all whl files.
Share Improve this question asked Mar 26 at 12:39 Jayesh TannaJayesh Tanna 4181 gold badge7 silver badges19 bronze badges 1- Ensure that index.html follows PEP 503 by listing package links using <a href="mypackage-1.0.0-py3-none-any.whl">mypackage-1.0.0</a> and set --trusted-host mystorageaccount.blob.core.windows in the pip command @jayeshTanna – Vinay B Commented Mar 27 at 8:48
1 Answer
Reset to default 0Use an index URL in pip install when both the package and index are stored in Azure Storage
I had installed the package from Azure Blob Storage using pip install --index-url
I had uploaded the .whl
files to Azure Blob Storage using the following command:
az storage blob upload --account-name <storage-account-name> --container-name <container-name> --file "C:\path\to\mypackage-1.0.0-py3-none-any.whl" --name mypackage-1.0.0-py3-none-any.whl --auth-mode login
After uploading, I verified the files using
az storage blob list --container-name <container-name> --account-name <storage-account-name> --output table
The list of uploaded files:
Uploaded the .whl
files to the Azure Blob Storage container by keeping the container to access publicly or can check by using the command below
az storage container set-permission --name <container-name> --account-name <storage-account-name> --public-access blob
Configured the index.html file following PEP 503 by listing package links
<!DOCTYPE html>
<html>
<body>
<a href="mypackage-1.0.0-py3-none-any.whl">mypackage-1.0.0-py3-none-any.whl</a><br>
<a href="mypackage-1.1.0-py3-none-any.whl">mypackage-1.1.0-py3-none-any.whl</a><br>
</body>
</html>
Then installed the package using pip
pip install mypackage --index-url=https://mystorageaccount.blob.core.windows/mycontainer/
Output:
The .whl files had uploaded into the Azure blob storage
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744144624a4560362.html
评论列表(0条)