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

pdm config pypi.verify_ssl False is not working #1663

Closed
1 task done
cvgaviao opened this issue Feb 2, 2023 · 1 comment · Fixed by j178/pdm#1
Closed
1 task done

pdm config pypi.verify_ssl False is not working #1663

cvgaviao opened this issue Feb 2, 2023 · 1 comment · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@cvgaviao
Copy link

cvgaviao commented Feb 2, 2023

  • I have searched the issue tracker and believe that this is not a duplicate.

Actual behavior

I'm trying to create a container image inside a linux server. I need to use my company's pypi server instead of the of the default one. But both RUN pdm config -v pypi.verify_ssl False or RUN pdm config pypi.url ${PYPI_URL} is giving me an error like the one below.
If I try to set pypi.verify_ssl first, it is trying to reach out the default pypi server, but it can't because it is blocked. And if I change the default pypi first, it doesn't work because it tries to validate a certificate.

[1/2] STEP 13/19: RUN pip install --no-input --no-cache-dir --upgrade pip setuptools wheel pdm
--> Using cache 6d3300e7ac9489084d61ed28906c4ef986b44981ae72a3454cba164863a34cf9
--> 6d3300e7ac9
[1/2] STEP 14/19: COPY pyproject.toml pdm.lock README.md /usr/src/app
--> Using cache b7c6b08cca4966c6feb0b552a0b7526c2702953fc5e6bc4b41c084f9a981d30f
--> b7c6b08cca4
[1/2] STEP 15/19: COPY src /usr/src/app
--> Using cache b17862998e2d41636c430d431ca68eff86b77ef900aa5fea78c25bbb31137333
--> b17862998e2
[1/2] STEP 16/19: WORKDIR /usr/src/app
--> Using cache 77e752d677b3ff5a0d344fb5214dbfced60e23b15942d66c68d8e4b5895e34fd
--> 77e752d677b
[1/2] STEP 17/19: RUN pdm config -v pypi.verify_ssl False && pdm config pypi.url ${PYPI_URL}
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7ff88ff7c950>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  [Previous line repeated 2 more times]
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pdm/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff88ff7c950>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/core.py", line 259, in main
    return Core().main(args)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/core.py", line 205, in main
    check_update(project)
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 864, in check_update
    latest_version = get_latest_version(project)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 850, in get_latest_version
    latest_version = get_latest_pdm_version_from_pypi(project)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 833, in get_latest_pdm_version_from_pypi
    candidate = finder.find_best_match("pdm", allow_prereleases=prereleases).best
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 318, in find_best_match
    candidates = list(
                 ^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 260, in _find_packages_from_requirement
    yield from self._find_packages(requirement.name, allow_yanked, hashes)
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 218, in _find_packages
    yield from self._evaluate_links(
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 133, in collect_links_from_location
    yield from _collect_links_from_index(session, location)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 153, in _collect_links_from_index
    page = fetch_page(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 140, in fetch_page
    resp = _get_html_response(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 175, in _get_html_response
    resp = session.get(
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/session.py", line 46, in send
    return super().send(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cachecontrol/adapter.py", line 57, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pdm/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff88ff7c950>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Error: error building at STEP "RUN pdm config -v pypi.verify_ssl False && pdm config pypi.url ${PYPI_URL}": error while running runtime: exit status 1

I also tried to introduce a certificate to make it work, but also PDM tries to connect to default pypi.

[1/2] STEP 18/22: RUN pdm config pypi.client_cert /usr/src/app/br.emea.proxy.crt.pem
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f95d78140d0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 815, in urlopen
    return self.urlopen(
           ^^^^^^^^^^^^^
  [Previous line repeated 2 more times]
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pdm/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f95d78140d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/core.py", line 259, in main
    return Core().main(args)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/core.py", line 205, in main
    check_update(project)
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 864, in check_update
    latest_version = get_latest_version(project)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 850, in get_latest_version
    latest_version = get_latest_pdm_version_from_pypi(project)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pdm/cli/actions.py", line 833, in get_latest_pdm_version_from_pypi
    candidate = finder.find_best_match("pdm", allow_prereleases=prereleases).best
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 318, in find_best_match
    candidates = list(
                 ^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 260, in _find_packages_from_requirement
    yield from self._find_packages(requirement.name, allow_yanked, hashes)
  File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 218, in _find_packages
    yield from self._evaluate_links(
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 133, in collect_links_from_location
    yield from _collect_links_from_index(session, location)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 153, in _collect_links_from_index
    page = fetch_page(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 140, in fetch_page
    resp = _get_html_response(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/unearth/collector.py", line 175, in _get_html_response
    resp = session.get(
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cachecontrol/adapter.py", line 57, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pdm/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f95d78140d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Error: error building at STEP "RUN pdm config pypi.client_cert /usr/src/app/br.emea.proxy.crt.pem": error while running runtime: exit status 1

Steps to reproduce

Block your own access to pypi.org and try to set any configuration

Expected behavior

Certificates not being verified and breaking the building...

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
@cvgaviao cvgaviao added the 🐛 bug Something isn't working label Feb 2, 2023
@frostming
Copy link
Collaborator

You need to first disable check_update or it will request pypi after the first pdm invocation:

pdm config check_update false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants