python2 plugin: no 'build' directory found by setup.py under distribution root
Metadata
Current evaluation
Fixed in Snapcraft 2.17 by Python plugin improvements merged in PR #771 (commit bb7bd40e).
Resolution: closed resolved
Reason: The maintainer confirmed that the reproducer built successfully and that the fix shipped in Snapcraft 2.17. Repository history identifies PR #771, commit bb7bd40e, as the Python plugin improvements resolving the pip global-option handling involved.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I have a project (www.tizonia.org) that depends on pycryptodome. When downloading this from PyPi, snapcraft fails to build pycryptodome as there seems to be no 'build' directory under the distribution root.
This is the error:
Running setup.py install for pycryptodome ... error
Complete output from command /home/joni/work/snap2/parts/pypidep/install/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ZVmvKs/pycryptodome/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" build_ext -I/home/joni/work/snap2/parts/pypidep/install/usr/include/python2.7 install --record /tmp/pip-NBmK13-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmphu0myF:
running build_ext
error: [Errno 2] No such file or directory: 'build/test1.c'
----------------------------------------
Command "/home/joni/work/snap2/parts/pypidep/install/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ZVmvKs/pycryptodome/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" build_ext -I/home/joni/work/snap2/parts/pypidep/install/usr/include/python2.7 install --record /tmp/pip-NBmK13-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmphu0myF" failed with error code 1 in /tmp/pip-build-ZVmvKs/pycryptodome/
Traceback (most recent call last):
File "/usr/bin/snapcraft", line 31, in <module>
snapcraft.main.main()
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 203, in main
return run(args, project_options)
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 259, in run
lifecycle.snap(project_options, args['<directory>'], args['--output'])
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 256, in snap
snap = execute('prime', project_options)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 98, in execute
_Executor(config, project_options).run(step, part_names)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 127, in run
self._run_step(step, part, part_names, dirty, recursed)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 165, in _run_step
getattr(part, step)()
File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler.py", line 276, in pull
self.code.pull()
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python2.py", line 106, in pull
self._pip()
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python2.py", line 147, in _pip
self.options.python_packages)
File "/usr/lib/python3/dist-packages/snapcraft/_baseplugin.py", line 221, in run
return common.run(cmd, cwd=cwd, **kwargs)
File "/usr/lib/python3/dist-packages/snapcraft/internal/common.py", line 61, in run
subprocess.check_call(['/bin/sh', f.name] + cmd, **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/sh', '/tmp/tmpthhb56dp', 'python2', '/home/joni/work/snap2/parts/pypidep/install/usr/bin/pip2', 'install', '--global-option=build_ext', '--global-option=-I/home/joni/work/snap2/parts/pypidep/install/usr/include/python2.7', '--target', '/home/joni/work/snap2/parts/pypidep/install/usr/lib/python2.7/site-packages', '--upgrade', 'pycryptodome']' returned non-zero exit status 1
This is a snapcraft.yaml file that reproduces this issue:
name: test
version: 0.1.0
summary: test snap
description: test snap
confinement: devmode # use "strict" to enforce system access only via declared interfaces
parts:
pypidep:
plugin: python2
python-packages:
- pycryptodome
filesets:
modules:
- lib/python2.7/dist-packages/*
stage:
- $modules
snap:
- $modules
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Snapcraft 2.17 by Python plugin improvements merged in PR #771 (commit bb7bd40e). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Snapcraft 2.17: the pycryptodome reproducer successfully staged, primed, and built after updating, with the release reaching Yakkety and headed for Xenial. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a documented fix after years of inactivity. Migrated to Launchpad bug #1598396, which was also closed without comments or resolution. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments. The python2 plugin failed to locate the build directory during pycryptodome installation, causing snapcraft to fail. Issue appears abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution, likely abandoned or superseded due to Python 2 deprecation and snapcraft updates. No fix or merge details provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The python2 plugin build failure appears abandoned, likely superseded by updated snapcraft plugins following Python 2 deprecation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. The python2 plugin failed to locate the build directory during pycryptodome installation, causing snapcraft to fail. Issue appears abandoned. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcraft#771
(confidence 98%)
Commit bb7bd40e1 is titled “Python plugin improvements (#771)” and removes the problematic pip global-option path.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1616032 python2 plugin expects pip to be called pip2 | snapcraft (launchpad) | closed | Fixed the Python 2 plugin's incorrect pip2 invocation in snapcraft PR #771 (commit bb7bd40e1); the fix was released in Snapcraft 2.17. |