21
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

7
  • I don't see a segfault anywhere. Is there a more complete log that shows one? Commented Oct 21, 2014 at 20:07
  • Also, what command did you run to get this exception? Commented Oct 21, 2014 at 20:07
  • 1
    I was reading error code -11 = segfault signal. also, whenever i do import numpy, i get segfault or if i install the package manually. trying to run a gdb now and will post once complete Commented Oct 21, 2014 at 20:15
  • Please edit information into the question, don't post it in comments. Besides comments having unreadable formatting, that information won't be seen by anyone searching for questions to answer, or questions similar to their own problem, etc. Commented Oct 21, 2014 at 20:34
  • And meanwhile, that run setup.py install --user still isn't enough to know what you were doing. Was that run inside a downloaded and untarred copy of the numpy source? 1.9.0? Please, take a look at the information in your question and try to imagine how anyone could debug it with just what you've posted so far. Commented Oct 21, 2014 at 20:36

3 Answers 3

41

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 directory and thus I wiped my .local folder

$ rm -rf ~/.local/lib/python*

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.

Sign up to request clarification or add additional context in comments.

5 Comments

While this does fix the segmentation fault, it looks like deleting .local can have negative consequences because this directory can contain user-installed programs and settings. In my case this wasn't a problem, but you might want to make sure that you don't have anything you need in there before deleting it. It might be a better idea to remove the Python directory inside .local. On my machine, I have a dir called .local\lib\python3.5, which in turn contains a site-packages dir. You probably need to reinstall all your modules afterwards.
Sorry, it did not work for me, after I had the same issue installing winrm :( I did a right deployment, a test VM, and a 2nd, for prod, failing. The only different thing I did in the wrong one is explicitly installing python3-pip, python3 and then pip install --upgrade pip... and it failed. So, as I had not done yet any other update in the failing VM, I re-deployed these VM, and installed it right, just with sudo apt update; sudo apt upgrade -y; sudo apt install -y software-properties-common python-pip; pip install pywinrm ... And everything worked as it should.
I just had a similar issue (pip install ansible-vault --> segmentation fault (core dumped)) and this helped, thank you very much
This also helped me, but instead of just deleting the directory I just renamed it. I recommend using this redundancy option instead of just going for rm -rf.
Removing only site-packages folder (~/.local/lib/python3.6/site-packages) works too. No need to remove the whole .local folder.
12

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

2 Comments

I think this is a very helpful answer. By adding --no-binary :all: to my pip install <module>, at first I got fatal error: ffi.h: No such file or directory. After running sudo apt install libffi-dev and then re-trying the installation I got fatal error: openssl/opensslv.h: No such file or directory. So I ran sudo apt install libssl-dev and then tried the installation again: pip3 install python-openstackclient --no-binary :all:. This time it installed without errors. Excellent! :-)
To clarify my previous comment, the --no-binary :all: suffix helped me find two apt packages that the python package depends upon. Very helpful indeed. 👍
3

I also had the problem of getting a segfault message when I tried to install Python packages via pip or pip3. So I did some research and reading about the problem.

Common solutions on the internet for the problem

Often some files seem to be broken, which can be solved by deleting the cache, rebuilding a venv or reinstalling the corresponding package.

Note on the solution

In one place I found a trivial comment, but it led me to the solution of my problem:

When you get a segmentation fault, it means that the computer is trying to access restricted area in memory.

I ruled out the possibility that the pip command is intentionally trying to access a wrong memory area, and I quickly came to the conclusion that the hardware was defective. So I booted the PC from a live image with memtest86+, which is also integrated in many images of Linux distributions. There I could see a large number of errors after a short time.

My solution

One of my RAM modules was faulty, so it was a hardware defect.

After replacing the RAM, the problem was solved.

1 Comment

Thank you very much, I was despairing and never thought that the RAM was the problem. 2 of my 4 sticks were defective.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.