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

config pypi.url does't work at docker build #2560

Closed
ElfenSterben opened this issue Jan 15, 2024 · 2 comments · Fixed by #2563
Closed

config pypi.url does't work at docker build #2560

ElfenSterben opened this issue Jan 15, 2024 · 2 comments · Fixed by #2563
Labels
🐛 bug Something isn't working

Comments

@ElfenSterben
Copy link

Make sure you run commands with -v flag before pasting the output.
image

Environment Information

Dockerfile

FROM python:3.11-bullseye
ENV TZ=Asia/Shanghai
RUN pip install pdm -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple
WORKDIR /app
COPY pyproject.toml pdm.lock /app/
RUN  pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple && pdm sync --prod

log

#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 413B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.11-bullseye
#3 DONE 0.0s

#4 [ 1/10] FROM docker.io/library/python:3.11-bullseye
#4 CACHED

#5 [internal] load build context
#5 transferring context: 63.35kB 0.1s done
#5 DONE 0.1s

#6 [ 2/10] RUN pip install pdm -i https://pypi.tuna.tsinghua.edu.cn/simple
#6 1.992 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
#6 2.259 Collecting pdm
#6 2.298   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1b/43/822cf4673e1926cd905d3b076976a4781e85475966fe3d7d9aaf42dd7a40/pdm-2.11.2-py3-none-any.whl (248 kB)
#6 2.381      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 248.0/248.0 kB 3.0 MB/s eta 0:00:00
#6 2.457 Collecting blinker (from pdm)
#6 2.488   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fa/2a/7f3714cbc6356a0efec525ce7a0613d581072ed6eb53eb7b9754f33db807/blinker-1.7.0-py3-none-any.whl (13 kB)
#6 2.560 Collecting certifi (from pdm)
#6 2.592   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/64/62/428ef076be88fa93716b576e4a01f919d25968913e817077a386fcbe4f42/certifi-2023.11.17-py3-none-any.whl (162 kB)
#6 2.611      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 kB 9.5 MB/s eta 0:00:00
#6 2.686 Collecting packaging!=22.0,>=20.9 (from pdm)
#6 2.717   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl (53 kB)
#6 2.726      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 7.0 MB/s eta 0:00:00
#6 2.796 Collecting platformdirs (from pdm)
#6 2.828   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/be/53/42fe5eab4a09d251a76d0043e018172db324a23fcdac70f77a551c11f618/platformdirs-4.1.0-py3-none-any.whl (17 kB)
#6 2.997 Collecting rich>=12.3.0 (from pdm)
#6 3.028   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/be/be/1520178fa01eabe014b16e72a952b9f900631142ccd03dc36cf93e30c1ce/rich-13.7.0-py3-none-any.whl (240 kB)
#6 3.055      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.6/240.6 kB 9.9 MB/s eta 0:00:00
#6 3.233 Collecting virtualenv>=20 (from pdm)
#6 3.265   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/83/22/54b1180756d2d6194bcafb7425d437c3034c4bff92129c3e1e633079e2c4/virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
#6 3.414      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 25.8 MB/s eta 0:00:00
#6 3.480 Collecting pyproject-hooks (from pdm)
#6 3.513   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d5/ea/9ae603de7fbb3df820b23a70f6aff92bf8c7770043254ad8d2dc9d6bcba4/pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB)
#6 3.572 Collecting requests-toolbelt (from pdm)
#6 3.603   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3f/51/d4db610ef29373b879047326cbf6fa98b6c1969d6f6dc423279de2b1be2c/requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
#6 3.613      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 kB 6.8 MB/s eta 0:00:00
#6 3.674 Collecting unearth>=0.12.1 (from pdm)
#6 3.707   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/69/41/06becddbd901156370f7a63319ef075c73550756f42c33b7e91185009c99/unearth-0.14.0-py3-none-any.whl (42 kB)
#6 3.716      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.0/43.0 kB 4.8 MB/s eta 0:00:00
#6 3.764 Collecting dep-logic<1.0,>=0.0.2 (from pdm)
#6 3.796   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/73/61/d3c28dde69cf3e19e7ac42cc86abd675fc985f52a3c61f878abab713e659/dep_logic-0.0.4-py3-none-any.whl (26 kB)
#6 3.860 Collecting findpython<1.0.0a0,>=0.4.0 (from pdm)
#6 3.893   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fe/43/d7c000663d42f142b49ac633cfa7248e14cff531269e313b3c9fdf69be09/findpython-0.4.1-py3-none-any.whl (20 kB)
#6 3.978 Collecting tomlkit<1,>=0.11.1 (from pdm)
#6 4.009   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6e/43/159750d32481f16e34cc60090b53bc0a14314ad0c1f67a9bb64f3f3a0551/tomlkit-0.12.3-py3-none-any.whl (37 kB)
#6 4.075 Collecting shellingham>=1.3.2 (from pdm)
#6 4.105   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
#6 4.171 Collecting python-dotenv>=0.15 (from pdm)
#6 4.202   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/44/2f/62ea1c8b593f4e093cc1a7768f0d46112107e790c3e478532329e434f00b/python_dotenv-1.0.0-py3-none-any.whl (19 kB)
#6 4.258 Collecting resolvelib>=1.0.1 (from pdm)
#6 4.291   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/fc/e9ccf0521607bcd244aa0b3fbd574f71b65e9ce6a112c83af988bbbe2e23/resolvelib-1.0.1-py2.py3-none-any.whl (17 kB)
#6 4.354 Collecting installer<0.8,>=0.7 (from pdm)
#6 4.386   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e5/ca/1172b6638d52f2d6caa2dd262ec4c811ba59eee96d54a7701930726bce18/installer-0.7.0-py3-none-any.whl (453 kB)
#6 4.405      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 453.8/453.8 kB 26.4 MB/s eta 0:00:00
#6 4.463 Collecting cachecontrol[filecache]>=0.13.0 (from pdm)
#6 4.495   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1d/e3/a22348e6226dcd585d5a4b5f0175b3a16dabfd3912cbeb02f321d00e56c7/cachecontrol-0.13.1-py3-none-any.whl (22 kB)
#6 4.551 Collecting truststore (from pdm)
#6 4.583   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/20/56/7811d5439b6a56374f274a8672d8f18b4deadadeb3a9f0c86424b98b6f96/truststore-0.8.0-py3-none-any.whl (16 kB)
#6 4.693 Collecting requests>=2.16.0 (from cachecontrol[filecache]>=0.13.0->pdm)
#6 4.724   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)
#6 4.735      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 6.8 MB/s eta 0:00:00
#6 4.912 Collecting msgpack>=0.5.2 (from cachecontrol[filecache]>=0.13.0->pdm)
#6 4.944   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/df/09/dee50913ba5cc047f7fd7162f09453a676e7935c84b3bf3a398e12108677/msgpack-1.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (557 kB)
#6 4.974      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 558.0/558.0 kB 20.0 MB/s eta 0:00:00
#6 5.045 Collecting filelock>=3.8.0 (from cachecontrol[filecache]>=0.13.0->pdm)
#6 5.077   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/81/54/84d42a0bee35edba99dee7b59a8d4970eccdd44b99fe728ed912106fc781/filelock-3.13.1-py3-none-any.whl (11 kB)
#6 5.194 Collecting markdown-it-py>=2.2.0 (from rich>=12.3.0->pdm)
#6 5.225   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
#6 5.237      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 8.2 MB/s eta 0:00:00
#6 5.334 Collecting pygments<3.0.0,>=2.13.0 (from rich>=12.3.0->pdm)
#6 5.365   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/97/9c/372fef8377a6e340b1704768d20daaded98bf13282b5327beb2e2fe2c7ef/pygments-2.17.2-py3-none-any.whl (1.2 MB)
#6 5.400      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 36.0 MB/s eta 0:00:00
#6 5.500 Collecting distlib<1,>=0.3.7 (from virtualenv>=20->pdm)
#6 5.532   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8e/41/9307e4f5f9976bc8b7fea0b66367734e8faf3ec84bc0d412d8cfabbb66cd/distlib-0.3.8-py2.py3-none-any.whl (468 kB)
#6 5.551      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 29.5 MB/s eta 0:00:00
#6 5.686 Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=12.3.0->pdm)
#6 5.718   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl (10.0 kB)
#6 5.957 Collecting charset-normalizer<4,>=2 (from requests>=2.16.0->cachecontrol[filecache]>=0.13.0->pdm)
#6 5.989   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/40/26/f35951c45070edc957ba40a5b1db3cf60a9dbb1b350c2d5bef03e01e61de/charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
#6 6.002      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3/140.3 kB 13.7 MB/s eta 0:00:00
#6 6.061 Collecting idna<4,>=2.5 (from requests>=2.16.0->cachecontrol[filecache]>=0.13.0->pdm)
#6 6.092   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl (61 kB)
#6 6.103      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 6.5 MB/s eta 0:00:00
#6 6.208 Collecting urllib3<3,>=1.21.1 (from requests>=2.16.0->cachecontrol[filecache]>=0.13.0->pdm)
#6 6.239   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/96/94/c31f58c7a7f470d5665935262ebd7455c7e4c7782eb525658d3dbf4b9403/urllib3-2.1.0-py3-none-any.whl (104 kB)
#6 6.251      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.6/104.6 kB 10.7 MB/s eta 0:00:00
#6 6.512 Installing collected packages: resolvelib, distlib, urllib3, truststore, tomlkit, shellingham, python-dotenv, pyproject-hooks, pygments, platformdirs, packaging, msgpack, mdurl, installer, idna, filelock, charset-normalizer, certifi, blinker, virtualenv, requests, markdown-it-py, findpython, dep-logic, unearth, rich, requests-toolbelt, cachecontrol, pdm
#6 8.965 Successfully installed blinker-1.7.0 cachecontrol-0.13.1 certifi-2023.11.17 charset-normalizer-3.3.2 dep-logic-0.0.4 distlib-0.3.8 filelock-3.13.1 findpython-0.4.1 idna-3.6 installer-0.7.0 markdown-it-py-3.0.0 mdurl-0.1.2 msgpack-1.0.7 packaging-23.2 pdm-2.11.2 platformdirs-4.1.0 pygments-2.17.2 pyproject-hooks-1.0.0 python-dotenv-1.0.0 requests-2.31.0 requests-toolbelt-1.0.0 resolvelib-1.0.1 rich-13.7.0 shellingham-1.5.4 tomlkit-0.12.3 truststore-0.8.0 unearth-0.14.0 urllib3-2.1.0 virtualenv-20.25.0
#6 8.965 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#6 9.225
#6 9.225 [notice] A new release of pip is available: 23.2.1 -> 23.3.2
#6 9.225 [notice] To update, run: pip install --upgrade pip
#6 DONE 9.4s

