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

General: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working #6450

Closed
akifd opened this issue Nov 8, 2018 · 5 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. api: clouddebugger Issues related to the Cloud Debugger API. api: core api: firestore Issues related to the Firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.

Comments

@akifd
Copy link

akifd commented Nov 8, 2018

I'm getting this deprecation warning when running pytests on my app that uses Google Storage.

Environment details

Arch Linux
Python 3.7.1
google-api-core==1.5.1
google-auth==1.5.1
google-cloud-core==0.28.1
google-cloud-storage==1.13.0
google-resumable-media==0.3.1
googleapis-common-protos==1.5.5
pytest==3.9.1

Steps to reproduce

  1. Create file test.py.
  2. Add line from google.protobuf.pyext import _message to it.
  3. Run pytest test.py (to install pytest first pip install pytest==3.9.1)
  4. Pytest will print the following: test.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from google.protobuf.pyext import _message

In my tests this warning comes from: google/protobuf/internal/api_implementation.py:154

Couldn't reproduce in shell, but pytest somehow catches this while running tests.

@tseaver tseaver added api: bigquery Issues related to the BigQuery API. api: core priority: p2 Moderately-important priority. Fix may not be included in next release. api: firestore Issues related to the Firestore API. api: clouddebugger Issues related to the Cloud Debugger API. labels Nov 8, 2018
@tseaver tseaver self-assigned this Nov 8, 2018
@tseaver
Copy link
Contributor

tseaver commented Nov 8, 2018

Please report the issue for the Python protobuf library in its repository.

We do have places here where we use those ABCs, which need to be fixed:

$ git grep -l "collections.ABCMeta" | wc -l
0
$ git grep -l "collections.Callable" | wc -l
0
$ git grep -l "collections.Container" | wc -l
0
$ git grep -l "collections.Hashable" | wc -l
0
$ git grep -l "collections.ItemsView" | wc -l
0
$ git grep -l "collections.Iterable" | wc -l
0
$ git grep -l "collections.Iterator" | wc -l
0
$ git grep -l "collections.KeysView" | wc -l
0
$ git grep -l "collections.Mapping"
api_core/google/api_core/protobuf_helpers.py
bigquery/google/cloud/bigquery/dbapi/_helpers.py
bigquery/google/cloud/bigquery/dbapi/cursor.py
firestore/google/cloud/firestore_v1beta1/_helpers.py
$ git grep -l "collections.MappingView" | wc -l
0
$ git grep -l "collections.MutableMapping"
api_core/google/api_core/protobuf_helpers.py
core/google/cloud/iam.py
$ git grep -l "collections.MutableSequence"
api_core/google/api_core/protobuf_helpers.py
$ git grep -l "collections.MutableSet" | wc -l
0
$ git grep -l "collections.Sequence"
bigquery/google/cloud/bigquery/client.py
$ git grep -l "collections.Set" | wc -l
0
$ git grep -l "collections.Sized" | wc -l
0
$ git grep -l "collections.ValuesView" | wc -l
0

Note that collections.abc is not present in Python 2.7, which means we will need to do some kind of conditional import, e.g.:

try:
    from collections.abc import Mapping
except ImportError:
    from collections import Mapping

@tseaver
Copy link
Contributor

tseaver commented Nov 8, 2018

@User3759685 I forgot to say thanks for reporting the issue!

@tseaver
Copy link
Contributor

tseaver commented Nov 8, 2018

@User3759685 There was an issue opened for protobuf. Unfortunately, the PR which closed it did not completely address the issue.

@tseaver tseaver added the type: cleanup An internal cleanup or hygiene concern. label Nov 9, 2018
@tseaver
Copy link
Contributor

tseaver commented Nov 10, 2018

I submitted protocolbuffers/protobuf#5335 for the remaining deprecated usage under protobuf.

tseaver added a commit that referenced this issue Nov 12, 2018
@Saurav-KT
Copy link

Saurav-KT commented Apr 30, 2020

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
import pymssql
Traceback (most recent call last):
File "src\pymssql.pyx", line 636, in pymssql.connect
File "src_mssql.pyx", line 1957, in _mssql.connect
File "src_mssql.pyx", line 676, in _mssql.MSSQLConnection.init
File "src_mssql.pyx", line 1683, in _mssql.maybe_raise_MSSQLDatabaseException
_mssql.MSSQLDatabaseException: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (xxx:1433)\nNet-Lib error during Unknown
I'm getting this error on windows machine Please suggest how to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. api: clouddebugger Issues related to the Cloud Debugger API. api: core api: firestore Issues related to the Firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

3 participants