Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated #1885

Closed
bgreen-litl opened this issue Nov 12, 2019 · 9 comments
Assignees
Labels
bug This issue is a confirmed bug. closing-soon

Comments

@bgreen-litl
Copy link

Referencing collections.MutableMapping rather than collections.abc.MutableMapping triggers a deprecation warning.

>>> import botocore
>>> botocore.__version__
'1.13.15'
>>> import collections
>>> collections.MutableMapping
__main__:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

The reference occurs here:
https://github.com/boto/botocore/blob/develop/botocore/awsrequest.py#L624

@kamikaze
Copy link

kamikaze commented Nov 12, 2019

+1
Seeing it for a long time. Nobody cares?

@swetashre swetashre self-assigned this Nov 12, 2019
@clifflu
Copy link

clifflu commented Nov 13, 2019

It seems to be a different issue as I got the same Deprecation Warning from awsrequest.py:624 , not the vendored requests. botocore.version = '1.13.16'

Changing

class HeadersDict(collections.MutableMapping):
...

to

try:
    from collections.abc import MutableMapping
except ModuleNotFoundError:
    from collections import MutableMapping

class HeadersDict(MutableMapping):
...

fixes this warning and is pythonic IMHO. Pytest will then throw the same DeprecationWarning from session.py:947 instead.

I can create a PR for it if you like : )

Update: Should replace ModuleNotFoundError with ImportError as the former was introduced in Python 3.6, and is subclass to ImportError.

@bgreen-litl
Copy link
Author

@clifflu is correct. This is not in the vendored requests module. I had reviewed both #1615 and PR #1829 before filing this. The deprecation warning I posted is coming from the botocore lib itself, not the older version of requests in the vendored directory.

@MihaiBojin
Copy link

I'm also seeing this error:

.../site-packages/botocore/awsrequest.py:624: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    class HeadersDict(collections.MutableMapping):

@swetashre
Copy link
Contributor

Sorry for the late reply. We are working on a fix for it. I will update here when it will be fixed.

@kapilt
Copy link
Contributor

kapilt commented Nov 20, 2019

this pr thats been around for a few weeks will fix it #1865

@terencehonles
Copy link
Contributor

@swetashre perhaps you want to merge #1865 as @kapilt mentioned? It's a pretty small/simple change.

@swetashre swetashre added the bug This issue is a confirmed bug. label Dec 18, 2019
@swetashre
Copy link
Contributor

Now i am not getting error with this code :

In [5]: import botocore                                                                                                

In [6]: botocore.__version__                                                                                           
Out[6]: '1.13.44'

In [7]: import collections                                                                                             

In [8]: collections.MutableMapping                                                                                     
Out[8]: collections.abc.MutableMapping

Please let me know if anyone is still getting the error. This issue is fixed with the merge of PR #1922

@no-response
Copy link

no-response bot commented Dec 30, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. closing-soon
Projects
None yet
Development

No branches or pull requests

7 participants