pip fails when project requirement result binary already exists

Bug #1861638 reported by David Parrish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

When trying to Snap the JoinMarket project on Github. I noticed that when running snapcraft for the second time, would fail because a result binary already exists, and pip didn't have a `--exists-action` set.

In the patch, I'm not sure if it would be better to (i)gnore or (w)ipe for the default action.

I've included a patch which fixes the issue for me. I also have included the error message I am getting, along with my snapcraft.yml.

Error message:

```
Updating pull step for joinmarket (source changed)
Obtaining file:///root/project/jmbase (from -r /root/parts/joinmarket/build/requirements/base.txt (line 1))
The file /root/parts/joinmarket/python-packages/joinmarketbase-0.6.1.zip exists. (i)gnore, (w)ipe, (b)ackup, (a)bort ERROR: Exception:
Traceback (most recent call last):
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/commands/download.py", line 135, in run
    resolver.resolve(requirement_set)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 265, in _get_abstract_dist_for
    return self.preparer.prepare_editable_requirement(req)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 559, in prepare_editable_requirement
    req.archive(self.download_dir)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 721, in archive
    display_path(archive_path), ('i', 'w', 'b', 'a'))
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 223, in ask_path_exists
    return ask(message, options)
  File "/root/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 241, in ask
    response = input(message)
EOFError: EOF when reading a line
Failed to run '/root/stage/usr/bin/python3 -m pip download --disable-pip-version-check --dest /root/parts/joinmarket/python-packages --requirement /root/parts/joinmarket/build/requirements/gui.txt': Exited with code 2.

```

snapcraft.yaml

```
name: joinmarket
base: core18
version: master
summary: Software to assist in creating bitcoin CoinJoin transactions
description: |
  JoinMarket is software to create a special kind of bitcoin transaction called a CoinJoin transaction. It's aim is to improve the confidentiality and privacy of bitcoin transactions.
confinement: devmode
grade: devel
#icon: icon.png

apps:
  joinmarket-qt:
    extensions:
      - kde-neon
    command: usr/bin/jm
    plugs:
      - network
      - network-bind
      - desktop
      - desktop-legacy
      - x11
      - wayland
      - home

parts:
  joinmarket:
    plugin: python
    source: .
    requirements:
      - requirements/gui.txt
    override-build: |
      snapcraftctl build

      pwd
      ls -alh
      #cd ../install
      mkdir -p /root/parts/joinmarket/install/opt
      cp -rp /root/parts/joinmarket/build /root/parts/joinmarket/install/opt
      mv /root/parts/joinmarket/install/opt/build /root/parts/joinmarket/install/opt/joinmarket

  # Install desktop launcher
  launchers:
    plugin: dump
    source: .
    organize:
      'snap/jm': usr/bin/jm
    after:
      - joinmarket
```

Tags: plugin pip
Revision history for this message
David Parrish (daveparrish) wrote :
description: updated
description: updated
summary: - pip fails when project requirement result binary already exsists
+ pip fails when project requirement result binary already exists
description: updated
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.