Install Ansible using pip on Risc-v
Well I've been trying to contribute to the risc-v ecosystem, and usually I get either overwhelmed by what I'm doing or I get bored... but I do work well when I've got a task on hand, like the one I took below!
I've been a fan of what Jeff Geerling does for a long time! Honestly was glad to be able to help, I even got a mention in his blog post!
So let's begin this article!
To go further from here, I first logged into my Vision Five 2 board.
Then I created a Python virtual env.
python -m venv venv
python --version
When I initially tried pip install ansible
after creating a virtual environment, it failed.
...
running build_ext
running build_rust
error: can't find Rust compiler
...
This gave me a hint, I need to install the rust compiler
# Ubuntu/Debian derivatives
sudo apt install -y rustup
rustup install stable
rustc --version
This was all good, and I went on ahead with running the pip
command again.
But that didn't work either
run pkg_config fail: Could not run `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl`
The pkg-config command could not be found.
Most likely, you need to install a pkg-config package for your OS.
Try `apt install pkg-config`, or `yum install pkg-config`,
or `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.
If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.
So I once again, went ahead and installed pkg-config
## Ubuntu/Debian derivatives:
sudo apt install -y pkg-config
## Archlinux:
sudo pacman -S pkg-config
Then finally, ansible was built! by running pip install ansible
Building wheels for collected packages: cryptography
Building wheel for cryptography (pyproject.toml) ... /
done
Created wheel for cryptography: filename=cryptography-42.0.8-cp312-cp312-linux_riscv64.whl size=1497465 sha256=2effb0faf4641f1e0f958611dc3d74117c0acb07ffbef09813563e9aa406321d
Stored in directory: /home/user/.cache/pip/wheels/3d/72/97/171f6cd6eaa8c4f755fc233cbd14fe300a71acff1187ca08d5
Successfully built cryptography
Installing collected packages: resolvelib, PyYAML, pycparser, packaging, MarkupSafe, jinja2, cffi, cryptography, ansible-core, ansible
Successfully installed MarkupSafe-2.1.5 PyYAML-6.0.1 ansible-10.1.0 ansible-core-2.17.1 cffi-1.16.0 cryptography-42.0.8 jinja2-3.1.4 packaging-24.1 pycparser-2.22 resolvelib-1.0.1
[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: pip install --upgrade pip
It's been a while since I've written something, so hopefully this helps me get back into writing.
Further, I've compiled a gist for this
https://gist.github.com/afro-coder/2b1f96ca31880fb66795b6dc15763e78
Feel free to suggest edits etc.
Subscribe to my newsletter
Read articles from Leon directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Leon
Leon
Extremely bored all the time, but I love tech.