dtamayo / spock

🖖 A package to determine whether planetary orbital configurations will live long and prosper
GNU General Public License v3.0
63 stars 15 forks source link

Deprecation Warning -> Error #19

Closed nora-anne closed 3 years ago

nora-anne commented 3 years ago

Hello, I just upgraded SPOCK to try out the new DeepRegressor, and now I can't use the package at all. I get a Deprecation Warning from some code in the Google Protocol Buffers, but after some troubleshooting it seems that somehow SPOCK seems to be treating that warning as an error.

Here's an example with the entire traceback:

import spock print('hello')

Traceback (most recent call last): File "/home/norabailey/testing_abcs.py", line 1, in import spock File "/usr/local/lib/python3.8/dist-packages/spock/init.py", line 5, in from .deepregressor import DeepRegressor File "/usr/local/lib/python3.8/dist-packages/spock/deepregressor.py", line 15, in from .spock_reg_model import load_swag File "/usr/local/lib/python3.8/dist-packages/spock/spock_reg_model.py", line 16, in import pytorch_lightning as pl File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/init.py", line 69, in from pytorch_lightning.trainer import Trainer File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/init.py", line 18, in from pytorch_lightning.trainer.trainer import Trainer File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 32, in from pytorch_lightning.loggers import LightningLoggerBase File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loggers/init.py", line 18, in from pytorch_lightning.loggers.tensorboard import TensorBoardLogger File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loggers/tensorboard.py", line 26, in from torch.utils.tensorboard import SummaryWriter File "/usr/local/lib/python3.8/dist-packages/torch/utils/tensorboard/init.py", line 8, in from .writer import FileWriter, SummaryWriter # noqa F401 File "/usr/local/lib/python3.8/dist-packages/torch/utils/tensorboard/writer.py", line 10, in from tensorboard.compat.proto.event_pb2 import SessionLog File "/usr/local/lib/python3.8/dist-packages/tensorboard/compat/proto/event_pb2.py", line 8, in from google.protobuf import descriptor as _descriptor File "/usr/lib/python3/dist-packages/google/protobuf/descriptor.py", line 40, in from google.protobuf.internal import api_implementation File "/usr/lib/python3/dist-packages/google/protobuf/internal/api_implementation.py", line 154, in from google.protobuf.pyext import _message File "/usr/lib/python3.8/collections/init.py", line 49, in getattr warnings.warn("Using or importing the ABCs from 'collections' instead " DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working

While if I try:

from google.protobuf.pyext import _message print('hello')

I still get the warning, but it runs:

Warning (from warnings module): File "/home/norabailey/testing_abcs.py", line 1 from google.protobuf.pyext import _message DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working hello

dtamayo commented 3 years ago

Thank you for the bug report @nora-anne ! I believe the culprit is this line

https://github.com/dtamayo/spock/blob/master/spock/tseries_feature_functions.py#L10

Let us sort out whether removing that has any unintended side effects for the two models and we'll push a fix!

MilesCranmer commented 3 years ago

Pushed a fix to master! The warnings filter blocked some things with scikit-learn, but fixed those now.

Let us know if this works for you! Cheers, Miles

dtamayo commented 3 years ago

it's also up on PyPI now as version 1.3.1!

nora-anne commented 3 years ago

Thank you, working great now!!