Installieren Sie das Python -Paket aus der ZIP -Datei offline
Posted: 05 Sep 2025, 02:23
Ich arbeite im Kaggle Notebook. Ich muss das Transformers -Paket offline installieren. Normalerweise würde ich es so installieren (online): < /p>
!pip install git+https://github.com/huggingface/transformers
< /code>
Hier ist, was ich getan habe, um dasselbe zu erreichen, aber offline.!pip freeze > requirements_b.txt
!pip install git+https://github.com/huggingface/transformers
!pip freeze > requirements_a.txt
< /code>
Der Unterschied zwischen ihnen beträgt < /p>
huggingface-hub==0.34.4
git+https://github.com/huggingface/transfor ... 36b6800a3c
tokenizers==0.22.0
< /code>
Ich habe die obigen Pakete lokal mit < /p>
heruntergeladen.!pip download huggingface-hub==0.34.4 tokenizers==0.22.0 -d ./wheels --verbose
!pip download git+https://github.com/huggingface/transformers -d ./wheels
< /code>
I Factory Reset Kernel und versuchte, alles offline zu installieren: < /p>
!pip install huggingface-hub==0.34.4 tokenizers==0.22.0 \
-U --no-index --find-links /kaggle/working/wheels
< /code>
, aber der folgende Befehl generierte Fehler: < /p>
!pip install wheels/transformers-4.57.0.dev0.zip --verbose
< /code>
Fehlermeldung: < /p>
Using pip 24.1.2 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
Processing ./wheels/transformers-4.57.0.dev0.zip
Running command pip subprocess to install build dependencies
Using pip 24.1.2 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
Non-user install by explicit request
Created build tracker: /tmp/pip-build-tracker-9vzem4u4
Entered build tracker: /tmp/pip-build-tracker-9vzem4u4
Created temporary directory: /tmp/pip-install-5g1aenu5
Created temporary directory: /tmp/pip-ephem-wheel-cache-bnhq0fx_
1 location(s) to search for versions of setuptools:
* https://pypi.org/simple/setuptools/
Fetching project page and analyzing links: https://pypi.org/simple/setuptools/
Getting page https://pypi.org/simple/setuptools/
Found index url https://pypi.org/simple/
Looking up "https://pypi.org/simple/setuptools/" in the cache
Request header has "max_age" as 0, cache bypassed
No cache entry available
Starting new HTTPS connection (1): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('
: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (2): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (3): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (4): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (5): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (6): pypi.org:443
Could not fetch URL https://pypi.org/simple/setuptools/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) - skipping
Skipping link: not a file: https://pypi.org/simple/setuptools/
Given no hashes to check 0 links for project 'setuptools': discarding no candidates
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 174, in _add_to_criteria
raise RequirementsConflicted(criterion)
pip._vendor.resolvelib.resolvers.RequirementsConflicted: Requirements conflict: SpecifierRequirement('setuptools>=40.8.0')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 399, in resolve
raise ResolutionImpossible(e.criterion.information)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('setuptools>=40.8.0'), parent=None)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/cli/base_command.py", line 179, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/commands/install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 104, in resolve
raise error from e
pip._internal.exceptions.DistributionNotFound: No matching distribution found for setuptools>=40.8.0
Removed build tracker: '/tmp/pip-build-tracker-9vzem4u4'
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.
full command: /usr/bin/python3 /usr/local/lib/python3.11/dist-packages/pip/__pip-runner__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-3nmv0d45/overlay --no-warn-script-location -vv --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0'
cwd: [inherit]
Installing build dependencies ... error
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.
< /code>
Es sieht so aus, als würde es versuchen, eine Verbindung zum Internet herzustellen. Gibt es eine Möglichkeit, es zu lösen?
!pip install git+https://github.com/huggingface/transformers
< /code>
Hier ist, was ich getan habe, um dasselbe zu erreichen, aber offline.!pip freeze > requirements_b.txt
!pip install git+https://github.com/huggingface/transformers
!pip freeze > requirements_a.txt
< /code>
Der Unterschied zwischen ihnen beträgt < /p>
huggingface-hub==0.34.4
git+https://github.com/huggingface/transfor ... 36b6800a3c
tokenizers==0.22.0
< /code>
Ich habe die obigen Pakete lokal mit < /p>
heruntergeladen.!pip download huggingface-hub==0.34.4 tokenizers==0.22.0 -d ./wheels --verbose
!pip download git+https://github.com/huggingface/transformers -d ./wheels
< /code>
I Factory Reset Kernel und versuchte, alles offline zu installieren: < /p>
!pip install huggingface-hub==0.34.4 tokenizers==0.22.0 \
-U --no-index --find-links /kaggle/working/wheels
< /code>
, aber der folgende Befehl generierte Fehler: < /p>
!pip install wheels/transformers-4.57.0.dev0.zip --verbose
< /code>
Fehlermeldung: < /p>
Using pip 24.1.2 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
Processing ./wheels/transformers-4.57.0.dev0.zip
Running command pip subprocess to install build dependencies
Using pip 24.1.2 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
Non-user install by explicit request
Created build tracker: /tmp/pip-build-tracker-9vzem4u4
Entered build tracker: /tmp/pip-build-tracker-9vzem4u4
Created temporary directory: /tmp/pip-install-5g1aenu5
Created temporary directory: /tmp/pip-ephem-wheel-cache-bnhq0fx_
1 location(s) to search for versions of setuptools:
* https://pypi.org/simple/setuptools/
Fetching project page and analyzing links: https://pypi.org/simple/setuptools/
Getting page https://pypi.org/simple/setuptools/
Found index url https://pypi.org/simple/
Looking up "https://pypi.org/simple/setuptools/" in the cache
Request header has "max_age" as 0, cache bypassed
No cache entry available
Starting new HTTPS connection (1): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('
: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (2): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (3): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (4): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (5): pypi.org:443
Incremented Retry for (url='/simple/setuptools/'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
Starting new HTTPS connection (6): pypi.org:443
Could not fetch URL https://pypi.org/simple/setuptools/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) - skipping
Skipping link: not a file: https://pypi.org/simple/setuptools/
Given no hashes to check 0 links for project 'setuptools': discarding no candidates
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 174, in _add_to_criteria
raise RequirementsConflicted(criterion)
pip._vendor.resolvelib.resolvers.RequirementsConflicted: Requirements conflict: SpecifierRequirement('setuptools>=40.8.0')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 399, in resolve
raise ResolutionImpossible(e.criterion.information)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('setuptools>=40.8.0'), parent=None)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/cli/base_command.py", line 179, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/commands/install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 104, in resolve
raise error from e
pip._internal.exceptions.DistributionNotFound: No matching distribution found for setuptools>=40.8.0
Removed build tracker: '/tmp/pip-build-tracker-9vzem4u4'
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.
full command: /usr/bin/python3 /usr/local/lib/python3.11/dist-packages/pip/__pip-runner__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-3nmv0d45/overlay --no-warn-script-location -vv --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0'
cwd: [inherit]
Installing build dependencies ... error
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.
< /code>
Es sieht so aus, als würde es versuchen, eine Verbindung zum Internet herzustellen. Gibt es eine Möglichkeit, es zu lösen?