tensorflow -deps-包未找到错误

s4chpxco  于 2023-02-24  发布在  其他
关注(0)|答案(3)|浏览(194)

我在最新的Mac OS 12.1上使用我的新M1 Pro,在安装Tensorflow时遇到问题。
我安装Miniforge3使用:

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh

sh ~/Downloads/Miniforge3-MacOSX-arm64.sh

source ~/miniforge3/bin/activate

我创造了一个环境并激活了它。
然后我试着

conda install -c apple tensorflow-deps

下面是返回的内容:

Collecting package metadata (current_repodata.json): done

Solving environment: failed with initial frozen solve. Retrying with flexible solve.

Collecting package metadata (repodata.json): done

Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:
  - tensorflow-deps

Current channels:

  - https://conda.anaconda.org/apple/osx-64
  - https://conda.anaconda.org/apple/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you`re
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

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

conda info

active env location : /Users/andrewli/tensorflow-test/env
            shell level : 2
       user config file : /Users/andrewli/.condarc
 populated config files : /Users/andrewli/.condarc
          conda version : 4.10.3
    conda-build version : 3.21.5
         python version : 3.9.7.final.0
       virtual packages : __osx=10.16=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/andrewli/opt/anaconda3  (writable)
      conda av data dir : /Users/andrewli/opt/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/andrewli/opt/anaconda3/pkgs
                          /Users/andrewli/.conda/pkgs
       envs directories : /Users/andrewli/opt/anaconda3/envs
                          /Users/andrewli/.conda/envs
               platform : osx-64
             user-agent : conda/4.10.3 requests/2.26.0 CPython/3.9.7 Darwin/21.2.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False

有人有同样的问题吗?有什么建议吗?

mjqavswn

mjqavswn1#

我也遇到了同样的问题,一开始你应该像这个指南https://makeoptim.com/en/deep-learning/tensorflow-metal一样安装miniforge,首先从GitHub下载,然后在终端写“bash(Miniforge文件的完整路径)”,然后创建虚拟环境,写“conda install -c apple tensorflow-deps”。

mklgxw1f

mklgxw1f2#

我按照这里的说明
我也遇到过同样的问题,但是最后我发现我安装的不完全是错误的,我总是停留在下面的步骤视图中,一开始,当我看到这个视图时,我认为我已经完成并关闭了终端,开始做下一步。
enter image description here
最后,我发现我需要一直按回车键,直到安装步骤完成,然后我才可以开始创建env和安装tensorflow。这个步骤很容易遵循。我不知道你是否有和我一样的问题。供你参考。

ztyzrc3y

ztyzrc3y3#

这个视频真的很有帮助:https://www.youtube.com/watch?v=BEUU-icPg78(“tensorflow :Mac M1/M2:康达|tensorflow -深度-包未发现错误”)
根据这段视频,问题很可能在于你安装了x86的anaconda或者miniconda,而没有安装arm,你可以在你的python的conda base env中测试这个问题,方法是:

>>> import platform
>>> platform.platform()
'macOS-12.6.3-arm64-arm-64bit'

如果平台不是arm 64,python仍然在运行通过rosetta 2模拟的x86代码,conda找不到tensorflow-deps,要解决这个问题,你必须卸载conda然后重新安装,但是这次使用正确的版本(arm,而不是x86),希望这能有所帮助,更多信息可以在视频中找到。

相关问题