I'm trying to install ansible core in an airgap environment, the problem is that when I install cryptography 40.0.1 it requires rust installed.
I install rust using yum ( we have a private repository, that is why I can install rust in an air gapped environment ), but when I try to install cryptography it throws this error:
running build_ext
running build_rust
cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features pyo3/extension-module pyo3/abi3-py36 -- --crate-type cdylib
Updating crates.io index
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
error: Unable to update registry `crates-io`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
[6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.9.13
platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28
pip: 20.2.4
setuptools: 67.6.1
setuptools_rust: 1.5.2
rustc: 1.62.1 (Red Hat 1.62.1-1.module+el8.7.0+16002+ac58477b)
=============================DEBUG ASSISTANCE=============================
error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features 'pyo3/extension-module pyo3/abi3-py36' -- --crate-type cdylib` failed with code 101
Is there a way to install the missing crates in an air gapped environment?
I am not completely sure about your environment, nor how yum works.
But it seems like your problem happens because cargo tries to update the index to do its job.
Somewhere between yum install x
and networking error
this command is triggered:
cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features pyo3/extension-module pyo3/abi3-py36 -- --crate-type cdylib
But for you not to get that error you need pass a --offline
flag, something like this:
cargo rustc --offline --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features pyo3/extension-module pyo3/abi3-py36 -- --crate-type cdylib
I guess the answer is in how to pass that specific argument to cargo in your environment when you make yum install