Python pip segfault when installing package

丶灬走出姿态 提交于 2021-02-18 04:46:28

问题


Python 2.7.6 (default, Oct 21 2014, 13:39:51) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Been running into this problem forever on our legacy old server running Centos 5.4.

Exception information:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code -11 in /tmp/pip_build_root/macs2

Any ideas? Initially I thought it was python version problem but I upgraded from 2.7.1 to 2.7.6 and still getting the same error.

Pip list:

numpy (1.9.0)
pip (1.5.6)
setuptools (7.0)
wsgiref (0.1.2)

-Edit Returns the same error but with code 1 when i uninstall and use numpy ver 1.4.0.

(gdb) run setup.py install --user Starting program: /usr/local/bin/python2.7 setup.py install --user warning: no loadable sections found in added symbol-file system-supplied DSO at 0x2aaaaaaab000 >>>[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault. append_metastr_to_string (meta=0x20, skip_brackets=0, ret=0x2aaaaf29e1e8) at >numpy/core/src/multiarray/datetime.c:1965 1965 if (meta->base == NPY_FR_GENERIC) {

this was done by wget follow by untarring the ball


回答1:


I bumped into this after reading title of the post because I myself encountered this issue. Presenting my case and solution here for any future reader.

Problem

My workflow looked like this:

$ pip install simplejson
Collecting simplejson
Installing collected packages: simplejson
Successfully installed simplejson
Segmentation fault (core dumped)

Solution

Because I had root privileges on this system, I tried doing a similar flow but as another user and it passed successfully without any issues. I figured it had to do with my user director and thus I wiped my .local folder

$ rm -rf ~/.local

The same workflow above now passed successfully albeit with a pip warning, which as most know wouldn't matter much.

$ pip install simplejson
Collecting simplejson
Installing collected packages: simplejson
Successfully installed simplejson
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Possible Cause

As I try to rewind what I did my user account, with simple user privileges, I force installed pip which would override system's pip at /usr/bin/pip with the one in .local folder. And then I manually removed pip's binaries from my .local folder and this issue started popping up. Seems to me that there were some references still being made to the pip package inside my user account. Might also happen when you are juggling with multiple python versions and manually remove any binaries like I did.




回答2:


Adding --no-binary :all: seemed to do the trick for me.

So your new command should look something like:

pip install <module> --no-binary :all:

I know this is a bit late, but I hope this helps



来源:https://stackoverflow.com/questions/26494324/python-pip-segfault-when-installing-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!