Closed Bug 1973594 Opened 6 months ago Closed 6 months ago

Python 3.10 failure running moz-phab: AttributeError: module 'collections' has no attribute 'MutableMapping'

Categories

(Conduit :: moz-phab, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sparky, Unassigned)

Details

moz-phab version (from moz-phab version): I don't know, this failure is before it. I believe it's 1.10 from here:

Installing collected packages: MozPhab
Successfully installed MozPhab-1.10.0

This failure happens when running moz-phab version on Python 3.10. Same error happens with submit.

$ moz-phab version
/home/sparky/.local/lib/python3.10/site-packages/mozphab/sentry.py:13: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import get_distribution
AttributeError: module 'collections' has no attribute 'MutableMapping'
Run moz-phab again with '--trace' to show debugging output

I don't know exactly what is triggering this failure, but when I commented out these two lines, I was able to submit my patch: https://github.com/mozilla-conduit/review/blob/131a0c0a1cee9aede4a04a0e8525fb1d9e472854/mozphab/mozphab.py#L76-L77

Sentry-sdk is at version 2.30 for me: Requirement already satisfied: sentry-sdk in /home/sparky/.local/lib/python3.10/site-packages (2.30.0)
So it seems like it's coming from one of sentry-sdk's requirements/depdencies.

Odd - sentry_sdk's imports for MutableMapping are correct (py3.10 moved it to collections.abc.MutableMapping), and I'm unable to reproduce this issue with py3.12. Looking at every MutableMapping import across moz-phab's direct and indirect dependencies I don't see any problematic imports.

Are you able to reproduce the issue? If so, can you re-run with --trace so we can get the debugging output?
If not you could check to see if the MutableMapping stack is in ~/.mozbuild/moz-phab/moz-phab.log and share just the stack (not the whole file).

Flags: needinfo?(gmierz2)

Yes, I can still reproduce this issue. I'm not getting any additional output with --trace, and I can't find MutableMapping in the log files either.

I dug a little further, and found that this is being triggered by sentry_sdk.integrations.tornado.TornadoIntegration. It was attempting to use a python3-tornado installation that was for an older version of python3 (I'm guessing python 3.8 or 3.7).

I uninstalled it with sudo apt remove python3-tornado, and the error is gone now. Closing this as fixed now since my issue is resolved.

Status: NEW → RESOLVED
Closed: 6 months ago
Flags: needinfo?(gmierz2)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.