使用pip和virtualenv安装scipy时出现错误,g++退出状态4

10 投票
1 回答
2400 浏览
提问于 2025-04-17 22:30

我在AWS(亚马逊网络服务)上使用一个微型实例,并在里面安装Python 3.3.2的虚拟环境。我尝试过:

pip install scipy

pip install -e git+https://github.com/scipy/scipy.git#egg=scipy

但是最后都卡住了:

  Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

In file included from /home/ubuntu/rose/lib/python3.3/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,

                 from /home/ubuntu/rose/lib/python3.3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,

                 from scipy/sparse/sparsetools/sparsetools.h:5,

                 from scipy/sparse/sparsetools/bsr.cxx:4:

/home/ubuntu/rose/lib/python3.3/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

g++: internal compiler error: Killed (program cc1plus)

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

Running from scipy source directory.

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

"object of type 'type' has no len()" in evaluating 'len(list)' (available names: [])

error: Command "g++ -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D__STDC_FORMAT_MACROS=1 -Iscipy/sparse/sparsetools -I/home/ubuntu/rose/lib/python3.3/site-packages/numpy/core/include -I/usr/local/include/python3.3m -c scipy/sparse/sparsetools/bsr.cxx -o build/temp.linux-x86_64-3.3/scipy/sparse/sparsetools/bsr.o" failed with exit status 4

----------------------------------------
Cleaning up...
  Removing temporary dir /home/ubuntu/rose/build...
Command /home/ubuntu/rose/bin/python3.3 -c "import setuptools, tokenize; __file__='/home/ubuntu/rose/src/scipy/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps failed with error code 1 in /home/ubuntu/rose/src/scipy
Exception information:
Traceback (most recent call last):
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/req.py", line 665, in install
    self.install_editable(install_options, global_options)
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/req.py", line 775, in install_editable
    show_stdout=False)
  File "/home/ubuntu/rose/lib/python3.3/site-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /home/ubuntu/rose/bin/python3.3 -c "import setuptools, tokenize; __file__='/home/ubuntu/rose/src/scipy/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps failed with error code 1 in /home/ubuntu/rose/src/scipy

然后,我试着按照这篇帖子里的方法调整一下交换空间:在亚马逊EC2 Linux微型实例上安装scipy时遇到问题,但这个方法也一直没反应。

有人能帮忙解决这个问题吗?

1 个回答

5

我刚遇到一个类似的错误,觉得我通过把虚拟机的内存从368MB增加到1024MB解决了这个问题。之前我在368MB的虚拟机上成功构建过,但我想可能是其他程序占用了更多的内存。

AWS的微型实例可用的内存不多,所以我想这也可能是导致问题的原因。

撰写回答