admin管理员组文章数量:1396850
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
本文标签:
版权声明:本文标题:python - How to use an index URL in pip install when both the package and index are stored in Azure Storage - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744144623a2592776.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论