-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
charm plugin should include rust compiler in build dependencies #2004
Comments
When I played with this I had to include both In any case, it would be great if rust toolchain was included by default just like the C toolchain. |
I've just run into this missing rust compiler issue building a charm with no part. Log can be found below. Logs$ charmcraft pack --verbose --debug Starting charmcraft, version 3.2.2 Logging execution to '/home/jeremie/.local/state/charmcraft/log/charmcraft-20250115-153257.962632.log' Launching managed ubuntu 22.04 instance... Starting instance Starting charmcraft, version 3.2.2 Logging execution to '/tmp/charmcraft.log' Starting charmcraft, version 3.2.2 Logging execution to '/tmp/charmcraft.log' Initialising lifecycle Installing build-packages Updating sources for charm (source changed) Building charm :: + env -i LANG=C.UTF-8 LC_ALL=C.UTF-8 CRYPTOGRAPHY_OPENSSL_NO_LEGACY=true PATH=/snap/charmcraft/5303/libexec/charmcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin SNAP=/snap/charmcraft/5303 SNAP_ARCH=amd64 SNAP_NAME=charmcraft SNAP_VERSION=3.2.2 /snap/charmcraft/5303/bin/python3 -u -I /snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py --builddir /root/parts/charm/build --installdir /root/parts/charm/install --entrypoint /root/parts/charm/build/src/charm.py -p pip -p setuptools -p wheel -r requirements.txt :: Starting charm builder :: Translated .jujuignore 2 '.git' => '.*/\\.git\\Z' :: Translated .jujuignore 3 '.svn' => '.*/\\.svn\\Z' :: Translated .jujuignore 4 '.hg' => '.*/\\.hg\\Z' :: Translated .jujuignore 5 '.bzr' => '.*/\\.bzr\\Z' :: Translated .jujuignore 6 '.tox' => '.*/\\.tox\\Z' :: Translated .jujuignore 8 '/build/' => '/build\\Z' :: Translated .jujuignore 9 '/revision' => '/revision\\Z' :: Translated .jujuignore 10 '/venv' => '/venv\\Z' :: Translated .jujuignore 12 '.jujuignore' => '.*/\\.jujuignore\\Z' :: Translated .jujuignore 1 '/staging-venv' => '/staging\\-venv\\Z' :: Collected charmlib dependencies: {'cosl'} :: Building charm in '/root/parts/charm/install' :: Linking in generic paths :: Ignoring directory because of rules: '.git' :: Creating the dispatch mechanism :: Creating the 'start' hook script pointing to dispatch :: Creating the 'upgrade-charm' hook script pointing to dispatch :: Creating the 'install' hook script pointing to dispatch :: Handling dependencies :: Current dependencies hash: '57f68bec67996bd7e46728a224beee4e192834de' :: Dependencies directory not found :: Installing dependencies :: Running external command ['python3', '-m', 'venv', '/root/parts/charm/build/staging-venv'] :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--force-reinstall', 'pip@https://files.pythonhosted.org/packages/c0/d0/9641dc7b05877874c6418f8034ddefc809495e65caa14d38c7551cd114bb/pip-24.1.1.tar.gz'] :: :: Collecting pip@ https://files.pythonhosted.org/packages/c0/d0/9641dc7b05877874c6418f8034ddefc809495e65caa14d38c7551cd114bb/pip-24.1.1.tar.gz :: :: Using cached pip-24.1.1-py3-none-any.whl :: :: Installing collected packages: pip :: :: Attempting uninstall: pip :: :: Found existing installation: pip 22.0.2 :: :: Uninstalling pip-22.0.2: :: :: Successfully uninstalled pip-22.0.2 :: :: Successfully installed pip-24.1.1 :: Installing Python pre-dependencies from source. :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--no-binary=:all:', 'pip', 'setuptools', 'wheel'] :: :: Requirement already satisfied: pip in ./staging-venv/lib/python3.10/site-packages (24.1.1) :: :: Requirement already satisfied: setuptools in ./staging-venv/lib/python3.10/site-packages (59.6.0) :: :: Collecting wheel :: :: Using cached wheel-0.45.1-py3-none-any.whl :: :: Installing collected packages: wheel :: :: Successfully installed wheel-0.45.1 :: :: :: :: [notice] A new release of pip is available: 24.1.1 -> 24.3.1 :: :: [notice] To update, run: python3 -m pip install --upgrade pip :: Installing packages from requirements files and charm lib dependencies. :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--no-binary=:all:', '--requirement=requirements.txt', 'cosl'] :: :: Collecting cosl :: :: Using cached cosl-0.0.50.tar.gz (74 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting ops~=2.4 (from -r requirements.txt (line 1)) :: :: Using cached ops-2.17.1.tar.gz (477 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting requests (from -r requirements.txt (line 2)) :: :: Using cached requests-2.32.3.tar.gz (131 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting lightkube>=v0.15.4 (from cosl) :: :: Using cached lightkube-0.17.1.tar.gz (45 kB) :: :: Preparing metadata (setup.py): started :: :: Preparing metadata (setup.py): finished with status 'done' :: :: Collecting pydantic (from cosl) :: :: Using cached pydantic-2.10.5.tar.gz (761 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting pyyaml (from cosl) :: :: Using cached PyYAML-6.0.2-cp310-cp310-linux_x86_64.whl :: :: Collecting tenacity (from cosl) :: :: Using cached tenacity-9.0.0.tar.gz (47 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting typing-extensions (from cosl) :: :: Using cached typing_extensions-4.12.2-py3-none-any.whl :: :: Collecting websocket-client==1.* (from ops~=2.4->-r requirements.txt (line 1)) :: :: Using cached websocket_client-1.8.0.tar.gz (54 kB) :: :: Preparing metadata (setup.py): started :: :: Preparing metadata (setup.py): finished with status 'done' :: :: Collecting charset_normalizer<4,>=2 (from requests->-r requirements.txt (line 2)) :: :: Using cached charset_normalizer-3.4.1.tar.gz (123 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting idna<4,>=2.5 (from requests->-r requirements.txt (line 2)) :: :: Using cached idna-3.10.tar.gz (190 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting urllib3<3,>=1.21.1 (from requests->-r requirements.txt (line 2)) :: :: Using cached urllib3-2.3.0.tar.gz (307 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting certifi>=2017.4.17 (from requests->-r requirements.txt (line 2)) :: :: Using cached certifi-2024.12.14.tar.gz (166 kB) :: :: Preparing metadata (setup.py): started :: :: Preparing metadata (setup.py): finished with status 'done' :: :: Collecting httpx<1.0.0,>=0.24.0 (from lightkube>=v0.15.4->cosl) :: :: Using cached httpx-0.28.1.tar.gz (141 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting lightkube-models>=1.15.12.0 (from lightkube>=v0.15.4->cosl) :: :: Using cached lightkube-models-1.32.0.8.tar.gz (206 kB) :: :: Preparing metadata (setup.py): started :: :: Preparing metadata (setup.py): finished with status 'done' :: :: Collecting annotated-types>=0.6.0 (from pydantic->cosl) :: :: Using cached annotated_types-0.7.0.tar.gz (16 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting pydantic-core==2.27.2 (from pydantic->cosl) :: :: Using cached pydantic_core-2.27.2.tar.gz (413 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'error' :: :: error: subprocess-exited-with-error :: :: :: :: × pip subprocess to install build dependencies did not run successfully. :: :: │ exit code: 1 :: :: ╰─> [57 lines of output] :: :: Collecting maturin<2,>=1 :: :: Using cached maturin-1.8.1.tar.gz (197 kB) :: :: Installing build dependencies: started :: :: Installing build dependencies: finished with status 'done' :: :: Getting requirements to build wheel: started :: :: Getting requirements to build wheel: finished with status 'done' :: :: Preparing metadata (pyproject.toml): started :: :: Preparing metadata (pyproject.toml): finished with status 'done' :: :: Collecting typing-extensions!=4.7.0,>=4.6.0 :: :: Using cached typing_extensions-4.12.2-py3-none-any.whl :: :: Collecting tomli>=1.1.0 (from maturin<2,>=1) :: :: Using cached tomli-2.2.1-py3-none-any.whl :: :: Building wheels for collected packages: maturin :: :: Building wheel for maturin (pyproject.toml): started :: :: Building wheel for maturin (pyproject.toml): finished with status 'error' :: :: error: subprocess-exited-with-error :: :: :: :: × Building wheel for maturin (pyproject.toml) did not run successfully. :: :: │ exit code: 1 :: :: ╰─> [28 lines of output] :: :: running bdist_wheel :: :: running build :: :: running build_py :: :: creating build/lib.linux-x86_64-cpython-310/maturin :: :: copying maturin/__init__.py -> build/lib.linux-x86_64-cpython-310/maturin :: :: copying maturin/__main__.py -> build/lib.linux-x86_64-cpython-310/maturin :: :: running egg_info :: :: writing maturin.egg-info/PKG-INFO :: :: writing dependency_links to maturin.egg-info/dependency_links.txt :: :: writing requirements to maturin.egg-info/requires.txt :: :: writing top-level names to maturin.egg-info/top_level.txt :: :: reading manifest file 'maturin.egg-info/SOURCES.txt' :: :: reading manifest template 'MANIFEST.in' :: :: warning: no files found matching '*.json' under directory 'src/python_interpreter' :: :: writing manifest file 'maturin.egg-info/SOURCES.txt' :: :: running build_ext :: :: running build_rust :: :: error: can't find Rust compiler :: :: :: :: If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler. :: :: :: :: To update pip, run: :: :: :: :: pip install --upgrade pip :: :: :: :: and then retry package installation. :: :: :: :: If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain. :: :: [end of output] :: :: :: :: note: This error originates from a subprocess, and is likely not a problem with pip. :: :: ERROR: Failed building wheel for maturin :: :: Failed to build maturin :: :: ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (maturin) :: :: :: :: [notice] A new release of pip is available: 24.1.1 -> 24.3.1 :: :: [notice] To update, run: python3 -m pip install --upgrade pip :: :: [end of output] :: :: :: :: note: This error originates from a subprocess, and is likely not a problem with pip. :: :: error: subprocess-exited-with-error :: :: :: :: × pip subprocess to install build dependencies did not run successfully. :: :: │ exit code: 1 :: :: ╰─> See above for output. :: :: :: :: note: This error originates from a subprocess, and is likely not a problem with pip. :: :: :: :: [notice] A new release of pip is available: 24.1.1 -> 24.3.1 :: :: [notice] To update, run: python3 -m pip install --upgrade pip :: Traceback (most recent call last): :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 483, in :: main() :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 478, in main :: builder.build_charm() :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 93, in build_charm :: self.handle_dependencies() :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 354, in handle_dependencies :: self._install_dependencies(staging_venv_dir) :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/instrum.py", line 152, in _f :: return func(*args, **kwargs) :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 284, in _install_dependencies :: _process_run( :: File "/snap/charmcraft/5303/lib/python3.10/site-packages/charmcraft/charm_builder.py", line 414, in _process_run :: raise RuntimeError(f"Subprocess command {cmd} execution failed with retcode {retcode}") :: RuntimeError: Subprocess command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--no-binary=:all:', '--requirement=requirements.txt', 'cosl'] execution failed with retcode 1 Failed to run the build script for part 'charm'. |
What needs to get done
Add
"cargo"
to the charm plugin build dependencies for deb based charms (see PR #2005).I'm not 100% sure what's needed for
yum
anddnf
systems.Why it needs to get done
It's increasingly common that some python packages require a rust compiler at build time. We first noticed this a few months ago in the Juju SDK's 'Write your first Kubernetes charm' tutorial. Here we needed to add
cargo
tobuild-packages
for thecharm
part
when adding cos-lite.This came up again recently with the 2023 Operator Day tutorial (video, repo) that most new starters are asked to do. Here the need for
cargo
comes from adding thetraefik_k8s.v2.ingress
lib, because it includes the popular PyPI packagepydantic
(note: the lib is usingPYDEPS
). We considered another documentation fix here (which would have to include both the tutorial and theingress
lib, as well as any other libs usingpydantic
), but it seems like it might be a better idea to just includecargo
in the charm plugin's build dependencies by default.The text was updated successfully, but these errors were encountered: