установка пакета pip на ПК, отключенном от интернета
Есть пакет pip в формате pyproject.toml, который я пытаюсь установить на машине отключенной от интернета:
./foo
├── pyproject.toml
└── src
└── foo
└── __init__.py
pyproject.toml:
#
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0", "wheel>=0.37.1"]
[project]
name = "foo"
version = "1.0"
[tool.setuptools.packages.find]
namespaces = false
where = [ "src" ]
__init__.py :
#!python
def foo():
return 42
Нужные пакеты на машине стоят:
~/test_env/bin/python -m pip list
...
setuptools 68.2.2
wheel 0.41.3
...
При попытке установки получаю ошибку:
[buildbot@cwb-test-rh8-01 tmp]$ ~/test_env/bin/python -m pip install ./foo
Processing ./foo
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f557c4bc940>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f557c4bcc40>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f557c4bcee0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f557c4bcfa0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f557c466250>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
ERROR: Could not find a version that satisfies the requirement setuptools>=61.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=61.0
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Если разрешаю обращаться к интернету, (через export https_proxy=...), то пакет успешно устанавливается, хотя setuptools и wheel при этом не обновляет.
Флаги pip --no-index --no-deps не меняют поведения.
Ответы (1 шт):
Флаг pip --no-build-isolation позволяет работать в изолированном режиме, хотя из названия флага кажется что наоборот.
Флаг может применяться как для установки, так и для сборки .whl файла:
python -m pip install ./foo --no-build-isolation
python -m pip wheel ./foo --no-build-isolation