Comment 0 for bug 1761097

Revision history for this message
Daan W. (dwynen) wrote :

This is just a report of the problem discussed in [1] which I think is still present (or something similar).

The problem is that for rapid-photo-downloader, the cwd during build holds a setup.cfg, which then gets applied to all python installs during build.

I created a (stupid?) adaptation of the author's defunct snapcraft.yaml from [2] which I put at [3].

On a clean digital-ocean applet (Ubuntu 17.10 server) a "snapcraft" call (both with current HEAD and with current "snap install snapcraft --classic" results in an error while installing the first python package, in this case pip:

(snapcraft) snapper@snapbuild:~/test-snapcraft/rapid$ snapcraft
Preparing to pull rapid-photo-downloader
Hit http://lon1.mirrors.digitalocean.com/ubuntu artful InRelease
Get:1 http://lon1.mirrors.digitalocean.com/ubuntu artful-updates InRelease [81.7 kB]
Get:2 http://lon1.mirrors.digitalocean.com/ubuntu artful-backports InRelease [72.2 kB]
Get:3 http://security.ubuntu.com/ubuntu artful-security InRelease [78.6 kB]
Get:4 http://lon1.mirrors.digitalocean.com/ubuntu artful-updates/universe amd64 Packages [102 kB]
Fetched 335 kB in 0s (0 B/s)
Pulling rapid-photo-downloader
Fetching and installing pip...
Collecting pip
  File was already downloaded /home/snapper/test-snapcraft/rapid/parts/rapid-photo-downloader/python-packages/pip-9.0.3-py2.py3-none-any.whl
Successfully downloaded pip
Collecting pip
Installing collected packages: pip
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 360, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python3/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/lib/python3.6/distutils/command/install.py", line 390, in finalize_options
    ('build_lib', 'build_lib'))
  File "/usr/lib/python3.6/distutils/cmd.py", line 286, in set_undefined_options
    src_cmd_obj = self.distribution.get_command_obj(src_cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 857, in get_command_obj
    self._set_command_options(cmd_obj, options)
  File "/usr/lib/python3.6/distutils/dist.py", line 901, in _set_command_options
    % (source, command_name, option))
distutils.errors.DistutilsOptionError: error in setup.cfg: command 'build' has no such option 'i18n'
Traceback (most recent call last):
  File "/home/snapper/venv/snapcraft/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft', 'console_scripts', 'snapcraft')()
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/cli/_runner.py", line 79, in run
    ctx.forward(lifecyclecli.commands['snap'])
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/home/snapper/venv/snapcraft/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/cli/lifecycle.py", line 139, in snap
    project_options, directory=directory, output=output)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/lifecycle/_packer.py", line 46, in snap
    execute('prime', project_options)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 80, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 191, in run
    self._run_step(step, part, part_names)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 236, in _run_step
    getattr(part, step)()
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/pluginhandler/__init__.py", line 286, in pull
    self.plugin.pull()
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/plugins/python.py", line 199, in pull
    self._pip.setup()
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/plugins/_python/_pip.py", line 144, in setup
    self._ensure_pip_installed()
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/plugins/_python/_pip.py", line 171, in _ensure_pip_installed
    self.install({'pip'}, ignore_installed=True)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/plugins/_python/_pip.py", line 299, in install
    '--find-links', self._python_package_dir] + args, cwd=cwd)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/plugins/_python/_pip.py", line 436, in _run
    **kwargs)
  File "/home/snapper/test-snapcraft/snapcraft/snapcraft/internal/common.py", line 64, in run
    subprocess.check_call(['/bin/sh', f.name] + cmd, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/sh', '/tmp/tmplmdgvrgr', '/home/snapper/test-snapcraft/rapid/parts/rapid-photo-downloader/install/usr/bin/python3', '-m', 'pip', 'install', '--user', '--no-compile', '--no-index', '--find-links', '/home/snapper/test-snapcraft/rapid/parts/rapid-photo-downloader/python-packages', 'pip', '--ignore-installed']' returned non-zero exit status 2.

[1] https://forum.snapcraft.io/t/python-setup-cfg-wrongly-applied-to-all-python-package-dependencies/1097
[2] http://bazaar.launchpad.net/~dlynch3/rapid/zeromq_pyqt/view/head:/snap/snapcraft.yaml
[3] https://gist.github.com/black-puppydog/90de8778b4006ed89196992e7d800271