Skip to content
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

pypi__installer error writing entrypoints: FileExistsError: File already exists #1659

Closed
UebelAndre opened this issue Dec 28, 2023 · 4 comments

Comments

@UebelAndre
Copy link
Contributor

🐞 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?

@nickbreen
Copy link

Same error using a bzlmod installation too.

Bazel version: 7.1.2

#MODULE.bazel
module(
    name = "aws",
    version = "0.0.0",
)

bazel_dep(name = "rules_python", version = "0.32.2")

python = use_extension("@rules_python//extensions:python.bzl", "python")
python.toolchain(
    name = "python",
    is_default = True,
    python_version = "3.11",
)
use_repo(python, "python_toolchains")

register_toolchains("@python_toolchains//:all")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    hub_name = "awsebcli",
    python_version = "3.11",
    requirements_lock = "//:requirements.txt",
)
use_repo(pip, "awsebcli")
#requirements.txt
awsebcli
bazel build @awsebcli//...

or

bazel run @awsebcli//awsebcli:awsebcli
#output
nick@walnut:~/src/api$ bazel build @awsebcli//awsebcli
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=372
INFO: Reading rc options for 'build' from /home/nick/.bazelrc:
  Inherited 'common' options: --announce_rc
INFO: Repository rules_python~~pip~awsebcli_311_awsebcli instantiated at:
  <builtin>: in <toplevel>
