`charmcraft build` breaks when pip packages come from github
Metadata
Current evaluation
GitHub requirements now work in snap-packaged Charmcraft 0.2, which added preliminary git support; the reporter confirmed the fix. Released via PR #58.
Resolution: closed resolved
Reason: The failure was caused by git being absent from the Charmcraft snap. PR #58 (merge commit 1b9913d9, change commit 26bd9ae0) released 0.2.0 with git support, and the reporter confirmed that GitHub requirements built successfully.
Evaluated by: mr-cal-bot
No scores available.
Issue body
`charmcraft build` errors when pip packages located in github are included in the requirements.txt.
This issue can be reproduced if you build a charm where the requirements.txt contains pip packages that live in github.
Reproducer:
```
git clone https://github.com/ducks23/charm-slurmdbd -b bdx_charmcraft
cd charm-slurmdbd
charmcraft build
```
Here is our example of the breakage below:
```
$ cat requirements.txt
ops
#git+https://github.com/omnivector-solutions/interface-mysql.git@master
#git+https://github.com/omnivector-solutions/slurm-snap-manager.git@master
$ charmcraft build
Done, charm left in 'slurmdbd.charm'
$ vim requirements.txt
$ cat requirements.txt
ops
git+https://github.com/omnivector-solutions/interface-mysql.git@master
git+https://github.com/omnivector-solutions/slurm-snap-manager.git@master
$ charmcraft build
Executing ['pip3', 'install', '--target=/home/bdx/allcode/github/ducks23/charm-slurmdbd/build/venv', '--requirement=/home/bdx/allcode/github/ducks23/charm-slurmdbd/requirements.txt'] failed with return code 1
problems installing dependencies
```
I can install the requirements.txt by hand successfully
```
$ pip install -r requirements.txt
Collecting git+https://github.com/omnivector-solutions/interface-mysql.git@master (from -r requirements.txt (line 2))
Cloning https://github.com/omnivector-solutions/interface-mysql.git (to revision master) to /tmp/pip-req-build-ztlxwhvf
Running command git clone -q https://github.com/omnivector-solutions/interface-mysql.git /tmp/pip-req-build-ztlxwhvf
Collecting git+https://github.com/omnivector-solutions/slurm-snap-manager.git@master (from -r requirements.txt (line 3))
Cloning https://github.com/omnivector-solutions/slurm-snap-manager.git (to revision master) to /tmp/pip-req-build-pwosnebt
Running command git clone -q https://github.com/omnivector-solutions/slurm-snap-manager.git /tmp/pip-req-build-pwosnebt
Requirement already satisfied: ops in /home/bdx/allcode/github/venv/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (0.6.1)
Requirement already satisfied: PyYAML in /home/bdx/allcode/github/venv/lib/python3.8/site-packages (from ops->-r requirements.txt (line 1)) (5.3.1)
Building wheels for collected packages: interface-mysql, slurm-snap-manager
Building wheel for interface-mysql (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/bdx/allcode/github/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-ztlxwhvf/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-ztlxwhvf/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y8jlp8ro
cwd: /tmp/pip-req-build-ztlxwhvf/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for interface-mysql
Running setup.py clean for interface-mysql
Building wheel for slurm-snap-manager (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/bdx/allcode/github/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-pwosnebt/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-pwosnebt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-gd2m4kjg
cwd: /tmp/pip-req-build-pwosnebt/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for slurm-snap-manager
Running setup.py clean for slurm-snap-manager
Failed to build interface-mysql slurm-snap-manager
Installing collected packages: interface-mysql, slurm-snap-manager
Running setup.py install for interface-mysql ... done
Running setup.py install for slurm-snap-manager ... done
Successfully installed interface-mysql-0.0.1 slurm-snap-manager-0.0.1
```
Running `snappy-debug` shows:
```
= AppArmor =
Time: Jun 24 10:26:01
Log: apparmor="DENIED" operation="open" profile="snap.charmcraft.charmcraft" name="/etc/" pid=3626019 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
File: /etc/ (read)
Suggestions:
* adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
* adjust snap to use snap layouts (https://forum.snapcraft.io/t/snap-layouts/7207)
= AppArmor =
Time: Jun 24 10:28:39
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | GitHub requirements now work in snap-packaged Charmcraft 0.2, which added preliminary git support; the reporter confirmed the fix. Released via PR #58. | |
| stealth/space-bunny-alpha | — | closed resolved | Preliminary git support in Charmcraft snap 0.2 fixed GitHub-sourced pip dependencies; the reporter confirmed the build worked. | |
| qwen/qwen3.6-35b-a3b | — | — | The charmcraft snap lacked git, causing pip to fail when installing GitHub dependencies. Maintainers added preliminary git support in snap v0.2, resolving the issue. The reporter confirmed the fix works. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved by updating the charmcraft snap to v0.2 with git support, fixing pip failures for GitHub-hosted dependencies. Verified working by the reporter. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in snap v0.2 by adding git support. The build failure for GitHub-hosted pip packages stemmed from the charmcraft snap lacking git. Upgrading to the updated snap version fixed the issue. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by adding git support to the charmcraft snap v0.2, resolving pip failures when installing GitHub-hosted packages. User confirmed the fix works. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#58
(confidence 98%)
Merged the Charmcraft 0.2.0 snap changes that added preliminary git support.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #605 Charmcraft fails to build due to lack of Git | charmcraft | closed | Resolved as a build-environment configuration issue: the reporter fixed the failure by adding git to parts.charm.build-packages in charmcraft.yaml. | |
| #883 Charmcraft (2.0.0) pack with build-packages failing on GitHub actions (but 2.1.0 - latest/candidate - is working) | charmcraft | closed | Charmcraft 2.0.0 failed to install build packages after a GitHub runner update; running apt-get update worked. Maintainers closed it as likely unrelated to Charmcraft. | |
| #498 charmcraft 1.2.1 (candidate): cannot pull python deps with git | charmcraft | closed | Reported that charmcraft 1.2.1 fails with "Cannot find command 'git'" when pulling Git-based Python deps. Maintainer facundobatista closed it as config: add git to build-packages (see Charm Discourse thread 4986); no code change. | |
| #1950 fix: make charmcraft work with snap parallel installs | charmcraft | merged | Merged PR #1950 via commit 2399ddf8, fixing Charmcraft conflicts during parallel snap installs and adding spread regression coverage for issue #1770. | |
| #1160 `charmcraft pack` does not recognize updated `charmcraft.yaml` file | charmcraft | open | Tracked upstream: charmcraft pack ignores build-snaps channel changes in charmcraft.yaml unless clean is run. Root cause is craft-parts#496 (build-snaps missing from properties_of_interest), still unfixed; charmcraft only needs a craft-parts bump once patched. | |
| #875 snap: git version included in snap is too old | charmcraft | closed | Charmcraft snap 2.1 resolved the Git mismatch: latest/edge no longer reproduced the failure, and the reporter agreed to close the issue. | |
| #388 Charmcraft pack cannot run in a CI? | charmcraft | closed | charmcraft's strictly-confined snap blocked CI builds (pip deps install failing). Fixed by switching the snap to classic confinement (PR #288, commit d49e85e3); reporter confirmed the edge classic snap resolved their CI. | |
| #322 Latest snap package cannot build a charm | charmcraft | closed | Charm builds broken by Ubuntu Bionic's pip3 behavior in snap 0.10.1 were fixed in 0.10.2 by merged PR #124 (commit aabf060e). |