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!

贡献者指南