How can I solve this installation problem with fastavro on Mac?

huangapple go评论65阅读模式
英文:

How can I solve this installation problem with fastavro on Mac?

问题

我试图在我的Mac上运行一个需要处理.avro二进制文件的Python程序。尽管我尝试使用pip install fastavro来安装它,但我总是在终端上收到以下以以下行结束的错误消息:

...
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fastavro
Failed to build fastavro
ERROR: Could not build wheels for fastavro, which is required to install pyproject.toml-based projects

我已经在我的PC上将conda升级到最新版本并更新了pip。有人知道如何解决这个问题吗?我真的需要尽快在Mac上运行这个程序。供您参考,我能够在Windows上安装和使用fastavro,但在Mac上不行,因此这可能是一个特定于Mac的问题。非常感谢。

英文:

I am trying to run in my Mac a Python program which requires working with .avro binary files.
Despite trying to install it by using: pip install fastavro, I always get an error message on the terminal that ends with the following lines:

...
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fastavro
Failed to build fastavro
ERROR: Could not build wheels for fastavro, which is required to install pyproject.toml-based projects

I have updated conda to its latest version on my PC as well as updated pip as well.
Does anyone know how to solve this? I really need to run this program on Mac as soon as possible. For your information, I am able to install and use fastavro on Windows but not on Mac so this is likely to be a Mac-specific problem.
Thanks a lot

答案1

得分: 1

由于您正在使用conda环境,为什么不使用conda安装呢?我经常发现通过conda安装更方便,因为它会处理所有非Python依赖项。

所以首先尝试使用pip卸载包:pip uninstall fastavro,然后通过conda安装它:conda install fastavro -c conda-forge

如果您对-c conda-forge标志不熟悉,它告诉conda在conda-forge通道上查找该包,该通道几乎包含了所有不在标准通道上可用的包。

英文:

Since you are working in a conda environment, why not install it with conda? I often find installations via conda much more convenient since it takes care of all non-Python dependencies as well.

So try uninstalling the package first with pip: pip uninstall fastavro and then installing it via conda: conda install fastavro -c conda-forge.

In case you are unfamiliar with the -c conda-forge flag, it tells conda to look for the package on the conda-forge channel which has almost all packages that are not available via the standard channels.

答案2

得分: 0

以下是翻译好的部分:

我在尝试从源代码安装时遇到相同的错误。
尝试安装预编译二进制文件而不是从源代码构建。

以下对我有效:

pip install fastavro --prefer-binary
英文:

I was facing the same error while trying to install from source.
Try installing a pre-compiled binary instead of building from source.

Below worked for me:

pip install fastavro --prefer-binary

huangapple
  • 本文由 发表于 2023年2月6日 18:52:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75360340.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定