Spyder: Listing of python modules with help() segfaults when Spyder is installed

Created on 20 Jan 2017  路  13Comments  路  Source: spyder-ide/spyder

When I install "spyder", the listing of all python modules that you usually get by typing "modules" in the help() mode, segfaults:

#

$ python
Python 2.7.12 (default, Oct 25 2016, 17:04:12)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

help()

Welcome to Python 2.7! This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules

Please wait a moment while I gather a list of all available modules...

Segmentation fault

#

Running gdb on the generated core gives me this stacktrace:

#

0 0x00007fb93d8060b1 in ?? () from /sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

1 0x00007fb93d80867d in ?? () from /sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

2 0x00007fb93d80e5b8 in QFontDatabase::addApplicationFont(QString const&) () from /sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

3 0x00007fb945502af7 in meth_QFontDatabase_addApplicationFont () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/site-packages/PyQt5/QtGui.so

4 0x00007fb972283a24 in PyEval_EvalFrameEx () at Python/ceval.c:4350

5 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

6 0x00007fb9721fd0ac in function_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

7 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

8 0x00007fb97227f2d5 in PyEval_EvalFrameEx () at Python/ceval.c:4664

9 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

10 0x00007fb9721fd0ac in function_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

11 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

12 0x00007fb9721d97ed in instancemethod_call () at Objects/classobject.c:2602

13 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

14 0x00007fb97223761d in slot_tp_init () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

15 0x00007fb97223624f in type_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

16 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

17 0x00007fb972283445 in PyEval_EvalFrameEx () at Python/ceval.c:4567

18 0x00007fb972284494 in PyEval_EvalFrameEx () at Python/ceval.c:4435

19 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

20 0x00007fb9722843b4 in PyEval_EvalFrameEx () at Python/ceval.c:4445

21 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

22 0x00007fb9722843b4 in PyEval_EvalFrameEx () at Python/ceval.c:4445

23 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

24 0x00007fb9722843b4 in PyEval_EvalFrameEx () at Python/ceval.c:4445

25 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

26 0x00007fb972288539 in PyEval_EvalCode () at Python/ceval.c:669

27 0x00007fb97229c52d in PyImport_ExecCodeModuleEx () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

28 0x00007fb97229c88e in load_source_module () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

29 0x00007fb97229d679 in import_submodule () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

30 0x00007fb97229e3c4 in PyImport_ImportModuleLevel () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

31 0x00007fb97227b4f8 in builtin___import__ () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

32 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

33 0x00007fb97227d0a7 in PyEval_CallObjectWithKeywords () at Python/ceval.c:4219

34 0x00007fb972281fcc in PyEval_EvalFrameEx () at Python/ceval.c:2622

35 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

36 0x00007fb972288539 in PyEval_EvalCode () at Python/ceval.c:669

37 0x00007fb97229c52d in PyImport_ExecCodeModuleEx () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

38 0x00007fb97229c88e in load_source_module () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

39 0x00007fb97229d679 in import_submodule () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

40 0x00007fb97229e30d in PyImport_ImportModuleLevel () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

41 0x00007fb97227b4f8 in builtin___import__ () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

42 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

43 0x00007fb97227d0a7 in PyEval_CallObjectWithKeywords () at Python/ceval.c:4219

44 0x00007fb972281fcc in PyEval_EvalFrameEx () at Python/ceval.c:2622

45 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

46 0x00007fb972288539 in PyEval_EvalCode () at Python/ceval.c:669

47 0x00007fb97229c52d in PyImport_ExecCodeModuleEx () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

48 0x00007fb97229c88e in load_source_module () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

49 0x00007fb97229dc00 in load_package () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

50 0x00007fb97229d679 in import_submodule () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

51 0x00007fb97229e30d in PyImport_ImportModuleLevel () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

52 0x00007fb97227b4f8 in builtin___import__ () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

53 0x00007fb972283a24 in PyEval_EvalFrameEx () at Python/ceval.c:4350

54 0x00007fb9721f10c3 in gen_iternext () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

