iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐍
Installing google/jax with Poetry
Background
I was troubled because google/jax does not support PEP 503.
There is also an issue on the Poetry side.
It seems that something equivalent to pip's --find-links has been implemented since version 1.2.0.
It looks like it can be installed from this version onwards.
Installation Method
$ poetry source add jax https://storage.googleapis.com/jax-releases/jax_releases.html
$ poetry add --source jax jaxlib
$ poetry add jax
With this, 0.3.20+cuda11.cudnn82 of jaxlib was installed, and JAX can now recognize CUDA.
How It Works
jax[cuda] and jax[tpu] are installation methods using a mechanism called extras.
On the package side, this can be specified by writing extras_require in setup.py.
JAX's mechanism seems to switch backends by changing the jaxlib implementation depending on the extras.
Discussion