#7 [ 3/10] RUN pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/
#7 DONE 12.4s

#8 [ 4/10] WORKDIR /app
#8 DONE 0.1s

#9 [ 5/10] COPY pyproject.toml pdm.lock /app/
#9 DONE 0.1s

#10 [ 6/10] RUN  pdm config --local pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/
#10 DONE 0.7s

#11 [ 7/10] RUN cat ./pdm.toml
#11 0.380 [pypi]
#11 0.380 url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
#11 DONE 0.4s

#12 [ 8/10] RUN pdm sync -v
#12 0.936 WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated
#12 0.958 STATUS: Resolving packages from lockfile...
#12 0.959 INFO: python.use_venv is on, creating a virtualenv for this project...
#12 0.994 Run command: ['/usr/local/bin/python', '-m', 'virtualenv', '/app/.venv', '-p', '/usr/local/bin/python', '--prompt=app-3.11', '--no-pip', '--no-setuptools', '--no-wheel']
#12 1.152 created virtual environment CPython3.11.7.final.0-64 in 44ms
#12 1.152   creator CPython3Posix(dest=/app/.venv, clear=False, no_vcs_ignore=False, global=False)
#12 1.152   activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
#12 1.172 Virtualenv is created successfully at /app/.venv
#12 1.312 Synchronizing working set with resolved packages: 54 to add, 0 to update, 0 to remove
#12 1.312
#12 70.10   ✖ Install annotated-types 0.6.0 failed
#12 70.11 pdm.termui: Error occurs:
#12 70.11 Traceback (most recent call last):
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn
#12 70.11     sock = connection.create_connection(
#12 70.11            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
#12 70.11     raise err
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
#12 70.11     sock.connect(sa)
#12 70.11 TimeoutError: timed out
#12 70.11
#12 70.11 The above exception was the direct cause of the following exception:
#12 70.11
#12 70.11 Traceback (most recent call last):
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
#12 70.11     response = self._make_request(
#12 70.11                ^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
#12 70.11     raise new_e
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
#12 70.11     self._validate_conn(conn)
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
#12 70.11     conn.connect()
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 611, in connect
#12 70.11     self.sock = sock = self._new_conn()
#12 70.11                        ^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 212, in _new_conn
#12 70.11     raise ConnectTimeoutError(
#12 70.11 urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7fd779c6f290>, 'Connection to files.pythonhosted.org timed out. (connect timeout=10)')
#12 70.11
#12 70.11 The above exception was the direct cause of the following exception:
#12 70.11
#12 70.11 Traceback (most recent call last):
#12 70.11   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
#12 70.11     resp = conn.urlopen(
#12 70.11            ^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 874, in urlopen
#12 70.11     return self.urlopen(
#12 70.11            ^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 874, in urlopen
#12 70.11     return self.urlopen(
#12 70.11            ^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 874, in urlopen
#12 70.11     return self.urlopen(
#12 70.11            ^^^^^^^^^^^^^
#12 70.11   [Previous line repeated 2 more times]
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
#12 70.11     retries = retries.increment(
#12 70.11               ^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
#12 70.11     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
#12 70.11     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11 urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/28/78/d31230046e58c207284c6b2c4e8d96e6d3cb4e52354721b944d3e1ee4aa5/annotated_types-0.6.0-py3-none-any.whl (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fd779c6f290>, 'Connection to files.pythonhosted.org timed out. (connect timeout=10)'))
#12 70.11
#12 70.11 During handling of the above exception, another exception occurred:
#12 70.11
#12 70.11 Traceback (most recent call last):
#12 70.11   File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
#12 70.11     result = self.fn(*self.args, **self.kwargs)
#12 70.11              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 286, in install_candidate
#12 70.11     self.manager.install(can)
#12 70.11   File "/usr/local/lib/python3.11/site-packages/pdm/installers/manager.py", line 34, in install
#12 70.11     dist_info = installer(str(prepared.build()), self.environment, prepared.direct_url())
#12 70.11                               ^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/pdm/models/candidates.py", line 403, in build
#12 70.11     self.obtain(allow_all=False)
#12 70.11   File "/usr/local/lib/python3.11/site-packages/pdm/models/candidates.py", line 458, in obtain
#12 70.11     self._unpack(validate_hashes=not allow_all)
#12 70.11   File "/usr/local/lib/python3.11/site-packages/pdm/models/candidates.py", line 472, in _unpack
#12 70.11     result = finder.download_and_unpack(
#12 70.11              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/unearth/finder.py", line 413, in download_and_unpack
#12 70.11     file = unpack_link(
#12 70.11            ^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/unearth/preparer.py", line 328, in unpack_link
#12 70.11     with session.get(link.normalized, stream=True) as resp:
#12 70.11          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
#12 70.11     return self.request("GET", url, **kwargs)
#12 70.11            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
#12 70.11     resp = self.send(prep, **send_kwargs)
#12 70.11            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/unearth/session.py", line 147, in send
#12 70.11     return super().send(request, **kwargs)
#12 70.11            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
#12 70.11     r = adapter.send(request, **kwargs)
#12 70.11         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/cachecontrol/adapter.py", line 76, in send
#12 70.11     resp = super().send(request, stream, timeout, verify, cert, proxies)
#12 70.11            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 70.11   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send
#12 70.11     raise ConnectTimeout(e, request=request)
#12 70.11 requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/28/78/d31230046e58c207284c6b2c4e8d96e6d3cb4e52354721b944d3e1ee4aa5/annotated_types-0.6.0-py3-none-any.whl (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fd779c6f290>, 'Connection to files.pythonhosted.org timed out. (connect timeout=10)'))
# Paste the output of `pdm info && pdm info --env` below:

