Installing Jax on Fedora 38

77 views Asked by At

This is a repeat of https://github.com/google/jax/discussions/18084 I have not gotten a response so I am trying Stack Overflow with this question.

I am trying to get the most simple install of Jax on Fedora 38 to work. I have listed what I have tried below. Any help would be appreciated.

>uname -a
Linux brad-mobile 6.4.15-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep  7 00:25:01 UTC 2023 x86_64 GNU/Linux

Following the instructions below Pip Installation: CPU on https://jax.readthedocs.io/en/latest/installation.html#pip-installation-cpu

>pip install --upgrade "jax[cpu]"
Defaulting to user installation because normal site-packages is not writeable
Collecting jax[cpu]
...
Successfully installed jax-0.4.18

>python 
Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jax
Traceback (most recent call last):
...
RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.

Following the instructions below Building jaxlib from source on https://jax.readthedocs.io/en/latest/developer.html#building-jaxlib-from-source

>dnf info python3
...
Installed Packages
Name         : python3
Version      : 3.11.5
...

>dnf info python3-devel
...
Installed Packages
Name         : python3-devel
Version      : 3.11.5
...

>dnf info llvm
...
Installed Packages
Name         : llvm
Version      : 16.0.6
Release      : 3.fc38
...

>pip list | grep numpy
numpy                         1.24.4
pip list | grep wheel
wheel                         0.41.2
>pip list | grep build
build                         0.10.0

>git clone https://github.com/google/jax.git jax.git
Cloning into 'jax.git'...
...
Resolving deltas: 100% (89061/89061), done.

>cd jax.git
>python build/build.py 

     _   _  __  __
    | | / \ \ \/ /
 _  | |/ _ \ \  /
| |_| / ___ \/  \
 \___/_/   \/_/\_\

...
[594 / 6,049] Generating code from table: lib/Target/RISCV/RISCV.td @llvm-project//llvm:RISCVTargetParserDefGen__gen_riscv_target_def_genrule; 2s local ... (8 actions, 7 running)
ERROR: /home/bradbell/.cache/bazel/_bazel_bradbell/81f0ce46861f9615223bf8c46633f0cc/external/llvm-project/llvm/BUILD.bazel:822:7: Generating code from table: include/llvm/IR/Attributes.td @llvm-project//llvm:attributes_gen__gen_attrs_genrule failed: (Illegal instruction): bash failed: error executing command (from target @llvm-project//llvm:attributes_gen__gen_attrs_genrule) 
  (cd /home/bradbell/.cache/bazel/_bazel_bradbell/81f0ce46861f9615223bf8c46633f0cc/execroot/__main__ && \
  exec env - \
    LD_LIBRARY_PATH='' \
    PATH=/home/bradbell/bin:/home/bradbell/devel:/home/bradbell/.local/bin:/home/bradbell/bin:/home/bradbell/.local/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/k8-opt-exec-50AE0418/bin/external/llvm-project/llvm/llvm-min-tblgen -I external/llvm-project/llvm/include -I external/llvm-project/clang/include -I $(dirname external/llvm-project/llvm/include/llvm/IR/Attributes.td) -gen-attrs external/llvm-project/llvm/include/llvm/IR/Attributes.td  -o bazel-out/k8-opt/bin/external/llvm-project/llvm/include/llvm/IR/Attributes.inc')
# Configuration: a39dedde6abf8777e291fd040fec0636b686882b349344396e18811f9c5e08dd
# Execution platform: @local_execution_config_platform//:platform
ERROR: /home/bradbell/.cache/bazel/_bazel_bradbell/81f0ce46861f9615223bf8c46633f0cc/external/llvm-project/llvm/BUILD.bazel:1192:7: Generating code from table: lib/Target/RISCV/RISCV.td @llvm-project//llvm:RISCVTargetParserDefGen__gen_riscv_target_def_genrule [for tool] failed: (Illegal instruction): bash failed: error executing command (from target @llvm-project//llvm:RISCVTargetParserDefGen__gen_riscv_target_def_genrule) 
  (cd /home/bradbell/.cache/bazel/_bazel_bradbell/81f0ce46861f9615223bf8c46633f0cc/execroot/__main__ && \
  exec env - \
    LD_LIBRARY_PATH='' \
    PATH=/home/bradbell/bin:/home/bradbell/devel:/home/bradbell/.local/bin:/home/bradbell/bin:/home/bradbell/.local/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/k8-opt-exec-50AE0418/bin/external/llvm-project/llvm/llvm-min-tblgen -I external/llvm-project/llvm/include -I external/llvm-project/clang/include -I $(dirname external/llvm-project/llvm/lib/Target/RISCV/RISCV.td) -gen-riscv-target-def external/llvm-project/llvm/lib/Target/RISCV/RISCV.td  -o bazel-out/k8-opt-exec-50AE0418/bin/external/llvm-project/llvm/include/llvm/TargetParser/RISCVTargetParserDef.inc')
# Configuration: 30990f7facce3ef11d90223b952af7e216aaeace3e7ddfb0d0a2bc1feff790b1
# Execution platform: @local_execution_config_platform//:platform
[600 / 6,049] Generating code from table: include/llvm/IR/Intrinsics.td @llvm-project//llvm:intrinsic_X86_gen__gen_intrinsic_enums__intrinsic_prefix_x86_genrule; 2s local ... (2 actions running)
Target //jaxlib/tools:build_wheel failed to build
INFO: Elapsed time: 24.706s, Critical Path: 3.32s
INFO: 12 processes: 9 internal, 3 local.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
Traceback (most recent call last):
  File "/home/bradbell/repo/jax.git/build/build.py", line 602, in <module>
    main()
  File "/home/bradbell/repo/jax.git/build/build.py", line 584, in main
    shell(command)
  File "/home/bradbell/repo/jax.git/build/build.py", line 44, in shell
    output = subprocess.check_output(cmd)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['./bazel-6.1.2-linux-x86_64', 'run', '--verbose_failures=true', '//jaxlib/tools:build_wheel', '--', '--output_path=/home/bradbell/repo/jax.git/dist', '--cpu=x86_64']' returned non-zero exit status 1.
1

There are 1 answers

1
jakevdp On

Without more information about your setup, it's hard to guess what might be going wrong.

The fact that you don't have AVX instructions indicates that you may be using a very old CPU; if so, there might just be some fundamental incompatibilities between the current bazel stack and the capabilities of your device.

I'd start by browsing through all the existing JAX issues that mention the error you're seeing (e.g. search for ERROR: Build failed. Not running target) and see if any of the potential solutions apply to your situation.