Re: [psutil] psutil fails when ran via python-debug

87 views
Skip to first unread message

Giampaolo Rodolà

unread,
Feb 2, 2013, 8:01:26 AM2/2/13
to psu...@googlegroups.com
Hi,
what's python-debug?

2013/2/2 patrick korsnick <kors...@gmail.com>:
> # python-debug foo.py
> No module named _psutil_posix
>
> import psutil
> File "/usr/lib/python2.7/site-packages/psutil/__init__.py", line 64, in
> <module>
> import psutil._pslinux as _psplatform
> File "/usr/lib/python2.7/site-packages/psutil/_pslinux.py", line 20, in
> <module>
> import _psutil_posix
> ImportError: No module named _psutil_posix
>
> This is on fedora 18 32bit where i have the following packages installed:
> # rpm -qa | grep -i psutil
> python-psutil-debuginfo-0.6.1-1.fc18.i686
> python-psutil-0.6.1-1.fc18.i686
>
> If I try to run without debug it works fine (python foo.py). Any ideas what
> could be wrong?
>
> --
> --
> You received this message because you are subscribed to the "Python process
> utilities (psutil)" project group:
> http://code.google.com/p/psutil
> To post to this group, send email to psu...@googlegroups.com
> To unsubscribe from this group, send email to
> psutil-un...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/psutil
> ---
> You received this message because you are subscribed to the Google Groups
> "psutil" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to psutil+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Sandro Tosi

unread,
Feb 2, 2013, 8:13:25 AM2/2/13
to psu...@googlegroups.com
On Sat, Feb 2, 2013 at 2:01 PM, Giampaolo Rodolà <g.ro...@gmail.com> wrote:
> what's python-debug?

I think (if it's something like Debian) that it's the debug-flavour
python interpreter (which requires a specific re-build for Python
extensions).

Cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

patrick korsnick

unread,
Feb 4, 2013, 6:54:58 PM2/4/13
to psu...@googlegroups.com
Yes, as far as I know it's a debug enabled version of the interpreter. I believe it's called python-dbg on deb/ubuntu. Here's what the yum info had to say about it:

Installed Packages
Name        : python-debug
Arch        : x86_64
Version     : 2.7.3
Release     : 13.fc18
Size        : 6.4 M
Repo        : installed
From repo   : fedora
Summary     : Debug version of the Python runtime
URL         : http://www.python.org/
License     : Python
Description : python-debug provides a version of the Python runtime with
            : numerous debugging features enabled, aimed at advanced Python
            : users, such as developers of Python extension modules.
            : 
            : This version uses more memory and will be slower than the regular
            : Python build, but is useful for tracking down reference-counting
            : issues, and other bugs.
            : 
            : The bytecodes are unchanged, so that .pyc files are compatible
            : between the two version of Python, but the debugging features mean
            : that C/C++ extension modules are ABI-incompatible with those built
            : for the standard runtime.
            : 
            : It shares installation directories with the standard Python
            : runtime, so that .py and .pyc files can be shared.  All compiled
            : extension modules gain a "_d" suffix ("foo_d.so" rather than
            : "foo.so") so that each Python implementation can load its own
            : extensions.

I'm trying to debug a nasty threading problem and I'm hoping that running the program with python-debug will shed some more light on it. I have debug versions of all my other python add ons installed, but I can't seem to find a debug version of psutil. Is it possible to 'build' one with debug symbols enabled?

Thanks!

Jay Loden

unread,
Feb 4, 2013, 6:58:54 PM2/4/13
to psu...@googlegroups.com
You can't find a debug version because we haven't provided one ;) 

I'm not really sure what would be required to create a debug build of psutil. Have you tried building psutil with the python-dbg interpreter and setup.py as suggested? It's possible setuptools + python-dbg would figure this out during the build process and already handle the appropriate linker flags.

This has never come up before and I've not ever used python-dbg nor have we encountered anyone asking for a special build for this before, so we're in uncharted territory. 

-Jay

patrick korsnick

unread,
Feb 4, 2013, 7:23:42 PM2/4/13
to psu...@googlegroups.com
Hi Jay,

Running  'sudo python-debug setup.py install ' helped and did generate a _psutil_posix_d.so so my import didn't fail at psutil. This time it failed with:

No module named _core_

So now I'm going to try and figure out what that is and build a debug version of that too.

Thanks!

Jay Loden

unread,
Feb 4, 2013, 7:34:40 PM2/4/13
to psu...@googlegroups.com
Looks like that might be a wxPython module? 

Anyway, good luck, let us know if you do get it working, just for future reference I'd like to make sure we can confirm that setup.py works with python-debug as well. 

Thanks,

-Jay

patrick korsnick

unread,
Feb 5, 2013, 2:31:00 PM2/5/13
to psu...@googlegroups.com
Hi Jay,

On Monday, February 4, 2013 5:34:40 PM UTC-7, Jay wrote:
Looks like that might be a wxPython module? 

Anyway, good luck, let us know if you do get it working, just for future reference I'd like to make sure we can confirm that setup.py works with python-debug as well. 

 To assist with the confirmation, here's the output of 'python-debug setup.py build' on a 64bit f18 system:

$ python-debug setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7-pydebug
creating build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_psmswindows.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/error.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7-pydebug/psutil
running build_ext
building '_psutil_linux' extension
creating build/temp.linux-x86_64-2.7-pydebug
creating build/temp.linux-x86_64-2.7-pydebug/psutil
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7-debug -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7-pydebug/psutil/_psutil_linux.o
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7-pydebug/psutil/_psutil_linux.o -L/usr/lib64 -lpython2.7_d -o build/lib.linux-x86_64-2.7-pydebug/_psutil_linux_d.so
building '_psutil_posix' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7-debug -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-2.7-pydebug/psutil/_psutil_posix.o
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7-pydebug/psutil/_psutil_posix.o -L/usr/lib64 -lpython2.7_d -o build/lib.linux-x86_64-2.7-pydebug/_psutil_posix_d.so
[42240 refs]
Reply all
Reply to author
Forward
0 new messages