python with debugging symbols

1 view
Skip to first unread message

Valentin Haenel

unread,
Dec 24, 2014, 6:46:44 PM12/24/14
to co...@continuum.io
I am trying to run a core dump through gdb and gdb can't find the sources (I am guessing):

Program terminated with signal 11, Segmentation fault.
#0  PyObject_Malloc (nbytes=40) at Objects/obmalloc.c:813
813    Objects/obmalloc.c: No such file or directory.
(gdb) up
#1  0x00007fe7d9f11935 in PyObject_Realloc (p=0x7fe7cf829fb0, nbytes=<optimized out>) at Objects/obmalloc.c:1252
1252    in Objects/obmalloc.c

I have no idea what I am doing, but could it be that I need the sources or a debug package? Is this available in conda?

V-

Valentin Haenel

unread,
Feb 22, 2015, 12:29:38 PM2/22/15
to co...@continuum.io
Any news on this?

I saw there is a:

                             2.7.9                        d1  defaults        [debug]

But I am not sure how to install this?

V-

Ilan Schnell

unread,
Feb 22, 2015, 12:44:19 PM2/22/15
to Valentin Haenel, conda
Hi Valentin,
the C source code of Python is not included in the conda package.  I would download the Python source code from python.org, and look up line 1252 in Objects/obmalloc.c to see what might be going on.
The [debug] package, i.e. python-2.7.9-d1.tar.bz2 does not contain the Python source code either.  It is a build of Python which uses the --with-pydebug option during the configuration step.  This option allows having access to some Python internals at runtime such as sys.gettotalrefcount().

- Ilan

--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@continuum.io.
To post to this group, send email to co...@continuum.io.
Visit this group at http://groups.google.com/a/continuum.io/group/conda/.

Valentin Haenel

unread,
Feb 28, 2015, 2:46:23 PM2/28/15
to Ilan Schnell, conda
Hi Ilan,

thanks for your answer!

* Ilan Schnell <il...@continuum.io> [2015-02-22]:
> the C source code of Python is not included in the conda package. I would
> download the Python source code from python.org, and look up line 1252 in
> Objects/obmalloc.c to see what might be going on.
> The [debug] package, i.e. python-2.7.9-d1.tar.bz2 does not contain the
> Python source code either. It is a build of Python which uses the
> --with-pydebug option during the configuration step. This option allows
> having access to some Python internals at runtime such as
> sys.gettotalrefcount().

Okay, I actually compliled my own Python with exactly that flag and it
leads to a different error:

Fatal Python error: numpy/core/src/multiarray/refcount.c:184 object at
0x7f847a6af930 has negative ref count -2604246222170760230

hmm...

Anyway, could you tell me how to install the d1 package? I'd like to try
out and it see if that one behaves differently to the one I compiled
locally, thanks!

V-

Ilan Schnell

unread,
Feb 28, 2015, 2:51:04 PM2/28/15
to Ilan Schnell, conda
Hi Valentin,
 you can install the Python debug package using:
$ conda install debug

This installs a meta-package which adds the 'debug' feature to the conda environment, which then causes the python package to be replaced by the one which has this feature.  This is the same mechanism which we use to switch between mkl-linked and non-mkl-linked versions of numpy, scipy, etc.

- Ilan

Valentin Haenel

unread,
Feb 28, 2015, 2:53:49 PM2/28/15
to Ilan Schnell, conda
* Ilan Schnell <il...@continuum.io> [2015-02-28]:
> Hi Valentin,
> you can install the Python debug package using:
> $ conda install debug
>
> This installs a meta-package which adds the 'debug' feature to the conda
> environment, which then causes the python package to be replaced by the one
> which has this feature. This is the same mechanism which we use to switch
> between mkl-linked and non-mkl-linked versions of numpy, scipy, etc.

Awesome, thanks!

V-

Valentin Haenel

unread,
Feb 28, 2015, 3:00:54 PM2/28/15
to Ilan Schnell, conda
* Valentin Haenel <vale...@haenel.co> [2015-02-28]:
Yeah, it gives the same error as my locally installed one.

BTW: I had to install numpy from source because it wouldn't work with
the d1 python, is this expected?

V-

Ilan Schnell

unread,
Feb 28, 2015, 3:21:24 PM2/28/15
to Ilan Schnell, conda
Thanks for being the numpy import problem to attention.  I get:
Symbol not found: _Py_InitModule4_64

This problem is not specific to numpy, however.  Any C extension you try to import from the debug build had this problem.  I'm not sure how to solve this without having to recompile the extension modules.

- Ilan

Valentin Haenel

unread,
Feb 28, 2015, 3:28:27 PM2/28/15
to Ilan Schnell, conda
* Ilan Schnell <il...@continuum.io> [2015-02-28]:
> Thanks for being the numpy import problem to attention. I get:
> Symbol not found: _Py_InitModule4_64
>
> This problem is not specific to numpy, however. Any C extension you try to
> import from the debug build had this problem. I'm not sure how to solve
> this without having to recompile the extension modules.

Yes, I get the same error and had exactly the same line of reasoning.

V-

Antoine Pitrou

unread,
Feb 28, 2015, 4:26:25 PM2/28/15
to co...@continuum.io
On Sat, 28 Feb 2015 14:21:23 -0600
Ilan Schnell <il...@continuum.io> wrote:
> Thanks for being the numpy import problem to attention. I get:
> Symbol not found: _Py_InitModule4_64
>
> This problem is not specific to numpy, however. Any C extension you try to
> import from the debug build had this problem. I'm not sure how to solve
> this without having to recompile the extension modules.

Yes, it is mandatory to recompile extension modules because the ABI
isn't the same in debug mode.

Note on Python 3, you could offer all variants in a single package,
since filenames are distinguished by version and ABI flags (e.g.
"readline.cpython-34m.so"). Under Python 2, not so much.

Regards

Antoine.


Yuri Bochkarev

unread,
Mar 3, 2015, 9:32:29 AM3/3/15
to co...@continuum.io, il...@continuum.io
I want to compile CPython with custom options (--disable-pymalloc) and use it inside of conda. How do I do that? Is there a default receipt in conda/binstar for python that I could modify for my needs? I could not find any. Could you point me please?

Yuri Bochkarev

unread,
Mar 3, 2015, 3:07:54 PM3/3/15
to co...@continuum.io, il...@continuum.io
For those unlucky and desperate ones who followed the path similar to mine and didn't find a CPython recipe, here it is:
https://github.com/hajs/pylodger/tree/master/recipes/base/python
Reply all
Reply to author
Forward
0 new messages