uv icon indicating copy to clipboard operation
uv copied to clipboard

uv pip install HTTP status client error (405 Method Not Allowed) for private azure package index

Open exs-avianello opened this issue 1 year ago • 4 comments

Hello! Very excited for this project ❤️

Installing a package from a private azure package index (Azure Artifacts) seems to be failing with a HTTP status client error (405 Method Not Allowed):

uv pip install --extra-index-url "https://<FEED_NAME>:<PERSONAL_ACCESS_TOKEN>@pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/simple/" package-name                                          
error: Failed to download: package-name==X.Y.Z
  Caused by: HTTP status client error (405 Method Not Allowed) for url (pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/.../pypi/download/package-name/X.Y.Z/package_name-X.Y.Z-py3-none-any.whl#[sha256=])

The equivalent pip-native command works as expected

python -m pip install --extra-index-url "https://<FEED_NAME>:<PERSONAL_ACCESS_TOKEN>@pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/simple/" package-name

exs-avianello avatar Feb 15 '24 22:02 exs-avianello

Thank you! Will take a look.

charliermarsh avatar Feb 15 '24 22:02 charliermarsh

Same here - Really want to test (and replace pip with) uv but waiting for Azure artifacts support :( !

yogevyuval avatar Feb 18 '24 14:02 yogevyuval

Thanks and sorry about that -- we'll get this setup internally and see if we can reproduce.

charliermarsh avatar Feb 18 '24 15:02 charliermarsh

Yep this is a priority for me next week!

zanieb avatar Feb 18 '24 17:02 zanieb

+1. Same issue for me.

MarcSkovMadsen avatar Feb 19 '24 11:02 MarcSkovMadsen

I believe this is the same as https://github.com/astral-sh/uv/issues/1458 (lack of support for HEAD requests).

charliermarsh avatar Feb 19 '24 14:02 charliermarsh

Okay, @olivierlefloch fixed HEAD requests, but there's now an auth problem. @zanieb, do you want to take from here?

charliermarsh avatar Feb 19 '24 20:02 charliermarsh

Thank you all!

I can confirm that on uv 0.1.6 this is no longer giving 405 Method Not Allowed but a 401 Unauthorized

uv pip install --extra-index-url "https://<FEED_NAME>:<PERSONAL_ACCESS_TOKEN>@pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/simple/" package-name                                          
error: Failed to download: package-name==X.Y.Z
  Caused by: HTTP status client error (401 Unauthorized) for url (pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/.../pypi/download/package-name/X.Y.Z/package_name-X.Y.Z-py3-none-any.whl#[sha256=])

exs-avianello avatar Feb 21 '24 13:02 exs-avianello

Same for gitlab hosted private package index: getting a 401 Unauthorized. Interestingly, opening the URL in the error message in the browser downloads the package for me without a problem. the url looks like this:

https://gitlab.com/api/v4/groups/<GROUP_NR>/-/packages/pypi/files/<SOME_LONG_HASH>/<PKG_NAME>-py3-none-any.whl#sha256=<PKG_SHA>

gwdekker avatar Feb 22 '24 09:02 gwdekker

Hi! We just merged a fix with #1874 that's out in v0.1.8 — let me know if that helps. I'll continue testing against various private repositories.

zanieb avatar Feb 22 '24 20:02 zanieb

Thank you @zanieb! At least for Azure Artifacts, I am still seeing the same error on 0.1.8 (401 Unauthorized)

exs-avianello avatar Feb 22 '24 20:02 exs-avianello

Same here, 401 Unauthorized for Azure Artifacts with uv 0.1.8

yogevyuval avatar Feb 22 '24 21:02 yogevyuval

For my own sanity, note this is also being tracked in https://github.com/astral-sh/uv/issues/1709

zanieb avatar Feb 22 '24 21:02 zanieb

A fix is up at https://github.com/astral-sh/uv/pull/1886 if anyone wants to give it a try against a private index.

zanieb avatar Feb 22 '24 22:02 zanieb

Verified working on azure artifacts feed using token authentication!!

Incredible work @zanieb, @olivierlefloch and @charliermarsh 🚀

inigohidalgo avatar Feb 22 '24 22:02 inigohidalgo

I can confirm as well ❤️ Thank you so much!

exs-avianello avatar Feb 23 '24 07:02 exs-avianello