bazelbuild/rules_python

pypi__installer error writing entrypoints: FileExistsError: File already exists

UebelAndre opened this issue ยท 1 comments

๐Ÿž bug report

Affected Rule

pip_parse

Is this a regression?

Surely at some point but have yet to bisect

Description

Some dependencies cause failures when rendering wheels making pip_parse unusable with them.

๐Ÿ”ฌ Minimal Reproduction

With the files listed below, run:

bazel run //:requirements.update
bazel build //...

WORKSPACE.bazel

workspace(name = "entrypoints")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
    strip_prefix = "rules_python-0.27.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
    name = "pip_deps",
    requirements_lock = "//:requirements.txt",
)

load("@pip_deps//:requirements.bzl", "install_deps")

install_deps()

BUILD.bazel

load("@pip_deps//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_library")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

compile_pip_requirements(
    name = "requirements",
    requirements_in = "requirements.in",
    requirements_txt = "requirements.txt",
)

py_library(
    name = "bad",
    srcs = [],
    deps = [requirement("jupyter-contrib-nbextensions")],
)

.bazelrc

# I don't know bzlmod so going old-school
common --noenable_bzlmod

requirements.in

jupyter-contrib-nbextensions==0.5.1

requirements.txt

#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    bazel run //:requirements.update
#

๐Ÿ”ฅ Exception or Error


ERROR: /private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/pip_deps/jupyter_contrib_nbextensions/BUILD.bazel:8:6: @@pip_deps//jupyter_contrib_nbextensions:pkg depends on @@pip_deps_jupyter_contrib_nbextensions//:pkg in repository @@pip_deps_jupyter_contrib_nbextensions which failed to fetch. no such package '@@pip_deps_jupyter_contrib_nbextensions//': whl_library pip_deps_jupyter_contrib_nbextensions failed:  (Traceback (most recent call last):
  File "", line 198, in _run_module_as_main
  File "", line 88, in _run_code
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 207, in 
    main()
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 163, in main
    _extract_wheel(
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/rules_python/python/pip_install/tools/wheel_installer/wheel_installer.py", line 123, in _extract_wheel
    whl.unzip(installation_dir)
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/rules_python/python/pip_install/tools/wheel_installer/wheel.py", line 105, in unzip
    installer.install(
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
           ^^^^^^^^^^^^^^^^^
  File "/private/var/tmp/_bazel_user/2a35cccdc05cbec59a6acf085a26daa2/external/pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/jupyter-contrib-nbextension
) error code: '1'

๐ŸŒ Your Environment

Operating System:

  
Linux, MacOS
  

Output of bazel version:

  
7.0.0
  

Rules_python version:

  
0.27.1
  

Anything else relevant?