-
-
Notifications
You must be signed in to change notification settings - Fork 361
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 can't install packages offline #2846
Comments
To solve this, you can add BTW, |
@frostming, thank you for the quick response. Lightning fast bug fix on Is it intended behavior for NotesAdding $ pdm venv create --with-pip
Virtualenv C:\Users\xxx\xxx\.venv is created successfully
INFO: Virtualenv C:\Users\xxx\xxx\.venv is reused.
$ pdm run pip install -r .packages/requirements.txt --no-index -f .packages
Looking in links: .packages
Processing ...
Installing collected packages: ...
Successfully installed ...
$ pdm run pip install -e .
Looking in indexes: https://xxx:****@xxx.xxx.xxx.xxx/repository/pypi-proxy/simple/
Obtaining file:///C:/Users/xxx/xxx
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Looking in indexes: https://xxx:****@xxx.xxx.xxx.xxx/repository/pypi-proxy/simple/
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 0x0000016E815A1EE0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-proxy/simple/pdm-backend/
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 0x0000016E81608920>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-proxy/simple/pdm-backend/
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 0x0000016E81608B60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-proxy/simple/pdm-backend/
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 0x0000016E81608D70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-proxy/simple/pdm-backend/
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 0x0000016E81608F80>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-proxy/simple/pdm-backend/
ERROR: Could not find a version that satisfies the requirement pdm-backend (from versions: none)
ERROR: No matching distribution found for pdm-backend
[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. I tried using C:\Users\xxx\xxx(dev -> origin)
λ pdm install -v --no-isolation
STATUS: Resolving packages from lockfile...
unearth.preparer: The file . is a local directory, use it directly
pdm.termui: Running PEP 517 backend to get metadata for <Link file:///C:/Users/xxx/xxx (from None)>
pdm.termui: Preparing environment(Non-isolated mode) for PEP 517 build...
pdm.termui: ======== Start resolving requirements ========
pdm.termui: editables
pdm.termui: python==3.12.2
pdm.termui: Adding requirement editables
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\pdm\Bin\pdm.exe\__main__.py", line 7, in <module>
File "C:\pdm\Lib\site-packages\pdm\core.py", line 358, in main
return core.main(args or sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\core.py", line 276, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "C:\pdm\Lib\site-packages\pdm\core.py", line 271, in main
self.handle(project, options)
File "C:\pdm\Lib\site-packages\pdm\core.py", line 207, in handle
command.handle(project, options)
File "C:\pdm\Lib\site-packages\pdm\cli\commands\install.py", line 100, in handle
actions.do_sync(
File "C:\pdm\Lib\site-packages\pdm\cli\actions.py", line 238, in do_sync
synchronizer.synchronize()
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 395, in synchronize
to_add, to_update, to_remove = self.compare_with_working_set()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 215, in compare_with_working_set
candidates = self.candidates.copy()
^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\functools.py", line 995, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 151, in candidates
if self.should_install_editables():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 169, in should_install_editables
metadata = self.self_candidate.prepare(self.environment).metadata
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\functools.py", line 995, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 139, in self_candidate
return self.environment.project.make_self_candidate(not self.no_editable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\project\core.py", line 521, in make_self_candidate
can.prepare(self.environment).metadata
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 610, in metadata
result = self.prepare_metadata()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 514, in prepare_metadata
return self._get_metadata_from_build(self._unpacked_dir, metadata_parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 592, in _get_metadata_from_build
self._metadata_dir = builder(source_dir, self.environment).prepare_metadata(metadata_parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\builders\editable.py", line 24, in prepare_metadata
self.install(requires)
File "C:\pdm\Lib\site-packages\pdm\builders\base.py", line 296, in install
install_requirements(missing, env)
File "C:\pdm\Lib\site-packages\pdm\installers\core.py", line 28, in install_requirements
resolved, _ = resolve(resolver, reqs, environment.python_requires, max_rounds=resolve_max_rounds, keep_self=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\resolver\core.py", line 39, in resolve
result = resolver.resolve(requirements, max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\pdm\Lib\site-packages\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\resolvelib\structs.py", line 127, in __bool__
next(iter(self))
^^^^^^^^^^
File "C:\pdm\Lib\site-packages\resolvelib\structs.py", line 136, in __iter__
self._factory() if self._iterable is None else self._iterable
^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\resolver\providers.py", line 226, in matches_gen
candidates = self._find_candidates(reqs[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\resolver\providers.py", line 196, in _find_candidates
return self.repository.find_candidates(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\repositories.py", line 174, in find_candidates
cans = LazySequence(self._find_candidates(requirement, minimal_version=minimal_version))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\repositories.py", line 436, in _find_candidates
for c in finder.find_all_packages(requirement.project_name, allow_yanked=requirement.is_pinned)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\finder.py", line 310, in find_all_packages
self._find_packages(package_name, allow_yanked), hashes=hashes or {}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\finder.py", line 290, in _find_packages
return sorted(all_packages, key=self._sort_key, reverse=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 178, in collect_links_from_location
yield from _collect_links_from_index(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 198, in _collect_links_from_index
page = fetch_page(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 185, in fetch_page
resp = _get_html_response(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 220, in _get_html_response
resp = session.get(
^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 1054, in get
return self.request(
^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 914, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\hishel\_sync\_transports.py", line 197, in handle_request
regular_response = self._transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "C:\Program Files\Python312\Lib\contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 11001] getaddrinfo failed |
@SealedServant did you set the index to the local path, which is similar to |
Is there a way to call [[tool.pdm.source]]
name = "local"
url = "./packages"
type = "find_links" |
You can use the file url: [[tool.pdm.source]]
name = "local"
url = "file:///path/to/packages"
type = "find_links" |
Thanks @frostming, I will try this out on Monday and report back the results here. Will file URL work with relative path like so? [[tool.pdm.source]]
name = "local"
url = "file:///.packages"
type = "find_links" I have a private pypi repo set up in [[tool.pdm.source]]
name = "pypi"
url = "https://our.pypi.mirror"
verify_ssl = true
include_package = ["*"] Some comments: I think the I made a [tool.pdm.scripts]
download = { shell = """
mkdir .packages \
pdm export -o .packages/requirements.txt --no-hashes --no-markers \
pdm run pip wheel -r .packages/requirements.txt -w .packages
""" } I envision a Ultimately, I think the best approach would be if we could just move the entire project directory, which is the intent of the user. However, too many tools such as |
[[tool.pdm.source]]
name = "local"
url = "file:///${PROJECT_ROOT}/.packages"
type = "find_links" Running Also seeing this when downloading the packages:
|
Stick to absolute paths for now
Where does this come from, neither |
Closed by dfa6a8d |
It looks like it is being emitted by
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
# ...
[tool.pdm]
distribution = true
[[tool.pdm.source]]
name = "pypi"
url = "https://${USERNAME}:${PASSWORD}@xxx.xxx.xxx/repository/pypi-proxy/simple/"
verify_ssl = true
include_packages = ["*"]
[[tool.pdm.source]]
name = "local"
url = "file:///${PROJECT_ROOT}/.packages" # do I need to set this env var manually or does PDM know this is my project?
type = "find_links" Installation offline fail with following message:
|
it makes no sense to me either. by no means pip reads the config under tool.pdm |
Found this: https://stackoverflow.com/questions/43046544/unusual-error-while-installing-any-pip-based-package I think I know why, the # This file is @generated by PDM.
# Please do not edit it manually.
-----(truncated)-----
ghp-import==2.1.0
griffe==0.44.0
httpx==0.27.0
identify==2.5.36
mypy-extensions==1.0.0
nodeenv==1.8.0
-----(truncated)-----
pywin32==306; sys_platform == "win32"
-----(truncated)-----
text-unidecode==1.3
tomlkit==0.12.4
types-python-dateutil==2.9.0.20240316
watchfiles==0.21.0
wcwidth==0.2.13
websockets==12.0
zipp==3.18.1
--index-url https://${USERNAME}:${PASSWORD}@xxx.xxx.xxx/repository/pypi-proxy/simple/
--find-links file:///${PROJECT_ROOT}/.packages |
fine. it makes sense. now no need to complain anymore and try the main branch with pdm-download |
Sorry @frostming. I really like I tried the main branch and I tried coding the absolute path to the I am not sure why, but I appears that pdm is not attempting to resolve the additional sources in the unearth.collector: Collecting links from https://***@***.***.***.***/repository/pypi-proxy/simple/setuptools/
unearth.auth: Found credentials in url for ***.***.***.***
pdm.termui: Error occurs
Traceback (most recent call last):
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 69, in map_httpcore_exceptions
yield
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 233, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpcore\_sync\connection_pool.py", line 216, in handle_request
raise exc from None
File "C:\pdm\Lib\site-packages\httpcore\_sync\connection_pool.py", line 196, in handle_request
response = connection.handle_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpcore\_sync\connection.py", line 99, in handle_request
raise exc
File "C:\pdm\Lib\site-packages\httpcore\_sync\connection.py", line 76, in handle_request
stream = self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpcore\_sync\connection.py", line 122, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpcore\_backends\sync.py", line 205, in connect_tcp
with map_exceptions(exc_map):
File "C:\Program Files\Python312\Lib\contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "C:\pdm\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 11001] getaddrinfo failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\pdm\Lib\site-packages\pdm\termui.py", line 257, in logging
yield logger
File "C:\pdm\Lib\site-packages\pdm\cli\actions.py", line 238, in do_sync
synchronizer.synchronize()
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 445, in synchronize
handlers[kind](key, progress)
File "C:\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 282, in install_candidate
self.manager.install(can)
File "C:\pdm\Lib\site-packages\pdm\installers\manager.py", line 33, in install
prepared.build(),
^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 402, in build
self._obtain(allow_all=False)
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 438, in _obtain
self.link = _find_best_match_link(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 105, in _find_best_match_link
found = attempt_to_find()
^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\pdm\models\candidates.py", line 96, in attempt_to_find
best = finder.find_best_match(req.as_line(), hashes=hashes).best
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\finder.py", line 391, in find_best_match
best_match = next(iter(applicable_candidates), None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\finder.py", line 324, in _find_packages_from_requirement
yield from self._find_packages(requirement.name, allow_yanked)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\finder.py", line 290, in _find_packages
return sorted(all_packages, key=self._sort_key, reverse=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 178, in collect_links_from_location
yield from _collect_links_from_index(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 198, in _collect_links_from_index
page = fetch_page(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 185, in fetch_page
resp = _get_html_response(session, location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\unearth\collector.py", line 220, in _get_html_response
resp = session.get(
^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 1054, in get
return self.request(
^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 914, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\hishel\_sync\_transports.py", line 197, in handle_request
regular_response = self._transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "C:\Program Files\Python312\Lib\contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "C:\pdm\Lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 11001] getaddrinfo failed
|
you need to completely ban pypi offline by setting the name of the local source to "pypi" instead of "local" |
@frostming, thank you for all the support. I was finally able to get everything to work seamlessly. I want to take some notes here for other users who might find this in the future. It would be nice if the documentation could have notes on using PDM offline, maybe in the advanced usage section. Full permission granted to copy/paste/modify this for PDM documentation. Use PDM in Offline EnvironmentsPrerequisitesYou must ensure that your build dependencies are in your For example, if you are using [build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend" then the following dependencies are required to use [tool.pdm.dev-dependencies]
build = ["editables>=0.5", "pdm-backend>=2.3.0"] Download the DependenciesOn an online system, ensure the PDM project is initialized normally: pdm install Make a directory mkdir .packages Export the dependencies to pdm export --format requirements --output .packages/.requirements.txt --no-hashes --no-markers Download the dependency wheels into the directory: pdm run pip wheel --requirement .packages/.requirements.txt --wheel-dir .packages Download PDMOn an online system, create a virtual environment to install python -m venv .pdm Activate the virtual environment with the platform-specific script located in pip install pdm Make a directory mkdir .pdm-packages Export the dependencies to pip freeze > .pdm-packages/.requirements.txt Download the pip wheel --requirement .pdm-packages/.requirements.txt --wheel-dir .pdm-packages Optionally, perform a
git clean -fdx --exclude .packages --exclude .pdm-packages Install PDMOn the offline system, install With your virtual environment activated, install the packages from pip install -r .pdm-packages/.requirements.txt --no-index --find-links .pdm-packages Once Install the DependenciesOn the offline system, ensure that In the project directory you have transferred, make sure that pdm run python -m ensurepip --default-pip Install the dependencies: pdm run pip install -r .packages/.requirements.txt --no-index --find-links .packages Check the project file for changes, update the lock file if needed, sync with the lock file, and install the project as editable: pdm install --no-isolation |
Make sure you run commands with
-v
flag before pasting the output.Steps to reproduce
With the system online, initialize the project like normal to pull in all the packages.
Install
pdm-download
plugin and attempt to use it to download the packages for offline installation:That didn't work, so let's export the
requirements.txt
.Now download with pip instead
For some reason the package
paginate
does not download as a wheel, so we runpip wheel
to make sure all packages are built as wheels to install (otherwise installing with pip later will fail)Now we've got all the packages for offline. To simulate transferring to offline system, disconnect the internet.
Clean up the irrelevant directories since we need to remake them on the offline system.
Go to install the packages and recreate the venv on the offline system.
Try again, but just make the venv manually and include pip so that pip can install the packages.
Whew, okay, we were able to manually create the venv and get the packages installed with pip. PDM should be able to handle the rest.
I should be able to run
pdm install
now and it will detect that we are offline and that the packages from the lockfile are already installed in the virtual environment. We need it to still install my project as an editable dependency.No dice. I really need to be able to install the project as editable.
pip
cannot do it because it fails to findpdm-backend
since we are offline.Let's try
pdm lock --check
orpdm sync
instead.Bummer. Maybe
pdm fix
?Actual behavior
Try to use
pdm
commands offline but most of them fail.Expected behavior
I expected:
pdm-download
to workpdm
to be able to automatically install packages it finds in the.packages
folder without an internet connectionpdm
to be able to automatically detect packages already installed manually into the virtual environment and install the project as editable like it normally would with an internet connectionEnvironment Information
The text was updated successfully, but these errors were encountered: