Google cloud storage 计算引擎使用gsutil下载tgz文件时出现crcmod错误

Google cloud storage 计算引擎使用gsutil下载tgz文件时出现crcmod错误,google-cloud-storage,google-compute-engine,Google Cloud Storage,Google Compute Engine,我发现,如果您创建一台计算引擎(CentOS或Debian)计算机,并使用gsutil下载(cp)tgz文件,将导致crcmod错误 $ gsutil cp gs://mybucket/data.tgz . Copying gs://mybucket/data.tgz... CommandException: Downloading this composite object requires integrity checking with CRC32c, but your crcmod ins

我发现,如果您创建一台计算引擎(CentOS或Debian)计算机,并使用gsutil下载(cp)tgz文件,将导致crcmod错误

$ gsutil cp gs://mybucket/data.tgz .
Copying gs://mybucket/data.tgz...
CommandException:
Downloading this composite object requires integrity checking with CRC32c, but
your crcmod installation isn't using the module's C extension, so the the hash
computation will likely throttle download performance. For help installing the
extension, please see:
  $ gsutil help crcmod
To download regardless of crcmod performance or to skip slow integrity checks,
see the "check_hashes" option in your boto config file.
目前我使用“check_hashes=never”来绕过检查

$ vi /etc/boto.cfg
[GSUtil]
default_project_id = 429100748693
default_api_version = 2
check_hashes = never
...

但是,根本原因是什么?有什么好的解决方法吗?

您试图下载的对象是一个,这基本上意味着它是以并行块的形式上传的。gsutil在上载大于150M(可配置的阈值)的对象时自动执行此操作,以提供更好的性能

复合对象只有crc32c校验和(无MD5),因此为了在下载复合对象时验证数据完整性,gsutil需要执行crc32c校验和。不幸的是,与Python一起分发的库不包括已编译的crc32c实现,因此除非安装已编译的crc32c,否则gsutil将使用速度相当慢的未编译的crc32c Python实现。打印该警告是为了让您知道有一种方法可以解决该性能问题:请运行:

gsutil help crcmod
并按照此处的说明安装已编译的crc32c。这很容易做到,值得付出努力


另一个注意事项:我强烈建议不要在boto配置文件中设置
check\u hashes=never
。这将禁用完整性检查,这意味着您的下载可能会损坏,而您可能不知道。您希望启用数据完整性检查以确保使用正确的数据。

是否有任何方法可以将
检查散列作为
gsutil
的参数传递给单个命令执行?Robert-您可以使用gsutil-o选项将配置文件参数传递给gsutil,例如gsutil-o gsutil:check_hashes=if_fast_else_fail cp file gs://my-bucket@MikeSchwartz我正在使用conda环境的HPC上工作,并使用
conda安装crcmod
安装了crcmod。它仍然在
gsutil version-l
下显示编译的crcmod:False,我的下载因此停止。我没有管理员权限从源代码处编译它。有什么建议吗?@Enigma-我没有和Conda合作过,但通过快速的网络搜索,它看起来像是一个软件包和环境管理器。因此,我怀疑问题在于安装crcmod和设置环境变量,只有在该环境中运行的软件才会使用这些包。我怀疑您没有在该环境中运行gsutil。@Mikeshwartz我也安装了。到目前为止,我已经跳过了那些因为这个原因而无法下载的。