问题
Azure Artifacts allows posting a module to an Artifactory that can then be installed by using pip by setting extra-index-url in pip.ini
(Windows) or pip.conf
(Mac/Linux)
However, when using pip install, the system is asking for a user/password
Is it possible to setup this inside pip.conf
and / or even better use .ssh signatures?
回答1:
Is it possible to setup this inside pip.conf and / or even better use .ssh signatures?
What you met is expected behavior if it's the first time that you try to connect to the Azure Devops feed.
It will ask your credentials and keep it in local cache, and it won't ask for user and password again if everything is ok. Check my log:
We should note:
1.The Python Credential Provider is an artifacts-keyring
package. It's used to keep the credentials instead of other options like pip.conf
or .ssh
.
2.What it asks for is a PAT. For me, I enter the pat in both User
and Password
inputs.
3.If you still need to enter the password every time when connecting to the feed, there must be something wrong with your Python Credential Provider
(artifacts-keyring) package. Make sure you install this package successfully before running the pip install
command.
4.There're two options(It seems you're using option2) to connect to the feed, they both need the artifacts keyring
package to save the credentials. For me in windows environemnt, it's easy to install that package. But if you're in Linux environment, you should check the step4 in Get Tools button carefully:
Here's the link of prerequisites above.
Hope all above helps :)
回答2:
I was facing the same issue, a workaround solution that worked for me. To bypass the entire process Lance Li-MSFT mentioned:
It will ask your credentials and keep it in local cache, and it won't ask for user and password again if everything is ok
)
In the pip.ini
/ pip.conf
file, add:
[global]
extra-index-url=https://<Personal Access Token>@pkgs.dev.azure.com/<Organization Name>/_packaging/<Feed Name>/pypi/simple/
This will be useful if you are in an environment where you can't do the first interactive login (Example Use-Case: Setting up an Azure Databricks from Azure Machine Learning Workspace and installing required packages).
来源:https://stackoverflow.com/questions/62036909/how-to-specify-authentication-for-pip-project-setup-pip-with-extra-index-url-in