#12 [ 8/11] RUN pdm info && pdm info --env
#12 0.622 INFO: python.use_venv is on, creating a virtualenv for this project...
#12 0.834 Virtualenv is created successfully at /app/.venv
#12 0.879 PDM version:
#12 0.879   2.11.2
#12 0.879 Python Interpreter:
#12 0.879   /app/.venv/bin/python (3.11)
#12 0.880 Project Root:
#12 0.880   /app
#12 0.881 Local Packages:
#12 0.881
#12 1.321 {
#12 1.321   "implementation_name": "cpython",
#12 1.321   "implementation_version": "3.11.7",
#12 1.321   "os_name": "posix",
#12 1.321   "platform_machine": "x86_64",
#12 1.321   "platform_release": "5.15.0-56-generic",
#12 1.321   "platform_system": "Linux",
#12 1.321   "platform_version": "#62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022",
#12 1.321   "python_full_version": "3.11.7",
#12 1.321   "platform_python_implementation": "CPython",
#12 1.321   "python_version": "3.11",
#12 1.321   "sys_platform": "linux"
#12 1.321 }
#12 DONE 1.4s
@ElfenSterben ElfenSterben added the 🐛 bug Something isn't working label Jan 15, 2024
@XYenon
Copy link
Contributor

XYenon commented Jan 16, 2024

