Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python pip segfault when installing package

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

like image 488
Rudy Avatar asked Oct 21 '14 19:10

Rudy


People also ask

Can you install multiple packages with PIP?

You can add as many packages as you want to the pip install command. In cases like this, a requirements. txt file can come in handy. Later in this tutorial, you'll learn how to use a requirements.

How do I upgrade PIP?

You can update pip using pip without any hassle. When an update for pip is available, and you run a pip command, you will see a message that says, “You are using pip version xy. a, however version xy. b is available.” You can run “pip install --upgrade pip” to install and use the new version of pip.


2 Answers

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/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.

like image 145
arbazkhan002 Avatar answered Oct 10 '22 22:10

arbazkhan002


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

like image 28
sazzy4o Avatar answered Oct 10 '22 22:10

sazzy4o