I have installed JAX using pip: pip install --upgrade jax jaxlib # CPU-only version
(MACOS 10.14.2 and python 3.6.5)
Got error "UnboundLocalError: local variable 'name' referenced before assignment" when import jax.numpy as np
/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.7 of module 'lapack' does not match runtime version 3.6
return f(args, *kwds)
Traceback (most recent call last):
File "
File "/anaconda3/lib/python3.6/site-packages/jax/__init__.py", line 18, in
import jax.numpy as np # side-effecting import sets up operator overloads
File "/anaconda3/lib/python3.6/site-packages/jax/numpy/__init__.py", line 18, in
from . import linalg
File "/anaconda3/lib/python3.6/site-packages/jax/numpy/linalg.py", line 24, in
from .. import lax_linalg
File "/anaconda3/lib/python3.6/site-packages/jax/lax_linalg.py", line 32, in
from jaxlib import lapack
File "jaxlib/lapack.pyx", line 77, in init lapack
File "jaxlib/lapack.pyx", line 42, in lapack.register_cpu_custom_call_target
File "/anaconda3/lib/python3.6/site-packages/jaxlib/xla_client.py", line 1574, in register_cpu_custom_call_target
c_api.RegisterCpuCustomCallTarget(name, fn)
UnboundLocalError: local variable 'name' referenced before assignment
Thanks for reporting this!
I think the current macOS wheel may only work with Python 3.7. Until we can update the wheels (hopefully in the next day or so!), the options on macOS are (1) use Python 3.7 or (2) build jaxlib from source.
Hi, thanks for prompt, I failed to build it from source as below:
python build/build.py
Downloading bazel from: https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-darwin-x86_64
bazel-0.19.2-darwin-x86_64 [########################################] 100%
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Bazel binary path: ./bazel-0.19.2-darwin-x86_64
Python binary path: /anaconda3/bin/python
MKL-DNN enabled: yes
-march=native: no
CUDA enabled: no
Building XLA and installing it in the jaxlib source tree...
ERROR: /private/var/tmp/_bazel_khuongtran/d7719c87aec9cbbd69027f51fb475ba7/external/local_config_cc/BUILD:58:5: in apple_cc_toolchain rule @local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified to use an Apple CROSSTOOL. If your Xcode version has changed recently, try: "bazel clean --expunge" to re-run Xcode configuration
ERROR: Analysis of target '//build:install_xla_in_source_tree' failed; build aborted: Analysis of target '@local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
INFO: Elapsed time: 25.240s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (20 packages loaded, 75 targets co\
FAILED: Build did NOT complete successfully (20 packages loaded, 75 targets co\
nfigured)
Traceback (most recent call last):
File "build/build.py", line 308, in
main()
File "build/build.py", line 304, in main
[":install_xla_in_source_tree", os.getcwd()])
File "build/build.py", line 50, in shell
output = subprocess.check_output(cmd)
File "/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/anaconda3/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['./bazel-0.19.2-darwin-x86_64', 'run', '--verbose_failures=true', '--config=mkl_open_source_only', ':install_xla_in_source_tree', '/Users/khuongtran/jax_test/jax/build']' returned non-zero exit status 1.
I just uploaded new Jaxlib (0.1.5) wheels for Mac OS X to pypi. Try running
pip install --upgrade jaxlib
and try again.
For the build failure: do you have XCode (and probably the XCode command line tools installed?) If not, try installing them and let us know whether that works.
Closing because the new wheels should fix the problem, but please feel free to reopen if you have further problems.
7.21
Most helpful comment
7.21