Duplicate entrypoint and script definitions error Bazel rules_python installation

Bug #1996959 reported by Hunter Crosland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
Fix Released
Undecided
Hunter Crosland

Bug Description

When python-swiftclient is specified as a requirement in a standard requirements.txt, and subsequently a locked_requirements.txt is generated from this requirements file via rules_python's compile_pip_requirements rule, the wheel installation through pip_parse fails due to duplicate definitions of "swift."

The error can be solved by changing the entrypoint name for swiftclient.shell:main or by changing the name of /bin/swift to avoid duplication.

Error output for my machine:

ERROR: /home/hcrosland/Repos/isaac/sdk/extensions/data_ingestion/BUILD:14:13: //extensions/data_ingestion:data_ingestion-pytype depends on @isaac_safety_deps_python_swiftclient//:pkg in repository @isaac_safety_deps_python_swiftclient which failed to fetch. no such package '@isaac_safety_deps_python_swiftclient//': whl_library isaac_safety_deps_python_swiftclient failed: Collecting python-swiftclient==4.1.0
  Downloading python_swiftclient-4.1.0-py3-none-any.whl (87 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.8/87.8 kB 12.4 MB/s eta 0:00:00
Saved ./python_swiftclient-4.1.0-py3-none-any.whl
 (WARNING: The directory '/home/hcrosland/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/rules_python/python/pip_install/extract_wheels/extract_single_wheel.py", line 104, in <module>
    main()
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/rules_python/python/pip_install/extract_wheels/extract_single_wheel.py", line 92, in main
    bazel.extract_wheel(
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/rules_python/python/pip_install/extract_wheels/bazel.py", line 364, in extract_wheel
    whl.unzip(directory)
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/rules_python/python/pip_install/extract_wheels/wheel.py", line 90, in unzip
    installer.install(
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/pypi__installer/installer/_core.py", line 109, in install
    record = destination.write_file(
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/pypi__installer/installer/destinations.py", line 203, in write_file
    return self.write_to_fs(
  File "/home/hcrosland/.cache/dazel/_dazel_hcrosland/external/pypi__installer/installer/destinations.py", line 167, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: ./bin/swift

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-swiftclient (master)
Changed in python-swiftclient:
status: New → In Progress
Changed in python-swiftclient:
assignee: nobody → Hunter Crosland (hcrosland)
Revision history for this message
clayg (clay-gerrard) wrote :

I'm confused - what is the pre-existing `./bin/swift` in this context?

Revision history for this message
Hunter Crosland (hcrosland) wrote :

It is either the actual /bin/swift in the python-swiftclient source repo, or it is a Bazel-created outfile defined by the entrypoint in setup.cfg, whichever is created first. The problem is solved by renaming either one.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-swiftclient (master)

Reviewed: https://review.opendev.org/c/openstack/python-swiftclient/+/904548
Committed: https://opendev.org/openstack/python-swiftclient/commit/45a311fc621324742f6d981a94ab93a3b30422e1
Submitter: "Zuul (22348)"
Branch: master

commit 45a311fc621324742f6d981a94ab93a3b30422e1
Author: DavHau <email address hidden>
Date: Wed Jan 3 12:17:02 2024 +0700

    Remove duplicate script entry leading to broken wheel build

    The entry_point option already defines the /bin/swift script implicitly.
    The definition of `scripts=bin/swift` ontop of that leads to a corrupt wheel build and can lead to a collision error during installation:
    FileExistsError: File already exists: [...]/bin/swift

    Closes-Bug: #1996959
    Change-Id: I17d0c2b02555172eeedaa164aad956691ccb3b0a

Changed in python-swiftclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-swiftclient (master)

Change abandoned by "Tim Burke <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/python-swiftclient/+/864965
Reason: Addressed via https://review.opendev.org/c/openstack/python-swiftclient/+/904548 -- thanks, though!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-swiftclient 4.5.0

This issue was fixed in the openstack/python-swiftclient 4.5.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.