I found that index_url and find_links was not to be passed when init the finder, but be added by the add_index_url and add_find_links function.

finder = PDMPackageFinder(
session=session,
target_python=self.target_python,
ignore_compatibility=ignore_compatibility,
no_binary=os.getenv("PDM_NO_BINARY", "").split(","),
only_binary=os.getenv("PDM_ONLY_BINARY", "").split(","),
prefer_binary=os.getenv("PDM_PREFER_BINARY", "").split(","),
respect_source_order=self.project.pyproject.settings.get("resolution", {}).get(
"respect-source-order", False
),
verbosity=self.project.core.ui.verbosity,
minimal_version=minimal_version,
)
for source in sources:
assert source.url
if source.type == "find_links":
finder.add_find_links(source.url)
else:
finder.add_index_url(source.url)

But if index_url and find_links are all empty when init the finder, then the default https://pypi.org/simple/ will be added as the first index_url. So it will always try https://pypi.org/simple/ first.

class PDMPackageFinder(unearth.PackageFinder):
def __init__(
self,
session: PyPISession | None = None,
*,
minimal_version: bool = False,
**kwargs: Any,
) -> None:
self.minimal_version = minimal_version
super().__init__(session, **kwargs)

https://github.com/frostming/unearth/blob/cb500ccea19e73c243266661089896b66b4105cd/src/unearth/finder.py#L92-L99

@frostming
Copy link
Collaborator

@XYenon good catch

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.

3 participants