-
Notifications
You must be signed in to change notification settings - Fork 341
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
Test minimum version of deps #574
Conversation
# matplotlib 3.3+ required for (H, W, 1) image support in plt.imshow | ||
matplotlib>=3.3,<4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of our datasets (idtrees?) are plotting (H, W, 1) images, can we just squash these so we can support older matplotlib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep track of these types of questions somewhere? Or resolve them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either. If I get bored I'll try to fix these and support older versions. If I get busy I'll just merge this as is and deal with it another day.
rasterio>=1.0.16,<2 | ||
# pytorch-lightning 1.5.1+ required for apply_to_collection bugfix | ||
pytorch-lightning>=1.5.1,<2 | ||
# rasterio 1.0.20+ required for out_dtype parameter of DatasetReaderBase.read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear if this is really needed, could just cast to different dtype after reading
Kk I'm happy with this regardless |
TODO: update |
- open3d>=0.11.2 | ||
- pip | ||
- protobuf<4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pin this here, it isn't used by CI so it won't cause us issues. If someone encounters an issue they can manually install an older protobuf.
# Required to address protocolbuffers/protobuf#10051 | ||
protobuf<4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pin this here, it isn't used by CI so it won't cause us issues. If someone encounters an issue they can manually install an older protobuf.
@@ -47,7 +47,6 @@ scipy==1.7.3;python_version=='3.7' | |||
zipfile-deflate64==0.2.0 | |||
|
|||
# docs | |||
ipywidgets==7.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this once upon a time because I ran into issues locally, but the doc tests seem to pass without it and it isn't a direct dep, so I removed it
@@ -199,7 +199,7 @@ def _load_target(self, path: str) -> Tensor: | |||
"scipy is not installed and is required to use this dataset" | |||
) | |||
|
|||
array = wavfile.read(path)[1] | |||
array = wavfile.read(path, mmap=True)[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this I was seeing an issue with older scipy/torch:
tests/datasets/test_advance.py::TestADVANCE::test_getitem
/home/adam/torchgeo/torchgeo/datasets/advance.py:203: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:180.)
tensor = torch.from_numpy(array)
It doesn't seem to be needed for newer scipy/torch, but as long as the tests pass I don't see any harm in always using this.
except AttributeError: # pragma: no cover | ||
except AttributeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can finally properly test these lines!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finallllly!!!!!!
# https://github.com/rwightman/pytorch-image-models/pull/1256 | ||
"ignore:.*is deprecated and will be removed in Pillow 10:DeprecationWarning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't specify a module, this will ignore the test for all files, including our own. By specifying a model, we can ignore things with more fine-grained precision. We should probably do this for all warnings raised by deps of deps.
pyproject.toml
Outdated
"ignore:Named tensors and all their associated APIs are an experimental feature and subject to change.:UserWarning:torch.nn.functional", | ||
# https://github.com/numpy/numpy/issues/14920 | ||
# https://github.com/numpy/numpy/issues/15748 | ||
"ignore:numpy.ufunc size changed, may indicate binary incompatibility:RuntimeWarning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only occurs for the minimum version tests, but basically, at least one of our deps was built with a different version of numpy than we are using to run the tests. Doesn't seem to cause any harm other than the warning.
@calebrob6 this should be ready to merge now assuming the tests pass! |
Sick, nice work!! |
Just to make sure I'm understanding at the high level:
Is this correct? |
This is the fourth PR in a series of attempts to improve the stability and robustness of TorchGeo's CI (#567, #557, #551).
With this PR, we now have a minimum supported version listed for all of our dependencies, and we actively test to ensure that this stays up-to-date with each commit.
In the past, I tried not to overly restrict our dependencies if I didn't know the oldest supported version. With this PR, I'm taking the policy of "the oldest supported version is the oldest we can test". For example, many of our dependencies are pinned to versions due to Python 3.7 support or because another dependency requires a newer version, even if an older version would work with our code.
Closes #32