nccgroup / PMapper

A tool for quickly evaluating IAM permissions in AWS.
GNU Affero General Public License v3.0
1.37k stars 169 forks source link

Collections Module issue in Python 3.10 #140

Open mosesrenegade opened 8 months ago

mosesrenegade commented 8 months ago

When running the pmapper pip module or the locally installed build, the collections module fails to import. This is because the following two functions: Mapping, MutableMapping are now located in collections.abc. I have created a pull request to solve this issue.

To reproduce the issue currently have a system with python3.10 or higher.

  1. pip3 install principalmapper
  2. pmapper
Traceback (most recent call last):
  File "/usr/local/bin/pmapper", line 5, in <module>
    from principalmapper.__main__ import main
  File "/usr/local/lib/python3.11/site-packages/principalmapper/__main__.py", line 24, in <module>
    from principalmapper.analysis import cli as analysis_cli
  File "/usr/local/lib/python3.11/site-packages/principalmapper/analysis/cli.py", line 20, in <module>
    from principalmapper.analysis import find_risks
  File "/usr/local/lib/python3.11/site-packages/principalmapper/analysis/find_risks.py", line 37, in <module>
    from principalmapper.querying import query_interface
  File "/usr/local/lib/python3.11/site-packages/principalmapper/querying/query_interface.py", line 26, in <module>
    from principalmapper.querying.local_policy_simulation import *
  File "/usr/local/lib/python3.11/site-packages/principalmapper/querying/local_policy_simulation.py", line 32, in <module>
    from principalmapper.util.case_insensitive_dict import CaseInsensitiveDict
  File "/usr/local/lib/python3.11/site-packages/principalmapper/util/case_insensitive_dict.py", line 34, in <module>
    from collections import Mapping, MutableMapping, OrderedDict
ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py)

The following PR solves the issue: https://github.com/nccgroup/PMapper/pull/139