2022-09-22 12:26:48 -07:00
|
|
|
# Copyright 2018 The JAX Authors.
|
2018-11-19 13:29:47 -08:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2023-09-07 08:45:48 -07:00
|
|
|
import importlib
|
2022-08-01 16:00:16 -07:00
|
|
|
import os
|
|
|
|
|
2018-12-11 15:45:56 -08:00
|
|
|
from setuptools import setup, find_packages
|
2019-02-13 20:02:14 -08:00
|
|
|
|
2023-09-07 08:45:48 -07:00
|
|
|
project_name = 'jax'
|
|
|
|
|
2025-02-18 09:29:24 -08:00
|
|
|
_current_jaxlib_version = '0.5.1'
|
2024-07-29 12:49:08 -07:00
|
|
|
# The following should be updated after each new jaxlib release.
|
2025-02-24 16:07:26 -05:00
|
|
|
_latest_jaxlib_version_on_pypi = '0.5.1'
|
2024-10-22 11:45:58 -07:00
|
|
|
|
2025-02-27 17:22:29 -08:00
|
|
|
_libtpu_version = '0.0.10.*'
|
2019-08-04 12:12:53 -04:00
|
|
|
|
2023-09-07 08:45:48 -07:00
|
|
|
def load_version_module(pkg_path):
|
|
|
|
spec = importlib.util.spec_from_file_location(
|
2023-09-07 10:06:32 -07:00
|
|
|
'version', os.path.join(pkg_path, 'version.py'))
|
2023-09-07 08:45:48 -07:00
|
|
|
module = importlib.util.module_from_spec(spec)
|
|
|
|
spec.loader.exec_module(module)
|
|
|
|
return module
|
2023-09-07 10:06:32 -07:00
|
|
|
|
2023-09-07 08:45:48 -07:00
|
|
|
_version_module = load_version_module(project_name)
|
|
|
|
__version__ = _version_module._get_version_for_build()
|
2024-06-13 10:50:24 -04:00
|
|
|
_jax_version = _version_module._version # JAX version, with no .dev suffix.
|
2023-09-07 08:45:48 -07:00
|
|
|
_cmdclass = _version_module._get_cmdclass(project_name)
|
|
|
|
_minimum_jaxlib_version = _version_module._minimum_jaxlib_version
|
2018-11-18 15:17:32 -08:00
|
|
|
|
2023-01-05 09:41:18 -08:00
|
|
|
with open('README.md', encoding='utf-8') as f:
|
2022-07-13 14:03:32 -07:00
|
|
|
_long_description = f.read()
|
|
|
|
|
2018-11-18 15:17:32 -08:00
|
|
|
setup(
|
2023-09-07 08:45:48 -07:00
|
|
|
name=project_name,
|
2019-02-13 20:02:14 -08:00
|
|
|
version=__version__,
|
2023-09-07 08:45:48 -07:00
|
|
|
cmdclass=_cmdclass,
|
2018-11-18 15:17:32 -08:00
|
|
|
description='Differentiate, compile, and transform Numpy code.',
|
2022-07-13 14:03:32 -07:00
|
|
|
long_description=_long_description,
|
|
|
|
long_description_content_type='text/markdown',
|
2018-11-18 15:17:32 -08:00
|
|
|
author='JAX team',
|
2018-12-06 21:35:03 -05:00
|
|
|
author_email='jax-dev@google.com',
|
2025-03-14 07:51:21 -07:00
|
|
|
packages=find_packages(exclude=["*examples*", "*internal_test_util*"]),
|
2022-09-27 12:55:20 -07:00
|
|
|
package_data={'jax': ['py.typed', "*.pyi", "**/*.pyi"]},
|
2024-06-26 13:43:15 -04:00
|
|
|
python_requires='>=3.10',
|
2019-01-15 20:14:19 -05:00
|
|
|
install_requires=[
|
2024-06-13 10:50:24 -04:00
|
|
|
f'jaxlib >={_minimum_jaxlib_version}, <={_jax_version}',
|
2024-10-22 09:04:28 -07:00
|
|
|
'ml_dtypes>=0.4.0',
|
2024-12-18 08:18:57 -05:00
|
|
|
'numpy>=1.25',
|
2023-10-04 21:06:01 +00:00
|
|
|
"numpy>=1.26.0; python_version>='3.12'",
|
2020-12-30 11:29:34 +00:00
|
|
|
'opt_einsum',
|
2025-01-07 16:10:14 -08:00
|
|
|
'scipy>=1.11.1',
|
2019-01-15 20:14:19 -05:00
|
|
|
],
|
2021-03-16 11:40:46 -07:00
|
|
|
extras_require={
|
2021-03-17 10:46:38 -07:00
|
|
|
# Minimum jaxlib version; used in testing.
|
|
|
|
'minimum-jaxlib': [f'jaxlib=={_minimum_jaxlib_version}'],
|
|
|
|
|
2024-06-13 10:50:24 -04:00
|
|
|
# A CPU-only jax doesn't require any extras, but we keep this extra
|
|
|
|
# around for compatibility.
|
|
|
|
'cpu': [],
|
2021-03-16 11:40:46 -07:00
|
|
|
|
2022-02-10 11:29:06 -08:00
|
|
|
# Used only for CI builds that install JAX from github HEAD.
|
2022-02-10 11:58:30 -08:00
|
|
|
'ci': [f'jaxlib=={_latest_jaxlib_version_on_pypi}'],
|
2022-02-10 11:29:06 -08:00
|
|
|
|
2021-06-23 02:18:53 +00:00
|
|
|
# Cloud TPU VM jaxlib can be installed via:
|
2025-02-24 17:50:29 -05:00
|
|
|
# $ pip install "jax[tpu]"
|
2023-08-11 11:46:58 -07:00
|
|
|
'tpu': [
|
2024-06-13 10:50:24 -04:00
|
|
|
f'jaxlib>={_current_jaxlib_version},<={_jax_version}',
|
2024-10-22 11:45:58 -07:00
|
|
|
f'libtpu=={_libtpu_version}',
|
2023-08-11 11:46:58 -07:00
|
|
|
'requests', # necessary for jax.distributed.initialize
|
|
|
|
],
|
2021-06-23 02:18:53 +00:00
|
|
|
|
2024-06-13 10:50:24 -04:00
|
|
|
'cuda': [
|
|
|
|
f"jaxlib=={_current_jaxlib_version}",
|
|
|
|
f"jax-cuda12-plugin[with_cuda]>={_current_jaxlib_version},<={_jax_version}",
|
|
|
|
],
|
2023-12-12 14:40:23 -08:00
|
|
|
|
|
|
|
'cuda12': [
|
|
|
|
f"jaxlib=={_current_jaxlib_version}",
|
2024-06-13 10:50:24 -04:00
|
|
|
f"jax-cuda12-plugin[with_cuda]>={_current_jaxlib_version},<={_jax_version}",
|
2022-10-27 14:53:19 +00:00
|
|
|
],
|
|
|
|
|
2024-06-13 12:36:54 -04:00
|
|
|
# Deprecated alias for cuda12, kept to avoid breaking users who wrote
|
|
|
|
# cuda12_pip in their CI.
|
|
|
|
'cuda12_pip': [
|
|
|
|
f"jaxlib=={_current_jaxlib_version}",
|
|
|
|
f"jax-cuda12-plugin[with_cuda]>={_current_jaxlib_version},<={_jax_version}",
|
|
|
|
],
|
|
|
|
|
2022-10-27 14:53:19 +00:00
|
|
|
# Target that does not depend on the CUDA pip wheels, for those who want
|
|
|
|
# to use a preinstalled CUDA.
|
|
|
|
'cuda12_local': [
|
2024-06-13 10:50:24 -04:00
|
|
|
f"jaxlib=={_current_jaxlib_version}",
|
|
|
|
f"jax-cuda12-plugin=={_current_jaxlib_version}",
|
2022-10-27 14:53:19 +00:00
|
|
|
],
|
2024-07-08 05:08:25 +00:00
|
|
|
|
2024-12-12 00:53:00 -06:00
|
|
|
# ROCm support for ROCm 6.0 and above.
|
|
|
|
'rocm': [
|
|
|
|
f"jaxlib=={_current_jaxlib_version}",
|
|
|
|
f"jax-rocm60-plugin>={_current_jaxlib_version},<={_jax_version}",
|
|
|
|
],
|
|
|
|
|
2024-07-08 05:08:25 +00:00
|
|
|
# For automatic bootstrapping distributed jobs in Kubernetes
|
|
|
|
'k8s': [
|
|
|
|
'kubernetes',
|
|
|
|
],
|
2021-03-16 11:40:46 -07:00
|
|
|
},
|
2024-09-20 07:51:48 -07:00
|
|
|
url='https://github.com/jax-ml/jax',
|
2018-11-18 15:17:32 -08:00
|
|
|
license='Apache-2.0',
|
2020-12-30 11:29:34 +00:00
|
|
|
classifiers=[
|
2022-05-07 13:38:55 +01:00
|
|
|
"Programming Language :: Python :: 3.10",
|
2022-10-14 14:56:07 +00:00
|
|
|
"Programming Language :: Python :: 3.11",
|
2024-03-28 12:59:45 -07:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2024-11-20 08:23:19 -08:00
|
|
|
"Programming Language :: Python :: 3.13",
|
2021-06-10 16:06:11 +02:00
|
|
|
],
|
|
|
|
zip_safe=False,
|
2018-11-18 15:17:32 -08:00
|
|
|
)
|