55 0x00007fb97228215a in PyEval_EvalFrameEx () at Python/ceval.c:2806

56 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

57 0x00007fb9722843b4 in PyEval_EvalFrameEx () at Python/ceval.c:4445

58 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

59 0x00007fb9722843b4 in PyEval_EvalFrameEx () at Python/ceval.c:4445

60 0x00007fb972284494 in PyEval_EvalFrameEx () at Python/ceval.c:4435

61 0x00007fb972284494 in PyEval_EvalFrameEx () at Python/ceval.c:4435

62 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

63 0x00007fb9721fd175 in function_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

64 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

65 0x00007fb9721d97ed in instancemethod_call () at Objects/classobject.c:2602

66 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

67 0x00007fb9721d8736 in instance_call () at Objects/classobject.c:2153

68 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

69 0x00007fb97227f2d5 in PyEval_EvalFrameEx () at Python/ceval.c:4664

70 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

71 0x00007fb9721fd0ac in function_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

72 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

73 0x00007fb9721d97ed in instancemethod_call () at Objects/classobject.c:2602

74 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

75 0x00007fb972237405 in slot_tp_call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

76 0x00007fb9721ca7d3 in PyObject_Call () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

77 0x00007fb972283445 in PyEval_EvalFrameEx () at Python/ceval.c:4567

78 0x00007fb972288410 in PyEval_EvalCodeEx () at Python/ceval.c:3582

79 0x00007fb972288539 in PyEval_EvalCode () at Python/ceval.c:669

80 0x00007fb9722ae041 in PyRun_InteractiveOneFlags () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

81 0x00007fb9722ae25e in PyRun_InteractiveLoopFlags () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

82 0x00007fb9722ae8ae in PyRun_AnyFileExFlags () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

83 0x00007fb9722c46a5 in Py_Main () from /sw/rhel6-x64/python/python-2.7.12-gcc49/lib/libpython2.7.so.1.0

84 0x00007fb971558d1d in __libc_start_main () from /lib64/libc.so.6

85 0x0000000000400741 in _start ()

#

I would guess that it is related to this issue:

https://bugs.debian.org/cgi-bin/bugreport.cgi?att=0;bug=844601;msg=57

So libqt5gui.so segfaults when there is no qt event loop. Which is expected behaviour (say the qt developers). Why is all this qt stuff called when the modules are listed?

I have this behaviour with spyder 3.0.2 and 3.1.0 (these were the ones I tried) and I have this using qt5.7.0 or qt5.5.1.

2-Major Bug

All 13 comments

I think this probably happens because help() introspects PyQt5, and PyQt5 in turn loads all Qt5 libraries.

Short advice: you shouldn't use help(). To see what modules you have installed in your system, you can run in an IPython console %reshashx to remove a cache with your installed modules, then import <Tab>.

I doubt there's something we can do about this, sorry.

Hi Carlos,

thanks for your answer.

Carlos Cordoba wrote on 01/21/2017 05:46 PM:

I think this probably happens because |help()| introspects PyQt5, and
PyQt5 in turn loads all Qt5 libraries.

well, no. Not really. This did not happen until I installed
spyder. So before (when PyQT5, QtPy, ... were already installed),
it still worked.

I straced the thing and can see that the python
works through the [...]/site-packages/PyQt4 and the
[...]/site-packages/PyQt5 directories before without
segfaulting. The segfault happens when it's working
through the spyder directory.

If I move the [...]/site-packages/spyder subdirectory
elsewhere (or remove it), "modules" immediately works again.

Short advice: you shouldn't use |help()|. To see what modules you have
installed in your system, you can run in an IPython console |%reshashx|
to remove a cache with your installed modules, then |import |.

well, it's not me. It's our users. Not an easy job
to tell more than 1000 people that some standard python
stuff does not work anymore...

Regrds, Olaf

--
Dipl. Inform. Olaf Gellert email [email protected]
Deutsches Klimarechenzentrum GmbH phone +49 (0)40 460094 214
Bundesstrasse 45a fax +49 (0)40 460094 270
D-20146 Hamburg, Germany www http://www.dkrz.de