Repository rule whl_library defined at:
  /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/pip_repository.bzl:1024:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'rules_python~~pip~awsebcli_311_awsebcli':
   Traceback (most recent call last):
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/pip_repository.bzl", line 874, column 31, in _whl_library_impl
                repo_utils.execute_checked(
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/private/repo_utils.bzl", line 145, column 29, in _execute_checked
                return _execute_internal(fail_on_error = True, *args, **kwargs)
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/private/repo_utils.bzl", line 86, column 13, in _execute_internal
                fail((
Error in fail: repo.execute: whl_library.ExtractWheel(rules_python~~pip~awsebcli_311_awsebcli, /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl): end: failure:
  command: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/python -m python.pip_install.tools.wheel_installer.wheel_installer --requirement awsebcli --isolated --extra_pip_args "{\"arg\":[]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}" --whl-file /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl
  return code: 1
  working dir: <default: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli>
  timeout: 600
  environment:
PYTHONPATH="/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__build:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__click:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__colorama:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__more_itertools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__packaging:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pep517:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip_tools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__setuptools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__tomli:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__wheel:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/include/python3.11"
<stdout empty>
===== stderr start =====
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 160, in main
    _extract_wheel(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 121, in _extract_wheel
    whl.unzip(installation_dir)
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel.py", line 637, in unzip
    installer.install(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
           ^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/eb
===== stderr end =====
ERROR: <builtin>: fetching whl_library rule //:rules_python~~pip~awsebcli_311_awsebcli: Traceback (most recent call last):
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/pip_repository.bzl", line 874, column 31, in _whl_library_impl
                repo_utils.execute_checked(
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/private/repo_utils.bzl", line 145, column 29, in _execute_checked
                return _execute_internal(fail_on_error = True, *args, **kwargs)
        File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/private/repo_utils.bzl", line 86, column 13, in _execute_internal
                fail((
Error in fail: repo.execute: whl_library.ExtractWheel(rules_python~~pip~awsebcli_311_awsebcli, /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl): end: failure:
  command: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/python -m python.pip_install.tools.wheel_installer.wheel_installer --requirement awsebcli --isolated --extra_pip_args "{\"arg\":[]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}" --whl-file /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl
  return code: 1
  working dir: <default: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli>
  timeout: 600
  environment:
PYTHONPATH="/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__build:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__click:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__colorama:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__more_itertools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__packaging:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pep517:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip_tools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__setuptools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__tomli:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__wheel:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/include/python3.11"
<stdout empty>
===== stderr start =====
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 160, in main
    _extract_wheel(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 121, in _extract_wheel
    whl.unzip(installation_dir)
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel.py", line 637, in unzip
    installer.install(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
           ^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/eb
===== stderr end =====
ERROR: no such package '@@rules_python~~pip~awsebcli_311_awsebcli//': repo.execute: whl_library.ExtractWheel(rules_python~~pip~awsebcli_311_awsebcli, /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl): end: failure:
  command: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/python -m python.pip_install.tools.wheel_installer.wheel_installer --requirement awsebcli --isolated --extra_pip_args "{\"arg\":[]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}" --whl-file /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl
  return code: 1
  working dir: <default: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli>
  timeout: 600
  environment:
PYTHONPATH="/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__build:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__click:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__colorama:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__more_itertools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__packaging:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pep517:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip_tools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__setuptools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__tomli:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__wheel:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/include/python3.11"
<stdout empty>
===== stderr start =====
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 160, in main
    _extract_wheel(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 121, in _extract_wheel
    whl.unzip(installation_dir)
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel.py", line 637, in unzip
    installer.install(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
           ^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/eb
===== stderr end =====
ERROR: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli/awsebcli/BUILD.bazel:10:6: @@rules_python~~pip~awsebcli//awsebcli:pkg depends on @@rules_python~~pip~awsebcli_311_awsebcli//:pkg in repository @@rules_python~~pip~awsebcli_311_awsebcli which failed to fetch. no such package '@@rules_python~~pip~awsebcli_311_awsebcli//': repo.execute: whl_library.ExtractWheel(rules_python~~pip~awsebcli_311_awsebcli, /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl): end: failure:
  command: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/python -m python.pip_install.tools.wheel_installer.wheel_installer --requirement awsebcli --isolated --extra_pip_args "{\"arg\":[]}" --pip_data_exclude "{\"arg\":[]}" --environment "{\"arg\":{}}" --whl-file /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli/awsebcli-3.20.10-py3-none-any.whl
  return code: 1
  working dir: <default: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli>
  timeout: 600
  environment:
PYTHONPATH="/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__build:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__click:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__colorama:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__more_itertools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__packaging:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pep517:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip_tools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__setuptools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__tomli:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__wheel:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/include/python3.11"
<stdout empty>
===== stderr start =====
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 160, in main
    _extract_wheel(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 121, in _extract_wheel
    whl.unzip(installation_dir)
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel.py", line 637, in unzip
    installer.install(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
           ^^^^^^^^^^^^^^^^^
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/eb
===== stderr end =====
ERROR: Analysis of target '@@rules_python~~pip~awsebcli//awsebcli:awsebcli' failed; build aborted: Analysis failed
INFO: Elapsed time: 1.003s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
nick@walnut:~/src/api$ code: 1
  working dir: <default: /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~pip~awsebcli_311_awsebcli>
  timeout: 600
  environment:
PYTHONPATH="/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__build:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__click:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__colorama:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__importlib_metadata:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__installer:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__more_itertools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__packaging:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pep517:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pip_tools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__pyproject_hooks:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__setuptools:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__tomli:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__wheel:/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~internal_deps~pypi__zipp"
CPPFLAGS="-isystem /home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~~python2~python_3_11_host/include/python3.11"
<stdout empty>
===== stderr start =====
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 205, in <module>
    main()
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 160, in main
    _extract_wheel(
  File "/home/nick/.cache/bazel/_bazel_nick/262edbc3edec9cf736bf598752259bf0/external/rules_python~/python/pip_install/tools/wheel_installer/wheel_installer.py", line 121, in _extract_wheel
    whl.unzip(installation_dir)

@aignas
Copy link
Collaborator

aignas commented Jul 23, 2024

I think we should probably stop writing/installing entry points as we have a py_console_script_binary alternative. Is anyone depending on using the entrypoints?

@groodt
Copy link
Collaborator

groodt commented Jul 23, 2024

Agree. I actually meant to do this the other day. You do need it to grab scripts however...

I think as a temporary workaround, this issue can be fixed upstream or the wheel patched. I believe it will fail outside bazel too.

@groodt
Copy link
Collaborator

groodt commented Sep 21, 2024

Closing this issue for the following reasons:

  • The root cause of the issue is in the upstream packages. installer is a standards compliant installer and is what rules_python is using under the covers
  • This is not a high-priority issue because the number of packages where this issue occurs is increasingly rare
  • Maintainers have higher-priority issues to tackle
  • Workarounds for the issues have been provided. See below.

Summary

The jupyter-contrib-nbextensions issue has been fixed in the latest version. The issue with awsebcli still remains, but can be installed with a workaround.

jupyter-contrib-nbextensions==0.5.1

This is an old and poorly packaged wheel. It fails to install outside bazel using installer.

⋊> /v/f/6/j/T .venv/bin/python3 -m installer jupyter_contrib_nbextensions-0.5.1-py2.py3-none-any.whl                                                                                                                                        
Traceback (most recent call last):
  File "/Users/groodt/.pyenv/versions/3.9.16/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/groodt/.pyenv/versions/3.9.16/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/lib/python3.9/site-packages/installer/__main__.py", line 98, in <module>
    _main(sys.argv[1:], "python -m installer")
  File "/private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/lib/python3.9/site-packages/installer/__main__.py", line 94, in _main
    installer.install(source, destination, {})
  File "/private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/lib/python3.9/site-packages/installer/_core.py", line 109, in install
    record = destination.write_file(
  File "/private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/lib/python3.9/site-packages/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
  File "/private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/lib/python3.9/site-packages/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: /private/var/folders/69/jvn2bd0j6cs31l1ldw922c5c0000gp/T/.venv/bin/jupyter-contrib-nbextension

This has been fixed in newer versions. See: ipython-contrib/jupyter_contrib_nbextensions#1612

jupyter-contrib-nbextensions==0.7.0

⋊> /v/f/6/j/T .venv/bin/python3 -m installer jupyter_contrib_nbextensions-0.7.0/dist/jupyter_contrib_nbextensions-0.7.0-py2.py3-none-any.whl                                                                                               
⋊> /v/f/6/j/T ls -la .venv/bin/jupyter-contrib-nbextension                                                                                                                                                                                  
-rwxr-xr-x  1 groodt  staff  297 21 Sep 16:15 .venv/bin/jupyter-contrib-nbextension*

awsebcli==3.21.0

Somebody raised an issue for awsebcli==3.21.0 but it hasn't been merged yet aws/aws-elastic-beanstalk-cli#469

A workaround for awsebcli could be to fork the repo and use a vcs url in requirements.txt until the issue is fixed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants