4

I have installed and call the numpy library the following way. But why it gave segfault? How can overcome the problem?

[pdubois@mymachine Tools]$ pip install numpy 
Requirement already satisfied (use --upgrade to upgrade): numpy in /misc/u21/pdubois/.python2.7.6/lib/python2.7/site-packages/numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
Cleaning up..

Also with easy_install

[pdubois@mymachine ~]$ easy_install-2.7.6 numpy 
Searching for numpy
Best match: numpy 1.9.0.dev-688b243
Processing numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
numpy 1.9.0.dev-688b243 is already the active version in easy-install.pth
Installing f2py script to /u21/pdubois/.python2.7.6/bin

Using /misc/u21/pdubois/.python2.7.6/lib/python2.7/site-packages/numpy-1.9.0.dev_688b243-py2.7-linux-x86_64.egg
Processing dependencies for numpy
Finished processing dependencies for numpy

It gave me this error:

[pdubois@mymachine Tools]$ python 
Python 2.7.6 (default, Feb  4 2014, 10:19:53) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy 
Segmentation fault

Similarly when I call it using pydoc:

[pdubois@mymachine Tools]$ pydoc numpy 
Segmentation fault
1
  • Which linux distro are you using? Commented Mar 25, 2014 at 3:07

4 Answers 4

3
+50

I suggest you try setting up a python virtual environment using virtualenv and the install numpy in the environment and see if the problem is replicated.

There have been issues of numpy breaking when installed against a system's default python installation. There is a discussion on this here. You can refer to it for further insight on the problem.

Also there are issues with numpy dependency libraries causing the problem. Someone in the discussion pointed out that ATLAS library may an issue and installing numpy without ATLAS solves it.

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

Comments

1

Inside the file pydoc.py, you have to change the default function:

def pipepager(text, cmd):
    """Page through text by feeding it to another program."""
    pipe = os.popen(cmd, 'w')
    try:
        pipe.write(text)
        pipe.close()
    except IOError:
        pass # Ignore broken pipes caused by quitting the pager program.

To:

def pipepager(text, cmd):
    """Page through text by feeding it to another program."""
    import subprocess
    pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE, shell=True).stdin
    try:
        pipe.write(text)
        pipe.close()
    except IOError:
        pass # Ignore broken pipes caused by quitting the pager program.

Apparently the problem goes away when you change the os.popen()

Look here for more information.

Comments

1

Did you try installing the 1.8 instead of the 1.9? the 1.9 is still a beta version. Normally with numpy 1.8 it should work

2 Comments

How can I specify numpy 1.8 with pip or easy_install?
@pdubois hmm, can it be a 64bit vs 32bit problem? (if not that, than i am out of inspiration)
0

I have the same problem when I import numpy 1.9.0 which is compiled by GCC 4.1.2. It is solved by using GCC 4.4.7.

Comments

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.