Question: While installing Qiskit packages on CentOS 7, I ended up with an error: Failed building wheel for qiskit-terra. There is another error before the line about wheel – error: can’t find Rust compiler. Here’s the complete error message:
/mock/backends/yorktown copying qiskit/test/mock/backends/yorktown/props_yorktown.json -> build/lib.linux-x86_64-cpython-310/qiskit/test/mock/backends/yorktown 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 qiskit-terra Building wheel for python-constraint (setup.py) ... done Created wheel for python-constraint: filename=python_constraint-1.4.0-py2.py3-none-any.whl size=24058 sha256=5c605ca43b9cab3d0347ef6fd37e2f043533cfdb2bb43476727f8cd7901f8c97 Stored in directory: /home/qiskit/.cache/pip/wheels/2e/f2/2b/cb08b5fe129e4f69b7033061f256e5c551b0aa1160c2872aee Successfully built python-constraint Failed to build qiskit-terra ERROR: Could not build wheels for qiskit-terra, which is required to install pyproject.toml-based projects
Solution: Failed building wheel for qiskit-terra or Can’t find Rust compiler
According to the error message, ‘Can’t find Rust compiler‘ seems to be the root cause of the error. If you are using an outdated version of the
python-pip, then the prebuilt wheel might be available for this package. Hence I tried upgrading the
python-pip as shown below.
$ pip install --upgrade pip
However, the installation of the qiskit package failed again with the same error message. Well, let’s try installing Rust Compiler and if that helps.
Install Rust Compiler
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Once the installation is completed, I restarted the current shell to make sure the Rust compiler was in the path and tried installing the qiskit package. Voila! It worked.
Learn to Install Qiskit on Windows.