这是重复 https://github.com/google/jax/discussions/18084 我还没有得到回复,所以我正在尝试 Stack Overflow 来解决这个问题。
我正在尝试在 Fedora 38 上以最简单的方式安装 Jax 来工作。我在下面列出了我尝试过的内容。任何帮助将不胜感激。
>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
按照下面的说明进行 Pip 安装: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.
按照下面的说明从源代码构建 jaxlib 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.
如果没有有关您的设置的更多信息,很难猜测可能出了什么问题。
如果您没有 AVX 指令,则表明您可能使用的是非常旧的 CPU;如果是这样,当前的 bazel 堆栈和您的设备的功能之间可能存在一些根本的不兼容。
我首先浏览所有提到您所看到的错误的现有 JAX 问题(例如搜索
ERROR: Build failed. Not running target
),看看是否有任何潜在的解决方案适用于您的情况。