[SRU] pycallgraph crashed with AttributeError

Bug #2062065 reported by Sudip Mukherjee
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pycallgraph (Debian)
Fix Released
Unknown
pycallgraph (Ubuntu)
Status tracked in Oracular
Focal
Fix Released
Medium
Unassigned
Jammy
Fix Released
Medium
Unassigned
Noble
Fix Released
Medium
Unassigned
Oracular
Fix Released
Medium
Unassigned

Bug Description

[ Impact ]

pycallgraph is completely unusable and crashes immediately when executed by the user.

$ pycallgraph --help
Traceback (most recent call last):
  File "/usr/bin/pycallgraph", line 11, in <module>
    import pycallgraph as __pycallgraph
  File "/usr/lib/python3/dist-packages/pycallgraph/__init__.py", line 11, in <module>
    from .pycallgraph import PyCallGraph
  File "/usr/lib/python3/dist-packages/pycallgraph/pycallgraph.py", line 3, in <module>
    from .output import Output
  File "/usr/lib/python3/dist-packages/pycallgraph/output/__init__.py", line 3, in <module>
    from .output import Output
  File "/usr/lib/python3/dist-packages/pycallgraph/output/output.py", line 3, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

[ Test Plan ]

install python3-pycallgraph.

As a basic test, execute "pycallgraph --help"

If the package is not fixed,it will fail with the above error.
With the fixed package, it will display the help menu.

As a more complete test:

copy the attached basic.py and use the command:

pycallgraph graphviz basic.py

It will create two png files "basic.png" and "pycallgraph.png".

[ Where problems could occur ]

The 'distutils' module is not available in Python3.12. 'distutils' was used previously to find the executable and was also used to get the path of the python lib. Now, its being replaced with 'shutil' and using 'which' to find the executable. And, 'sysconfig' is used to get the path of the python lib.
In the worst case, if 'which' or 'sysconfig' fails to find the path then the user will still see pycallgraph is failing but with a different error message.

[ Other Info ]

1. It has been fixed in Debian and so Oracular is also fixed now.

2. In Focal, the patch had to be modified to hardcode the path as I am unable to get the path '/usr/lib/python3/dist-packages' from any of ths syconfig opions. All the sysconfig variables and paths can be seen with the command 'python3 -m sysconfig' and there is no way to generate the required path from sysconfig.
And, in Focal pycallgraph will be installed in that path, if 'tracer.py' does not get the correct path then the generated 'pycallgraph.png' will not be same as Jammy or Noble or Oracular with the same test file 'basic.py'.

[ Original Bug Description ]

pycallgraph fails to run with the error:

$ pycallgraph
Traceback (most recent call last):
  File "/usr/bin/pycallgraph", line 11, in <module>
    import pycallgraph as __pycallgraph
  File "/usr/lib/python3/dist-packages/pycallgraph/__init__.py", line 11, in <module>
    from .pycallgraph import PyCallGraph
  File "/usr/lib/python3/dist-packages/pycallgraph/pycallgraph.py", line 3, in <module>
    from .output import Output
  File "/usr/lib/python3/dist-packages/pycallgraph/output/__init__.py", line 3, in <module>
    from .output import Output
  File "/usr/lib/python3/dist-packages/pycallgraph/output/output.py", line 3, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

ProblemType: Crash
DistroRelease: Ubuntu 24.04
Package: python3-pycallgraph 1.1.3-2
ProcVersionSignature: Ubuntu 6.8.0-22.22-generic 6.8.1
Uname: Linux 6.8.0-22-generic x86_64
ApportVersion: 2.28.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: pass
CrashCounter: 1
CurrentDesktop: ubuntu:GNOME
Date: Wed Apr 17 21:46:49 2024
ExecutablePath: /usr/bin/pycallgraph
InstallationDate: Installed on 2024-04-10 (7 days ago)
InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Beta amd64 (20240410)
InterpreterPath: /usr/bin/python3.12
JournalErrors: -- No entries --
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/pycallgraph
Python3Details: /usr/bin/python3.12, Python 3.12.3, python3-minimal, 3.12.3-0ubuntu1
PythonArgs: ['/usr/bin/pycallgraph']
PythonDetails: N/A
SourcePackage: pycallgraph
Title: pycallgraph crashed with AttributeError in strip_argv(): 'Config' object has no attribute 'command'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sudo users

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :
information type: Private → Public
tags: removed: need-duplicate-check
Changed in pycallgraph (Ubuntu):
importance: Undecided → Medium
Changed in pycallgraph (Ubuntu Focal):
status: New → In Progress
Changed in pycallgraph (Ubuntu Jammy):
status: New → In Progress
Changed in pycallgraph (Ubuntu Noble):
status: New → In Progress
Changed in pycallgraph (Ubuntu Oracular):
status: New → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in pycallgraph (Ubuntu Noble):
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in pycallgraph (Ubuntu Jammy):
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in pycallgraph (Ubuntu Focal):
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in pycallgraph (Debian):
status: Unknown → New
Changed in pycallgraph (Debian):
status: New → Fix Released
Changed in pycallgraph (Ubuntu Noble):
importance: Undecided → Medium
Changed in pycallgraph (Ubuntu Jammy):
importance: Undecided → Medium
Changed in pycallgraph (Ubuntu Focal):
importance: Undecided → Medium
Changed in pycallgraph (Ubuntu Oracular):
assignee: Sudip Mukherjee (sudipmuk) → nobody
status: In Progress → Fix Released
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

