tensorflow/quantum

Installation Issues on Apple M1 device

已關閉

#655 建立於 2022年1月18日

 (4 則留言) (1 個反應) (1 位負責人)Python (662 個分叉)github user discovery
area/docsarea/installationhelp wantedkind/bug-reportplatform/macpriority/p3skill-level/intermediate

倉庫指標

星標
 (2,180 顆星)
PR 合併指標
 (平均合併 13天 10小時) (30 天內合併 2 個 PR)

描述

I'm having troubles installing tensorflow-quantum on an Apple M1 device.

Tensorflow installation is fine following Apple's official guide (https://developer.apple.com/metal/tensorflow-plugin/), though I am not able to install tfq, either via pip or building from source:

  • installation via pip requires tensorflow==2.4.1, but Tensorflow for M1 chips comes at least at >v2.5.0;
  • installing from source yields errors due to missing recognized Tensorflow package (configure.sh looks for tensorflow but tensorflow-macos is installed instead), and also due to Bazel, as the required version (3.7.2) is not available for M1 architectures.

Step to reproduce the problem:

First install Tensorflow following Apple's guide, then follow tfq installation procedure https://github.com/tensorflow/quantum/blob/master/docs/install.md

  git clone https://github.com/tensorflow/tensorflow.git
  cd tensorflow
  git checkout v2.7.0 (same version obtained with   python -m pip tensorflow-macos)

  pip install -U pip six numpy wheel setuptools mock 'future>=0.17.1'
  pip install -U keras_applications --no-deps
  pip install -U keras_preprocessing --no-deps
  pip install numpy==1.19.5  (fails to compile wheels, must install with conda install numpy=1.19.5 instead)

  ./configure


WARNING: Package(s) not found: tensorflow
WARNING: Package(s) not found: tf-nightly
WARNING: Package(s) not found: tensorflow-cpu
WARNING: Package(s) not found: tf-nightly-cpu
Installing tensorflow .....\n
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

If modifying the configure.sh by having it look for tensorflow-macos (instead of tensorflow), then problems occur when building with Bazel (the required distribution 3.7.2 is not available for M1 architecture). Installing from source also Tensorflow itself comes with its own bag of installation issues (versions incompatibilities, problems with packages like numpy, grpcio, h5f, ...), and doesn't feel like the best way to proceed.

Is there a workaround or fix? How should one proceed? Thanks!

貢獻者指南