Closed SamTov closed 1 year ago
Thanks for the heads up, I just did a pip install neural-tangents
(latest is 0.6.4) and it works on my macbook, could you please paste the error message / give more details? There's only one commit since the release now https://github.com/google/neural-tangents/compare/v0.6.4...main which is to my knowledge is just refactoring...
romann@romann-macbookpro3 ~> pip install neural-tangents --upgrade (base)
Collecting neural-tangents
Downloading neural_tangents-0.6.4-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.8/247.8 kB 11.0 MB/s eta 0:00:00
Collecting tf2jax>=0.3.5
Using cached tf2jax-0.3.5-py3-none-any.whl (91 kB)
Collecting jax>=0.4.14
Using cached jax-0.4.14-py3-none-any.whl
Requirement already satisfied: frozendict>=2.3.8 in ./opt/anaconda3/lib/python3.9/site-packages (from neural-tangents) (2.3.8)
Requirement already satisfied: typing-extensions>=4.7.1 in ./opt/anaconda3/lib/python3.9/site-packages (from neural-tangents) (4.7.1)
Requirement already satisfied: importlib-metadata>=4.6 in ./opt/anaconda3/lib/python3.9/site-packages (from jax>=0.4.14->neural-tangents) (4.11.3)
Requirement already satisfied: ml-dtypes>=0.2.0 in ./opt/anaconda3/lib/python3.9/site-packages (from jax>=0.4.14->neural-tangents) (0.2.0)
Collecting numpy>=1.22
Using cached numpy-1.25.2-cp39-cp39-macosx_11_0_arm64.whl (14.0 MB)
Requirement already satisfied: opt-einsum in ./opt/anaconda3/lib/python3.9/site-packages (from jax>=0.4.14->neural-tangents) (3.3.0)
Requirement already satisfied: scipy>=1.7 in ./opt/anaconda3/lib/python3.9/site-packages (from jax>=0.4.14->neural-tangents) (1.11.1)
Collecting jaxlib>=0.1.37
Using cached jaxlib-0.4.14-cp39-cp39-macosx_11_0_arm64.whl (63.5 MB)
Collecting tensorflow-macos>=2.8.0
Using cached tensorflow_macos-2.13.0-cp39-cp39-macosx_12_0_arm64.whl (189.3 MB)
Requirement already satisfied: dm-tree>=0.1.5 in ./opt/anaconda3/lib/python3.9/site-packages (from tf2jax>=0.3.5->neural-tangents) (0.1.8)
Requirement already satisfied: absl-py in ./opt/anaconda3/lib/python3.9/site-packages (from tf2jax>=0.3.5->neural-tangents) (1.3.0)
Requirement already satisfied: zipp>=0.5 in ./opt/anaconda3/lib/python3.9/site-packages (from importlib-metadata>=4.6->jax>=0.4.14->neural-tangents) (3.8.0)
Using cached tensorflow_macos-2.12.0-cp39-cp39-macosx_12_0_arm64.whl (200.8 MB)
Requirement already satisfied: google-pasta>=0.1.1 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.2.0)
Requirement already satisfied: flatbuffers>=2.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (23.1.4)
Requirement already satisfied: wrapt<1.15,>=1.11.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.14.1)
Requirement already satisfied: six>=1.12.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.16.0)
Requirement already satisfied: grpcio<2.0,>=1.24.3 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.52.0rc1)
Collecting numpy>=1.22
Using cached numpy-1.23.5-cp39-cp39-macosx_11_0_arm64.whl (13.4 MB)
Requirement already satisfied: gast<=0.4.0,>=0.2.1 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.4.0)
Requirement already satisfied: tensorflow-estimator<2.13,>=2.12.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.12.0)
Requirement already satisfied: astunparse>=1.6.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.6.3)
Requirement already satisfied: setuptools in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (63.4.1)
Collecting keras<2.13,>=2.12.0
Using cached keras-2.12.0-py2.py3-none-any.whl (1.7 MB)
Requirement already satisfied: packaging in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (21.3)
Requirement already satisfied: h5py>=2.9.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.7.0)
Requirement already satisfied: tensorboard<2.13,>=2.12 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.12.3)
Requirement already satisfied: libclang>=13.0.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (15.0.6.1)
Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.20.3)
Requirement already satisfied: termcolor>=1.1.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.2.0)
Requirement already satisfied: wheel<1.0,>=0.23.0 in ./opt/anaconda3/lib/python3.9/site-packages (from astunparse>=1.6.0->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.37.1)
Requirement already satisfied: requests<3,>=2.21.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.28.1)
Requirement already satisfied: google-auth-oauthlib<1.1,>=0.5 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.0.0)
Requirement already satisfied: markdown>=2.6.8 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.3.4)
Requirement already satisfied: werkzeug>=1.0.1 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.0.3)
Requirement already satisfied: google-auth<3,>=1.6.3 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.16.0)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in ./opt/anaconda3/lib/python3.9/site-packages (from tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.7.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in ./opt/anaconda3/lib/python3.9/site-packages (from packaging->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.0.9)
Requirement already satisfied: rsa<5,>=3.1.4 in ./opt/anaconda3/lib/python3.9/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (4.9)
Requirement already satisfied: pyasn1-modules>=0.2.1 in ./opt/anaconda3/lib/python3.9/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.2.8)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in ./opt/anaconda3/lib/python3.9/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (5.2.1)
Requirement already satisfied: requests-oauthlib>=0.7.0 in ./opt/anaconda3/lib/python3.9/site-packages (from google-auth-oauthlib<1.1,>=0.5->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.3.1)
Requirement already satisfied: charset-normalizer<3,>=2 in ./opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2.21.0->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2.21.0->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (1.26.11)
Requirement already satisfied: certifi>=2017.4.17 in ./opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2.21.0->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (2022.9.24)
Requirement already satisfied: idna<4,>=2.5 in ./opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2.21.0->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.3)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./opt/anaconda3/lib/python3.9/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (0.4.8)
Requirement already satisfied: oauthlib>=3.0.0 in ./opt/anaconda3/lib/python3.9/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard<2.13,>=2.12->tensorflow-macos>=2.8.0->tf2jax>=0.3.5->neural-tangents) (3.2.2)
Installing collected packages: numpy, keras, jaxlib, jax, tensorflow-macos, tf2jax, neural-tangents
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
numba 0.55.1 requires numpy<1.22,>=1.18, but you have numpy 1.23.5 which is incompatible.
Successfully installed jax-0.4.14 jaxlib-0.4.14 keras-2.12.0 neural-tangents-0.6.4 numpy-1.23.5 tensorflow-macos-2.12.0 tf2jax-0.3.5
romann@romann-macbookpro3 ~> python (base)
Python 3.9.13 (main, Aug 25 2022, 18:24:45)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import neural_tangents as nt
>>>
>>> nt.__version__
'0.6.4'
On the GitHub CI with Python 3.10 we install:
neural-tangents=0.6.2
and receive the error:
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
exec(co, module.__dict__)
CI/unit_tests/training_strategies/test_simple_training.py:36: in <module>
from neural_tangents import stax
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/__init__.py:21: in <module>
from . import experimental
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/experimental/__init__.py:15: in <module>
from .empirical_tf.empirical import empirical_ntk_fn_tf
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/experimental/empirical_tf/empirical.py:97: in <module>
from neural_tangents._src.empirical import NtkImplementation, empirical_ntk_fn, DEFAULT_NTK_IMPLEMENTATION, _DEFAULT_NTK_FWD, _DEFAULT_NTK_J_RULES, _DEFAULT_NTK_S_RULES
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/_src/empirical.py:122: in <module>
from .utils import rules
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/_src/utils/rules.py:7: in <module>
from . import utils
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/neural_tangents/_src/utils/utils.py:473: in <module>
x: Union[_ArrayOrShape, jax.ShapedArray],
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/jax/_src/deprecations.py:53: in getattr
raise AttributeError(f"module {module!r} has no attribute {name!r}")
E AttributeError: module 'jax' has no attribute 'ShapedArray'
I re-ran this in a fresh conda environment with Python=3.10.13 with neural-tangents=0.6.4 and it seems there is no more problem. It seems like a problem with the older version. I guess our CI has a dependency issue. Thank you for the fast response.
It seems that the version of NT that is on PyPi is out of date as it throws Jax errors. Could you make a release? It isn't an issue for using NT but we have some software built on top of it and now all of our CI is failing.