← Back to issue list

`charmcraft build` breaks when pip packages come from github

View original Github issue

Metadata

Project
charmcraft
Number
#55
Type
issue
State
closed
Author
jamesbeedy
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Fixed in charmcraft snap v0.2 by adding git support. The build failed because the snap lacked git, preventing pip from cloning GitHub packages. Upgrading to v0.2 resolved the issue.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#605 Charmcraft fails to build due to lack of Git charmcraft closed Charmcraft fails to build when installing git-referenced dependencies due to a missing git binary in the build environment. The reporter resolved the issue by adding git to build-packages in charmcraft.yaml. Closed as resolved.
76%
#322 Latest snap package cannot build a charm charmcraft closed The charmcraft snap beta failed to build charms due to a pip3 execution error. The problem was resolved and closed with the 0.10.2 release.
72%
#875 snap: git version included in snap is too old charmcraft closed Resolved in charmcraft snap v2.1. The conflict arose from a GIT_EXEC_PATH environment variable pointing to an outdated git binary. Verified fixed on latest/edge and closed.
71%