@dalthviz, I think this only happens on Linux, so please test there first.

This Debian bug report may be relevant: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844601

It basically says that the command import spyder.plugins.editor leads to a segfault. I just reproduced this on Debian Linux.

Thanks @jitseniesen! I'm sure that will make @dalthviz easier :-)

Thanks @jitseniesen for the link 馃憤 . @ccordoba12 of what I have tested and readed, the problem is in the qtawesome project, since there we are using the QFontDatabase without a QApplication instance. Probably this is the cause of the segmentation fault

Thanks @jitseniesen for the link

I just found out that @ocarino who reported the bug already provided the same link at the end of their message.

Could you confirm whether Bug-Debian #844601 is related to this issue, please?

Hi,

Ghislain Antony Vaillant wrote on 01/25/2017 10:23 AM:

Could you confirm whether Bug-Debian #844601
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844601 is related to
this issue, please?

from my point of view this looks pretty much the same.
Here is my backtrace from GDB on the dumped core:

0 0x00007fb93d8060b1 in ?? () from

/sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

1 0x00007fb93d80867d in ?? () from

/sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

2 0x00007fb93d80e5b8 in QFontDatabase::addApplicationFont(QString

const&) () from /sw/rhel6-x64/x11/qt-5.5.1-gcc48/lib/libQt5Gui.so.5

3 0x00007fb945502af7 in meth_QFontDatabase_addApplicationFont () from

/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/site-packages/PyQt5/QtGui.so

4 0x00007fb972283a24 in PyEval_EvalFrameEx () at Python/ceval.c:4350

output of #0 and #1 looks different (obviously because there is no
debug information in our QT5 install), but besides of that: Id say
yes, that's the same as the backtrace in the Bug-Debian #844601.

Olaf

Hmm, the Debian bug is definitely related, but I just checked and the proposed fix for this issue does not fix the Debian bug. I opened a new issue for this: #4049.

@ocarino, the solution to this problem is to install qtawesome (one of Spyder dependencies) version 0.4.4 or higher (once I release it, in a couple of days).

Thanks for letting us know about this (very!) nasty problem :-)

Hi,

Carlos Cordoba wrote:

@ocarino https://github.com/ocarino, the solution to this problem is
to install |qtawesome| (one of Spyder dependencies) version 0.4.4 or
higher (once I release it, in a couple of days).

thanks for your work. I just downloaded QtAwesome 0.4.4
(from pypi), but when I try to install it, I get an
error. I try to install it in python 2.7.12 on a centos6
system. Here is the end of the build output:

byte-compiling build/bdist.linux-x86_64/egg/qtawesome/__init__.py to
__init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/qtawesome/_version.py to
_version.pyc
byte-compiling
build/bdist.linux-x86_64/egg/qtawesome/tests/test_qtawesome.py to
test_qtawesome.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying QtAwesome.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying QtAwesome.egg-info/SOURCES.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
copying QtAwesome.egg-info/dependency_links.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
copying QtAwesome.egg-info/requires.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
copying QtAwesome.egg-info/top_level.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
qtawesome.iconic_font: module references __file__
Traceback (most recent call last):
File "setup.py", line 76, in
'Programming Language :: Python :: 3.4',]
File
"/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/distutils/core.py",
line 151, in setup
dist.run_commands()
File
"/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/distutils/dist.py",
line 953, in run_commands
self.run_command(cmd)
File
"/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/distutils/dist.py",
line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py",
line 67, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py",
line 109, in do_egg_install
File
"/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/distutils/cmd.py",
line 326, in run_command
self.distribution.run_command(command)
File
"/sw/rhel6-x64/python/python-2.7.12-gcc49/lib/python2.7/distutils/dist.py",
line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py",
line 209, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py",
line 245, in zip_safe
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py",
line 355, in analyze_egg
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py",
line 392, in scan_module
ValueError: bad marshal data (unknown type code)

Thanks for any help...

Cheers, Olaf

It seems you have an old version of setuptools. Why don't you use pip?

Was this page helpful?
0 / 5 - 0 ratings