Error installing Python packages fails with trace

Bug #1753965 reported by Christian Dywan on 2018-03-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
High
Sergio Schvezov

Bug Description

When using the Python plugin and there's a problem installing a Python package, Snapcraft aborts with both a verbatim error message from pip as well as a long trace.

There's 3 ways to get this to happen which go through the same code path which is why I'm filing one bug for it:
 - A package from index (PyPI) can't be installed.
 - The URL to a VCS branch can't be cloned.
 - An error occurs downloading via http(s) eg. HTTP 404.

parts:
  foo:
    plugin: python
    python-packages:
     - <email address hidden>:kalikiana/does-not-exist.git#egg=ham
     - http://someserver.org/packages/MyPackage-3.0.tar.gz

See below for abbreviated traces going through "Pip.download":

Collecting pip
  Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip
Traceback (most recent call last):
[...]
  File "/home/rumo/dev/snapcraft/snapcraft/plugins/_python/_pip.py", line 196, in _ensure_pip_installed
    self.download({'pip'})
[...]
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)

Invalid requirement: '<email address hidden>:kalikiana/does-not-exist.git'
It looks like a path. Does it exist ?
Traceback (most recent call last):
[...]
  File "/home/rumo/dev/snapcraft/snapcraft/plugins/_python/_pip.py", line 275, in download
    self._python_package_dir] + args, cwd=cwd)
[...]
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)

Collecting http://someserver.org/packages/MyPackage-3.0.tar.gz
  HTTP error 404 while getting http://someserver.org/packages/MyPackage-3.0.tar.gz
  Could not install requirement http://someserver.org/packages/MyPackage-3.0.tar.gz because of error 404 Client Error: Not Found for url: http://someserver.org/packages/MyPackage-3.0.tar.gz
Could not install requirement http://someserver.org/packages/MyPackage-3.0.tar.gz because of HTTP error 404 Client Error: Not Found for url: http://someserver.org/packages/MyPackage-3.0.tar.gz for URL http://someserver.org/packages/MyPackage-3.0.tar.gz
Traceback (most recent call last):
[...]
  File "/home/rumo/dev/snapcraft/snapcraft/plugins/_python/_pip.py", line 275, in download
    self._python_package_dir] + args, cwd=cwd)
[...]
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)

Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Sergio Schvezov (sergiusens)
Changed in snapcraft:
status: In Progress → Fix Committed
Christian Dywan (kalikiana) wrote :

This isn't fixed unfortunately because the internal _pip module uses snapcraft.internal.common.run directly rather than the run/run/output methods of the plugin.

Changed in snapcraft:
status: Fix Committed → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers