eandersson / amqpstorm

Thread-safe Python RabbitMQ Client & Management library
https://www.amqpstorm.io/
MIT License
186 stars 36 forks source link

Installation errors with Python 3.10 #120

Open ashleykleynhans opened 2 years ago

ashleykleynhans commented 2 years ago

I am using Python3 version 3.10.4 on Ubuntu 18.04 LTS and encountering the following error when attempting to install amqpstorm:

$ pip install amqpstorm
Keyring is skipped due to an exception: module 'collections' has no attribute 'MutableMapping'
Defaulting to user installation because normal site-packages is not writeable
Collecting amqpstorm
  Using cached AMQPStorm-2.10.4.tar.gz (71 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 12, in <module>
          import setuptools.version
        File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 77, in <module>
          __import__('pkg_resources.extern.packaging.requirements')
        File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
          from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
        File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
        File "/usr/lib/python3/dist-packages/pkg_resources/extern/__init__.py", line 43, in load_module
          __import__(extant)
        File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
          collections.MutableMapping.register(ParseResults)
      AttributeError: module 'collections' has no attribute 'MutableMapping'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have seen recommendations to upgrade to the latest version of requests when this happens, but I already have the latest version of requests installed, here is the contents of my requirements.txt file:

boto3==1.23.0
botocore==1.26.0
jmespath==1.0.0
python-dateutil==2.8.2
s3transfer==0.5.2
six==1.16.0
urllib3==1.26.9
redis==4.3.1
requests==2.27.1
amqpstorm==2.10.4
pyyaml==6.0
ashleykleynhans commented 2 years ago

Workaround is to do the following:

pip3 install --upgrade setuptools

Version of setuptools before: 39.0.1 Version of setuptools after: 62.3.2

eandersson commented 2 years ago

Thanks for the report. I'll see if I can figure out a work around on our side, and thanks for sharing your solution, at the very least this should help other people running into this issue.

jhogg commented 1 year ago

Erik,

I'm not sure there is a workaround here. The first error message indicated a version dependency issue with the python install:

Keyring is skipped due to an exception: module 'collections' has no attribute 'MutableMapping'

Looking at versions, MutableMapping was deprecated in 3.3 and removed in 3.10, so pip was already not going to be happy installing packages in 3.10.

pkg_resources, which generated this exception, was probably around the same generation as setuptools (39 is early 2018, ~3.7) and needed MutableMapping, so it was fundamentally broken. Versions of setuptools post-39 are removing pkg_resources dependencies, which is probably why the setuptools upgrade fixed it.

Jay

On Fri, May 20, 2022 at 1:09 PM Erik Olof Gunnar Andersson < @.***> wrote:

Thanks for the report. I'll see if I can figure out a work around on our side, but at the very least this should help other people running into this issue.

— Reply to this email directly, view it on GitHub https://github.com/eandersson/amqpstorm/issues/120#issuecomment-1133179989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJGJR2V5CCP3TATZARZELVK7INVANCNFSM5WP4NEYA . You are receiving this because you are subscribed to this thread.Message ID: @.***>