Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install sonnet on mac m1 #246

Open
maryamastero opened this issue Jun 20, 2022 · 5 comments
Open

Cannot install sonnet on mac m1 #246

maryamastero opened this issue Jun 20, 2022 · 5 comments

Comments

@maryamastero
Copy link

maryamastero commented Jun 20, 2022

I install dm-sonnet and I see:
Requirement already satisfied: sonnet in

/Users/maryamkia/Homebrew/Caskroom/miniforge/base/envs/pytorch_x86/lib/python3.8/site-packages (0.1.6)
Requirement already satisfied: networkx==1.8.1 in /Users/maryamkia/Homebrew/Caskroom/miniforge/base/envs/pytorch_x86/lib/python3.8/site-packages (from sonnet) (1.8.1)

Note: you may need to restart the kernel to use updated packages.

after reseting kernel and running:

import sonnet as snt
print("Sonnet version {}".format(snt.__version__))

I got:

AttributeError: module 'tensorflow' has no attribute 'GraphKeys'
I work on mac M1

@tomhennigan
Copy link
Collaborator

Hi @maryamkiashemshaki it sounds like you've got Sonnet 1.0 installed alongside TensorFlow 2.X.

If you want to use TensorFlow 2, then you need to use Sonnet 2.0 (released in March 2020). You can find installation instructions here: https://github.com/deepmind/sonnet#installation

If you need to use Sonnet 1.X (for example to work with some legacy code) then please install TensorFlow 1. If you are using pip I think you can use: pip install "tensorflow<2".

@maryamastero
Copy link
Author

I cannot install Sonnet 2.0 or Tensorflow<2 on my mac M1.

I cannot have a working pair of TensorFlow and sonnet on my mac. However, I could install them on colab by:

pip install "tensorflow-gpu<2" "dm-sonnet<2" "tensorflow-probability==0.7.0"

@tomhennigan
Copy link
Collaborator

I'm afraid I don't have an M1 to test on, I'm glad you got things working in Colab and I hope that unblocks you.

Sonnet 1 is in maintenance mode only at this point (there have been no changes in v1 for 2 years), we recommend all users migrate to TensorFlow 2 and Sonnet 2 (or to JAX + Haiku if you prefer).

I would expect Sonnet 2 to "just work" on M1 (if you pip install --upgrade "dm-sonnet>=2") since it is a pure Python library with no native code.

@drscotthawley
Copy link

I cannot install Sonnet 2.0 or Tensorflow<2 on my mac M1.

I cannot have a working pair of TensorFlow and sonnet on my mac. However, I could install them on colab by:

pip install "tensorflow-gpu<2" "dm-sonnet<2" "tensorflow-probability==0.7.0"

Trying this pip install on Colab no longer works (at least for me):

ERROR: Could not find a version that satisfies the requirement tensorflow-gpu<2 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.12.0)
ERROR: No matching distribution found for tensorflow-gpu<2

@tomhennigan
Copy link
Collaborator

Hi @drscotthawley , I replied on your other thread which should help unblock you with Sonnet 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants