cProfile.py not found.

Discussion in 'Python' started by Rahul, Apr 4, 2009.

  1. Rahul

    Rahul Guest

    I need to profile a slow-running code. The problem is I cannot seem to find
    cProfile.py.

    Where can I get it? Is it not included in the normal distro? I tried
    googling it up and theres tons of info on how to use it but no links for
    where to download it from.

    I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

    I am aware this is kind of dated but some of our legacy codes insist on
    using that exact version.


    --
    Rahul
     
    Rahul, Apr 4, 2009
    #1
    1. Advertising

  2. Rahul

    Robert Kern Guest

    On 2009-04-04 17:46, Rahul wrote:
    > I need to profile a slow-running code. The problem is I cannot seem to find
    > cProfile.py.
    >
    > Where can I get it? Is it not included in the normal distro? I tried
    > googling it up and theres tons of info on how to use it but no links for
    > where to download it from.
    >
    > I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).
    >
    > I am aware this is kind of dated but some of our legacy codes insist on
    > using that exact version.


    What system are you on? Some Linux distributions put it into a separate package,
    like python-profile. The python.org Windows and Mac binaries should have it, though.

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
     
    Robert Kern, Apr 4, 2009
    #2
    1. Advertising

  3. Rahul

    John Yeung Guest

    I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
    the profile module. That is what the docs recommend.

    John
     
    John Yeung, Apr 5, 2009
    #3
  4. Rahul

    Rahul Guest

    Robert Kern <> wrote in
    news::

    > What system are you on? Some Linux distributions put it into a
    > separate package, like python-profile. The python.org Windows and Mac
    > binaries should have it, though.
    >
    >


    THanks Robert. I'm on RHEL.

    Tried yum search python-profile. No hits. Also tried a locate on
    cProfile. No hits again.

    Did a yum search python. Huge list but nothing promising. Yet, I
    reproduce it below just in case its hidden somewhere in the list. What
    options do I have now?

    python-sqlite2.i386 : DB-API 2.0 interface for SQLite 3.x
    tix.i386 : A set of extension widgets for Tk
    tix-devel.i386 : Tk Interface eXtension development files
    tix-doc.i386 : Tk Interface eXtension documentation
    vim-enhanced.i386 : A version of the VIM editor which includes recent
    : enhancements.
    Django.noarch : A high-level Python Web framework
    Django-doc.noarch : Documentation for Django
    MySQL-python.i386 : An interface to MySQL
    OpenIPMI-python.i386 : OpenIPMI Python language bindings
    PyQt.i386 : Python bindings for Qt
    PyQt-examples.i386 : Examples for PyQt
    PyXML.i386 : XML libraries for python.
    PyYAML.noarch : YAML parser and emitter for Python
    Pyrex.noarch : A compiler/language for writing Python extension modules.
    PythonCard.noarch : PythonCard GUI construction toolkit
    R2spec.noarch : Python script to generate R spec file
    SOAPpy.noarch : Full-featured SOAP library for Python
    TurboGears.noarch : Back-to-front web development in Python
    ant-scripts.i386 : Additional scripts for ant
    archivemail.noarch : A tool for archiving and compressing old email in
    mailboxes
    audit-libs-python.i386 : Python bindings for libaudit
    babel.noarch : Tools for internationalizing Python applications
    beecrypt-python.i386 : Files needed for python applications using
    beecrypt.
    booty.noarch : simple python bootloader config lib
    bsf.i386 : Bean Scripting Framework
    cobbler.noarch : Boot server configurator
    ctopy.noarch : C to Python translator
    cvs2svn.noarch : CVS to Subversion Repository Converter
    db4.i386 : The Berkeley DB database library (version 4) for C.
    dbus-python.i386 : D-Bus Python Bindings
    ddd.i386 : GUI for several command-line debuggers
    deluge.i386 : Graphical BitTorrent client with support for DHT, UPnP, and
    PEX
    denyhosts.noarch : A script to help thwart ssh server attacks
    epydoc.noarch : Edward Loper's Python API documentation generation tool
    exaile.i386 : A music player
    flumotion.i386 : Flumotion - the Fluendo Streaming Server
    fuzzyclock.noarch : Generates fuzzy clock output
    gamin-python.i386 : Python bindings for the gamin library
    gdal.i386 : Geospatial Data Abstraction Library
    gdal-python.i386 : Python modules for the GDAL file format library
    getmail.noarch : POP3 mail retriever with reliable Maildir delivery
    glade2.i386 : A GTK+ GUI builder.
    gnome-menus.i386 : A menu system for the GNOME project
    gnome-python2.i386 : The sources for the PyGNOME Python extension module
    gnome-python2-applet.i386 : Python bindings for GNOME Panel applets.
    gnome-python2-bonobo.i386 : Python bindings for interacting with bonobo.
    gnome-python2-canvas.i386 : Python bindings for the GNOME Canvas.
    gnome-python2-desktop.i386 : The sources for additional PyGNOME Python
    extension
    : modules for the GNOME desktop
    gnome-python2-extras.i386 : The sources for additional. PyGNOME Python
    extension
    : modules.
    gnome-python2-gconf.i386 : Python bindings for interacting with GConf
    gnome-python2-gnomedesktop.i386 : Python bindings for interacting with
    gnome-
    : desktop
    gnome-python2-gnomekeyring.i386 : Python bindings for interacting with
    gnome-
    : keyring
    gnome-python2-gnomeprint.i386 : Python bindings for interacting with
    : libgnomeprint
    gnome-python2-gnomevfs.i386 : Python bindings for interacting with gnome-
    vfs
    gnome-python2-gtkhtml2.i386 : Python bindings for interacting with
    gtkhtml2

    python-twisted-names.i386 : A Twisted DNS implementation
    python-twisted-web.i386 : Twisted web server, programmable in Python
    python-twisted-web2.i386 : Twisted web server, programmable in Python
    python-twisted-words.i386 : Twisted Words contains Instant Messaging
    implementations
    python-twitter.noarch : A python wrapper around the Twitter API
    python-tz.noarch : World Timezone Definitions for Python
    python-urlgrabber.noarch : High-level cross-protocol url-grabber
    python-urljr.noarch : Common interface to urllib2 and curl for making
    HTTP requests
    python-urwid.noarch : Console UI Library for Python
    python-urwid.i386 : Console UI Library for Python
    python-utmp.i386 : Python module for working with utmp
    python-vcpx.noarch : Version Control Patch eXchanger
    python-virtinst.noarch : Python modules for starting Xen guest
    installations
    python-vorbis.i386 : Python bindings for libvorbis
    python-webob.noarch : WSGI request and response object
    python-which.noarch : Small which replacement that can be used as a
    Python module
    python-wifi.noarch : Python binding for the wireless (wifi) extensions
    python-xattr.i386 : Extended attributes for python
    python-xdg.noarch : Python library to access freedesktop.org standards
    python-xlib.i386 : Complete X11R6 client-side implementation
    python-xlrd.noarch : Library to extract data from Microsoft Excel (tm)
    spreadsheet files
    python-yadis.noarch : Relying party support for the Yadis service
    discovery protocol
    python-yaml.noarch : Python package implementing YAML parser and emitter
    python-yenc.i386 : yEnc Module for Python
    python-zope-interface.i386 : Zope 3 Interface Infrastructure
    pytone.i386 : Music Jukebox with a Curses Based GUI
    pytraffic.i386 : Rush Hour game
    pytz.noarch : World Timezone Definitions for Python
    pywebdav.noarch : WebDAV library
    pyxattr.i386 : Extended attributes library wrapper for Python
    pyxdg.noarch : Python library to access freedesktop.org standards
    pyxf86config.i386 : Python wrappers for libxf86config
    pyzor.noarch : Pyzor collaborative spam filtering system
    rdiff-backup.i386 : Convenient and transparent local/remote incremental
    mirror/backup
    rhnlib.noarch : Python libraries for the RHN project
    rhpl.i386 : Library of python code used by programs in Red Hat Linux
    rhpxl.i386 : Python library for configuring and running X.
    rpm-python.i386 : Python bindings for apps which will manipulate RPM
    packages.
    rrdtool-python.i386 : Python RRDtool bindings
    sagator.noarch : SAGATOR - antivir/antispam gateway for smtp server
    scapy.noarch : Interactive packet manipulation tool and network scanner
    scipy.i386 : Scipy: Scientific Tools for Python
    scons.noarch : An Open Source software construction tool
    sip.i386 : SIP - Python/C++ Bindings Generator
    sip-devel.i386 : Files needed to generate Python bindings for any C++
    class library
    solarwolf.noarch : Python SDL game where you have to collect energy cubes
    spacepong.noarch : An innovative Python SDL game that is controlled with
    the mouse
    stgit.noarch : StGIT provides similar functionality to Quilt on top of
    GIT
    sulk.i386 : Sulk, the hackable Space Hulk
    supybot.noarch : Cross-platform IRC bot written in Python
    swig.i386 : Simplified Wrapper and Interface Generator
    sympy.noarch : A Python library for symbolic mathematics
    system-config-bind.noarch : The Red Hat BIND DNS Configuration Tool.
    tkinter.i386 : A graphical user interface for the Python scripting
    language.
    trytond.noarch : Server for the Tryton application framework
    txt2tags.noarch : Converts text files to HTML, XHTML, sgml, LaTeX, man...
    wxPython.i386 : GUI toolkit for the Python programming language
    wxPython-devel.i386 : Development files for wxPython add-on modules
    yum-protect-packages.noarch : Yum plugin to prevents Yum from removing
    itself and other protected packages
    zope.i386 : Web application server for flexible content management
    applications

    --
    Rahul
     
    Rahul, Apr 5, 2009
    #4
  5. Rahul

    Robert Kern Guest

    On 2009-04-04 18:08, John Yeung wrote:
    > I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
    > the profile module. That is what the docs recommend.


    Oops, I missed that piece of information. Alternately, the OP can install
    lsprof, which was cProfile's third-party incarnation before it got integrated
    into the stdlib:

    http://codespeak.net/svn/user/arigo/hack/misc/lsprof/

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
     
    Robert Kern, Apr 5, 2009
    #5
  6. Rahul

    John Machin Guest

    On Apr 5, 8:46 am, Rahul <> wrote:
    > I need to profile a slow-running code. The problem is I cannot seem to find  
    > cProfile.py.
    >
    > Where can I get it? Is it not included in the normal distro? I tried
    > googling it up and theres tons of info on how to use it but no links for
    > where to download it from.
    >
    > I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).


    Read the fantastic manual:

    http://docs.python.org/library/profile.html

    Note: this is the *first* hit when you google either "cprofile" or
    "cProfile.py".

    """
    The Python standard library provides three different profilers:

    1.

    cProfile is recommended for most users; it’s a C extension with
    reasonable overhead that makes it suitable for profiling long-running
    programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.

    New in version 2.5.
    """
     
    John Machin, Apr 5, 2009
    #6
  7. Rahul

    Rahul Guest

    John Yeung <> wrote in news:c0752f32-b0cf-4fde-
    :

    > I believe cProfile was added in 2.5. Your best bet on 2.4 is probably
    > the profile module. That is what the docs recommend.
    >


    Thanks John. That works. I'll use "profile" instead.

    --
    Rahul
     
    Rahul, Apr 5, 2009
    #7
  8. Rahul

    Rahul Guest

    John Machin <> wrote in news:0a8400dc-b14b-4bb9-a608-
    :

    > Read the fantastic manual:
    >
    > http://docs.python.org/library/profile.html

    [snip]
    > cProfile is recommended for most users; it's a C extension with
    > reasonable overhead that makes it suitable for profiling long-running
    > programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.
    >
    > New in version 2.5.
    >


    Thanks John; I did read the manual which is why I decided to use cProfile
    as it was "recommended for most users". I missed the last bit about "New
    in version 2.5."

    --
    Rahul
     
    Rahul, Apr 5, 2009
    #8
  9. Rahul

    John Machin Guest

    On Apr 5, 9:41 am, Rahul <> wrote:
    > John Machin <> wrote in news:0a8400dc-b14b-4bb9-a608-
    > :
    >
    >
    >
    > > Read the fantastic manual:

    >
    > >http://docs.python.org/library/profile.html

    >  [snip]
    > >       cProfile is recommended for most users; it's a C extension with
    > > reasonable overhead that makes it suitable for profiling long-running
    > > programs. Based on lsprof, contributed by Brett Rosen and Ted Czotter.

    >
    > >       New in version 2.5.

    >
    > Thanks John; I did read the manual which is why I decided to use cProfile
    > as it was "recommended for most users".  I missed the last bit about "New
    > in version 2.5."


    Looks like our definitions of "read" differ :)
     
    John Machin, Apr 5, 2009
    #9
  10. Rahul

    Rahul Guest

    John Machin <> wrote in news:4c8ee09e-71e2-464a-a3c0-
    :

    > Looks like our definitions of "read" differ :)
    >


    Sorry. I ought to have said "skimmed" :)

    I guess I am one of those guilty lazy-bums that the manual refers to under
    <<<users that “don’t want to read the manual.” >>>

    --
    Rahul
     
    Rahul, Apr 5, 2009
    #10
  11. Rahul

    Guest

    Rahul> I need to profile a slow-running code. The problem is I cannot
    Rahul> seem to find cProfile.py.

    You want cProfile.c (compiled to cProfile.so).

    Rahul> I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10).

    cProfile was new in 2.5, but the code backports with no problem to 2.4.
    Just grab it from a 2.5 distro and build/install it.

    --
    Skip Montanaro - - http://www.smontanaro.net/
    "XML sucks, dictionaries rock" - Dave Beazley
     
    , Apr 5, 2009
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Pratt

    cProfile for python 2.4

    David Pratt, Mar 28, 2008, in forum: Python
    Replies:
    1
    Views:
    1,622
  2. Matthew Wilson

    Does cProfile include IO wait time?

    Matthew Wilson, Jul 5, 2009, in forum: Python
    Replies:
    2
    Views:
    593
    Robert Kern
    Jul 8, 2009
  3. mk
    Replies:
    1
    Views:
    338
    Jonathan Hartley
    Dec 30, 2009
  4. Dysgraphic Programmer

    cProfile taking up too much memory?

    Dysgraphic Programmer, Mar 14, 2011, in forum: Python
    Replies:
    0
    Views:
    234
    Dysgraphic Programmer
    Mar 14, 2011
  5. Gelonida N

    cProfile and name spaces.

    Gelonida N, Sep 23, 2011, in forum: Python
    Replies:
    0
    Views:
    230
    Gelonida N
    Sep 23, 2011
Loading...

Share This Page