Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download a package from a private repository with bad certificate #1700

Closed
frague59 opened this issue Feb 19, 2024 · 9 comments
Closed

Download a package from a private repository with bad certificate #1700

frague59 opened this issue Feb 19, 2024 · 9 comments
Assignees
Labels
bug Something isn't working network Network connectivity e.g. proxies, DNS, and SSL registry Related to package indexes and registries

Comments

@frague59
Copy link

frague59 commented Feb 19, 2024

Hi,

I'm using a requirements.txt file, with some packages from a private repository. This repo is based on a private gitlab, with a self-signed certificate (Cannot use a right one, for some infrastructure reasons...)

I can install my packages from this repo using pip install -r ... but not using uv pip install -r ....

My requirements.txt:

mypackage @ git+https://gitlab.example.com/<my_user>/mypackage@main#egg=<my_egg>

With pip:

$ pip install -r requirements.txt
Collecting mypackage@ git+https://gitlab.ville.tg/<my user>/mypackage@main#egg=mypackage (from -r ../requirements/common.txt (line 24))
  Cloning https://gitlab.ville.tg/<my user>/mypackage  (to revision main) to /tmp/pip-install-0wbxgsrj/mypackage_3369986277e8440d861fb9f680c74595
  Running command git clone --filter=blob:none --quiet https://gitlab.ville.tg/<my user>/mypackage /tmp/pip-install-0wbxgsrj/mypackage_3369986277e8440d861fb9f680c74595
  avertissement : redirection vers https://gitlab.ville.tg/<my user>/django-notifications.git/
  Resolved https://gitlab.ville.tg/<my user>/mypackage to commit b13c3a56f54f0cf35a60df4281995ca1fc75d67f
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
...

Witih uv pip

$ uv pip install -r requirements.txt
Updating https://gitlab.ville.tg/fguerin/mypackage (main)                                                                                                                                                               error: Failed to download and build: mypackage @ git+https://gitlab.ville.tg/<my user>/mypackage@main#egg=mypackage
  Caused by: Git operation failed
  Caused by: failed to fetch into: /home/<my user>/.cache/uv/git-v0/db/c13f4940a991ecb3
  Caused by: failed to connect to the repository
  Caused by: the SSL certificate is invalid; class=Ssl (16); code=Certificate (-17)

Thanks for your help !

@frague59 frague59 changed the title Download a package from a privet repository with bad certificate Download a package from a private repository with bad certificate Feb 19, 2024
@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Hi! Thanks for the clear issue.

Is this a duplicate of #1339? Can you add the certificate to your system trust store per #1512?

@zanieb zanieb added the question Asking for clarification or support label Feb 19, 2024
@frague59
Copy link
Author

Thanks for your quick answer !

I do not use the --trusted-host parameter while using pip install, but I've my credentials installed in the /home/<my user>/.pypirc.

Look's like I already have this cert in my "system trust store" (not sure of what I've to put on it...)

@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Are you using the latest version of uv?

Note we don't support reading from the .pypirc file.

@frague59
Copy link
Author

Yes, I do.

Fresh install using pipx -- 0.1.5

@zanieb zanieb added bug Something isn't working registry Related to package indexes and registries and removed question Asking for clarification or support labels Feb 19, 2024
@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Thanks I'll look into this!

@dmatos2012
Copy link

dmatos2012 commented Feb 28, 2024

What is the recommended uv way of handling this instead? Running into same issue. Yes, I could pass --extra-index-url but I have multiple packages thus it would become unfeasible. My ~/.pypirc has th following:

[distutils]
index-servers = 
    proj1
    proj2

[proj1]
repository = https://gitlab.com/api/v4/projects/<GITLAB_PROJECT_ID>/packages/pypi
username = un
password = pw

[proj2]
repository = https://gitlab.com/api/v4/projects/<GITLAB_PROJECT_ID>/packages/pypi
username = un
password = pw

[proj..n]
.....

Thus running pip install -r requirements.txt looks in all these private indexes, but uv pip install -r requirements.txt fails with:
error: HTTP status client error (401 Unauthorized) for https://gitlab.com/api/v4/projects/<GITLAB_PROJECT_ID>/packages/pypi

@zanieb zanieb added the network Network connectivity e.g. proxies, DNS, and SSL label Feb 28, 2024
@sephib
Copy link

sephib commented Mar 5, 2024

Hi,
guessing this is the same issue
just giving another aspect
working via a private repo on GCP
the authentication is done via

keyring==24.3.0
keyrings-google-artifactregistry-auth==1.1.2

when running

python -m pip install \
		--index-url https://my-region-python.pkg.dev/my-gcp-prj/python-repo/simple/ \
		--extra-index-url https://pypi.python.org/simple/ \
		--upgrade \
		-r requirements-private.txt

successfully installed
But when running

uv pip install --index-url https://my-region-python.pkg.dev/my-gcp-prj/python-repo/simple/   \      
                      --extra-index-url https://pypi.python.org/simple/   \
                      --upgrade  \
                      -r requirements-private.txt

getting the following error:

error: HTTP status client error (401 Unauthorized) for url (https://my-region-python.pkg.dev/my-gcp-prj/python-repo/simple/my-package/)

I also had an issue with the --pre flag
if my requirements-private.txt has the --pre flag, e.g.

my-package --pre

i get the following error

error: Expected '--hash', found '"--pre"' in requirements-private.txt at position NN

@zanieb
Copy link
Member

zanieb commented Mar 5, 2024

Hi! We don't have keyring support yet. You can track that at #1520

We also do not support specifying --pre in requirements files. You can specify my-package >=0.0.0dev0 if you want to enable prereleases for a single package or --pre on the command line to enable them globally. Please open a new issue if you want to discuss that further.

@konstin
Copy link
Member

konstin commented Jun 27, 2024

These should now be supported through SSL_CERT_FILE and --keyring-provider/UV_KEYRING_PROVIDER.

@konstin konstin closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working network Network connectivity e.g. proxies, DNS, and SSL registry Related to package indexes and registries
Projects
None yet
Development

No branches or pull requests

5 participants