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

Python deprecation warnings #5865

Closed
lovetox opened this issue Mar 10, 2019 · 15 comments · Fixed by #6272
Closed

Python deprecation warnings #5865

lovetox opened this issue Mar 10, 2019 · 15 comments · Fixed by #6272
Assignees
Labels

Comments

@lovetox
Copy link

lovetox commented Mar 10, 2019

Version: v3.7.0
Language: Python

C:\msys64\mingw64\lib\python3.7\site-packages\google\protobuf\internal\well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is
deprecated, and in 3.8 it will stop working
  collections.MutableMapping.register(Struct)
C:\msys64\mingw64\lib\python3.7\site-packages\google\protobuf\internal\well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is
deprecated, and in 3.8 it will stop working
@lovetox lovetox changed the title Python depreacation warnings Python deprecation warnings Mar 10, 2019
@anandolee
Copy link
Contributor

Thanks for raise it up. Will change the import in internal code to something like:

try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc

Expect to see the fix in future release.

@kakshay21
Copy link

@anandolee can I make a PR for this? If you're not working on this...

@anandolee
Copy link
Contributor

The fix is already submitted in internal. Thanks to willing provide PR

@hugovk
Copy link

hugovk commented Mar 18, 2019

I got the following warnings with protobuf 3.7.0, the second of which is covered above.

In case it's not been done already, please could you also fix the first one? Thank you!

/usr/local/lib/python3.7/site-packages/google/protobuf/descriptor.py:47
  /usr/local/lib/python3.7/site-packages/google/protobuf/descriptor.py:47: 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

/usr/local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:788
  /usr/local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    collections.MutableMapping.register(Struct)

Edit: also mentioned in #5335 (comment).

@sbv-trueenergy
Copy link

I'm running 3.8.0, upgraded my generated python code etc. - and I'm still seeing this

/site-packages/google/protobuf/descriptor.py:47: 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

Do I need to upgrade something else also?

@hugovk
Copy link

hugovk commented Jun 19, 2019

I'm running 3.8.0, upgraded my generated python code etc. - and I'm still seeing this

/site-packages/google/protobuf/descriptor.py:47: 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

Do I need to upgrade something else also?

I think #6272 should fix this.

@hugovk
Copy link

hugovk commented Jun 19, 2019

Python 3.8 is now in beta, with the final release due in October. I recommend also testing protobuf against Python 3.8.

https://www.python.org/dev/peps/pep-0569/

@cclauss
Copy link

cclauss commented Jul 14, 2019

/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/google/protobuf/descriptor.py:47
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/google/protobuf/descriptor.py:47: 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
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1286
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1286: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    _pywrap_tensorflow.RegisterType("Mapping", _collections.Mapping)
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1287
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1287: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    _pywrap_tensorflow.RegisterType("Sequence", _collections.Sequence)
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:61
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:61: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    class ObjectIdentityDictionary(collections.MutableMapping):
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:112
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:112: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    class ObjectIdentitySet(collections.MutableSet):
-- Docs: https://docs.pytest.org/en/latest/warnings.html

@cclauss
Copy link

cclauss commented Oct 2, 2019

Python 3.8 release candidate 1 is available: https://www.python.org/download/pre-releases

@hugovk
Copy link

hugovk commented Oct 2, 2019

And Python 3.8.0 final is due out on Monday, 2019-10-14.

I've not checked them all, but looks fixed and released in latest Protocol Buffers v3.9.2:

try:
# Since python 3
import collections.abc as collections_abc
except ImportError:
# Won't work after python 3.8
import collections as collections_abc

@cclauss
Copy link

cclauss commented Oct 2, 2019

Actually python/google/protobuf/descriptor.py when generated still contains such a import that pytest will still raise as a warning on.

@cclauss
Copy link

cclauss commented Oct 15, 2019

Python 3.8 was released yesterday https://www.python.org/downloads/release/python-380/

@yuvadm
Copy link

yuvadm commented Oct 30, 2019

A fix is pending, why isn't it being merged? #6272

@MarcSkovMadsen
Copy link

I'm also looking for a fix to

.venv\lib\site-packages\google\protobuf\descriptor.py:47
  c:\Users\masma\source\repos\orsteddcsmarketsanalytics\apps\portfolio_analytics\.venv\lib\site-packages\google\protobuf\descriptor.py:47: 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

Im running v. 3.10.0 on python 3.7.4

$ pip show protobuf
Name: protobuf
Version: 3.10.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: None
Author-email: None
License: 3-Clause BSD License
Location: c:\users\masma\source\repos\orsteddcsmarketsanalytics\apps\portfolio_analytics\.venv\lib\site-packages
Requires: six, setuptools
Required-by: streamlit

@hugovk
Copy link

hugovk commented Nov 8, 2019

https://bugs.python.org/issue37324 has been fixed so it's gone away from Python 3.9.

Python 3.9 development has started, with the first alpha due out in about a week (2019-11-18). I expect this might block core development soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants