If you have a local .whl file in the workspace, you can add it to the requirements.txt file like so:
./path/to/wheel.whl
file:path/to/wheel.whl
Presently, this results in an error when attempting fetch the wheels, since pip is not running in the workspace root:
Traceback (most recent call last): File "<snip>/external/pypi__pip/pip/_internal/cli/base_command.py", line 153, in _main status = self.run(options, args) File "<snip>/external/pypi__pip/pip/_internal/commands/wheel.py", line 158, in run resolver.resolve(requirement_set) File "<snip>/external/pypi__pip/pip/_internal/legacy_resolve.py", line 201, in resolve self._resolve_one(requirement_set, req) File "<snip>/external/pypi__pip/pip/_internal/legacy_resolve.py", line 365, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "<snip>/external/pypi__pip/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for req, self.session, self.finder, self.require_hashes File "<snip>/external/pypi__pip/pip/_internal/operations/prepare.py", line 194, in prepare_linked_requirement progress_bar=self.progress_bar File "<snip>/external/pypi__pip/pip/_internal/download.py", line 452, in unpack_url unpack_file_url(link, location, download_dir, hashes=hashes) File "<snip>/external/pypi__pip/pip/_internal/download.py", line 398, in unpack_file_url hashes.check_against_path(link_path) File "<snip>/external/pypi__pip/pip/_internal/utils/hashes.py", line 104, in check_against_path with open(path, 'rb') as file: FileNotFoundError: [Errno 2] No such file or directory: '<snip>/<snip>-py3-none-any.whl' Traceback (most recent call last): File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "<snip>/external/rules_python/python/pip_install/extract_wheels/__main__.py", line 5, in <module> main() File "<snip>/external/rules_python/python/pip_install/extract_wheels/__init__.py", line 87, in main subprocess.run(pip_args, check=True) File "/usr/local/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['/usr/bin/python3.7', '-m', 'pip', 'wheel', '-r', '<snip>/requirements.txt']' returned non-zero exit status 2.
🚀 feature request
Relevant Rules
pip_installDescription
If you have a local .whl file in the workspace, you can add it to the requirements.txt file like so:
Presently, this results in an error when attempting fetch the wheels, since pip is not running in the workspace root:
Describe the solution you'd like
The
extract_wheelsscript could convert relative wheel paths to absolute wheel paths prior to runningpip wheel. It already has the full path to the requirements.txt file, so would just snip off the end and replace with relative path provided in requirements.txt.Describe alternatives you've considered
whl_library, but this is not recommended and does not load dependencies of the local wheel.