python - How to use an index URL in pip install when both the package and index are stored in Azure Storage - Stack Overflow

I have stored both a Python package (mypackage.whl) and an index.html file (listing the package) in an

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:

  1. How can I configure the index.html file so that pip recognizes it as a valid package index?
  2. 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:

  1. How can I configure the index.html file so that pip recognizes it as a valid package index?
  2. 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
Add a comment  | 

1 Answer 1

Reset to default 0

Use 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信