The basic.py used in the testplan

summary: - pycallgraph crashed with AttributeError in Noble
+ [SRU] pycallgraph crashed with AttributeError
description: updated
Changed in pycallgraph (Ubuntu Noble):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Changed in pycallgraph (Ubuntu Jammy):
assignee: Sudip Mukherjee (sudipmuk) → nobody
description: updated
Changed in pycallgraph (Ubuntu Focal):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Sudip, or anyone else affected,

Accepted pycallgraph into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pycallgraph/1.1.3-2ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in pycallgraph (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-noble
Changed in pycallgraph (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed-jammy
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Sudip, or anyone else affected,

Accepted pycallgraph into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pycallgraph/1.1.3-1.2ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in pycallgraph (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Sudip, or anyone else affected,

Accepted pycallgraph into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pycallgraph/1.1.3-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is pending execution of the test plan.

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that python3-pycallgraph from noble-proposed has fixed the bug for me.

Test done:

install python3-pycallgraph and try to execute "pycallgraph --help" and confirmed that it still fails.

Added noble-proposed to apt sources.
install python3-pycallgraph from noble-proposed.

Followed the testplan and tested "pycallgraph" with the basic.py and confirmed it creates the two png files.

Package tested:

$ apt-cache policy python3-pycallgraph
python3-pycallgraph:
  Installed: 1.1.3-2ubuntu0.1
  Candidate: 1.1.3-2ubuntu0.1
  Version table:
 *** 1.1.3-2ubuntu0.1 100
        100 http://gb.archive.ubuntu.com/ubuntu noble-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     1.1.3-2 500
        500 http://gb.archive.ubuntu.com/ubuntu noble/universe amd64 Packages

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that python3-pycallgraph from jammy-proposed has fixed the bug for me.

Test done:

install python3-pycallgraph and try to execute "pycallgraph --help" and confirmed that it still fails.

Added jammy-proposed to apt sources.
install python3-pycallgraph from jammy-proposed.

Followed the testplan and tested "pycallgraph" with the basic.py and confirmed it creates the two png files.

Package tested:

$ apt-cache policy python3-pycallgraph
python3-pycallgraph:
  Installed: 1.1.3-1.2ubuntu0.1
  Candidate: 1.1.3-1.2ubuntu0.1
  Version table:
 *** 1.1.3-1.2ubuntu0.1 100
        100 http://gb.archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 Packages
        100 http://gb.archive.ubuntu.com/ubuntu jammy-proposed/universe i386 Packages
        100 /var/lib/dpkg/status
     1.1.3-1.2 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        500 http://gb.archive.ubuntu.com/ubuntu jammy/universe i386 Packages

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that python3-pycallgraph from focal-proposed has fixed the bug for me.

Test done:

install python3-pycallgraph and try to execute "pycallgraph --help" and confirmed that it still fails.

Added focal-proposed to apt sources.
install python3-pycallgraph from focal-proposed.

Followed the testplan and tested "pycallgraph" with the basic.py and confirmed it creates the two png files.

Package tested:

$ apt-cache policy python3-pycallgraph
python3-pycallgraph:
  Installed: 1.1.3-1ubuntu0.1
  Candidate: 1.1.3-1ubuntu0.1
  Version table:
 *** 1.1.3-1ubuntu0.1 100
        100 http://gb.archive.ubuntu.com/ubuntu focal-proposed/universe amd64 Packages
        100 http://gb.archive.ubuntu.com/ubuntu focal-proposed/universe i386 Packages
        100 /var/lib/dpkg/status
     1.1.3-1 500
        500 http://gb.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://gb.archive.ubuntu.com/ubuntu focal/universe i386 Packages

tags: added: verification-done verification-done-focal verification-done-jammy verification-done-noble
removed: verification-needed verification-needed-focal verification-needed-jammy verification-needed-noble
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pycallgraph - 1.1.3-2ubuntu0.1

---------------
pycallgraph (1.1.3-2ubuntu0.1) noble; urgency=medium

  * d/p/remove-distutils.patch: Remove distutils usage to fix
    crash. (LP: #2062065)

 -- Sudip Mukherjee <email address hidden> Wed, 10 Jul 2024 19:55:39 +0100

Changed in pycallgraph (Ubuntu Noble):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for pycallgraph has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pycallgraph - 1.1.3-1.2ubuntu0.1

---------------
pycallgraph (1.1.3-1.2ubuntu0.1) jammy; urgency=medium

  * d/p/remove-distutils.patch: Remove distutils usage to fix
    crash. (LP: #2062065)
  * d/p/dont-use-2to3.patch: remove 2to3 usage to fix FTBFS. (LP: #2072685)

 -- Sudip Mukherjee <email address hidden> Wed, 10 Jul 2024 21:22:05 +0100

Changed in pycallgraph (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pycallgraph - 1.1.3-1ubuntu0.1

---------------
pycallgraph (1.1.3-1ubuntu0.1) focal; urgency=medium

  * d/p/remove-distutils.patch: Remove distutils usage to fix
    crash. (LP: #2062065)
  * Fix the build with Python 3.8. (LP: #2072696)

 -- Sudip Mukherjee <email address hidden> Wed, 10 Jul 2024 21:53:50 +0100

Changed in pycallgraph (Ubuntu Focal):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.