在Ubuntu 12.04上安装Pandas失败

时间:2014-01-12 13:33:34

标签: python ubuntu pandas install

根据Pandas社区页面(http://pandas.pydata.org/community.html),我先发布在这里......

我正在尝试使用pip在运行Ubuntu 12.04.3(64位)的vanilla远程服务器上的虚拟环境中安装Pandas。我已经安装了通常的嫌疑人(python-dev(2.7),numpy,scipy)。 Pandas没有安装,我不确定要更改或添加什么以确保发生这种情况。

我看到其他引用(没有相同的错误)暗示内存可能是一个问题;远程服务器(Digital Ocean Droplet)只有512MB。

点差错误日志的尾部如下所示:

gcc: internal compiler error: Killed (program cc1)

Please submit a full bug report,

with preprocessed source if appropriate.

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

error: command 'gcc' failed with exit status 4

----------------------------------------

Command /srv/tp/venv/bin/python -c "import setuptools;__file__='/srv/tp/venv/build/pandas/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0bOHrG-record/install-record.txt --install-headers /srv/tp/venv/include/site/python2.7 failed with error code 1 in /srv/tp/venv/build/pandas

Exception information:
Traceback (most recent call last):
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
    requirement.install(install_options, global_options)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /srv/tp/venv/bin/python -c "import setuptools;__file__='/srv/tp/venv/build/pandas/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0bOHrG-record/install-record.txt --install-headers /srv/tp/venv/include/site/python2.7 failed with error code 1 in /srv/tp/venv/build/pandas

3 个答案:

答案 0 :(得分:5)

我在ubuntu上遇到了同样的问题和错误,然后创建了一个交换文件,它就解决了!可以在下面的链接中找到一个教程,但简而言之:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

创建交换文件后,我重新启动了服务器,输入了pip install pandas,它终于有效了。

答案 1 :(得分:4)

最安全的方法就是:sudo apt-get install python-pandas

答案 2 :(得分:2)

可能是内存不足错误。在您的日志顶部,我可以看到gcc退出,代码错误4.当我谷歌它时,我看到了一个stackoverflow线程:Installing lxml with pip in virtualenv Ubuntu 12.10 error: command 'gcc' failed with exit status 4