question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing solve function from PyTorch fails for edge case version

See original GitHub issue

Describe the bug

Hi there,

We’re running the PyTorch version labeled 1.7.1+cu110, but it is giving us issues when importing Kornia because of the following check in _compat.py:

if version.parse(torch.__version__) > version.parse("1.7.1"):
    # TODO: remove the type: ignore once Python 3.6 is deprecated.
    # It turns out that Pytorch has no attribute `torch.linalg` for
    # Python 3.6 / PyTorch 1.7.0, 1.7.1
    from torch.linalg import solve  # type: ignore
else:
    from torch import solve as _solve

    # NOTE: in previous versions `torch.solve` accepted arguments in another order.
    def solve(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
        return _solve(B, A).solution

This check appears to believe that our version is > 1.7.1 and therefore attempts to import the wrong solve function.

Reproduction steps

1. Get PyTorch 1.7.1+anything (cu110, cu101, cu92, cpu) 
2. Attempt to import Kornia

Expected behavior

Importing Kornia with this version should not fail on a PyTorch version check. Perhaps it would make sense to split on + before checking the version.

Environment

- PyTorch Version (e.g., 1.0): 1.7.1+cu110
- OS (e.g., Linux): Ubuntu 20.04
- How you installed PyTorch (`conda`, `pip`, source): `pip`
- Build command you used (if compiling from source): -
- Python version: 3.7.5
- CUDA/cuDNN version: -
- GPU models and configuration: - 
- Any other relevant information: -

Additional context

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjong1commented, Sep 13, 2021

We have pytest as one of our dev dependencies, so that might be why it didn’t fail there

0reactions
edgarribacommented, Sep 13, 2021

@pmeier you are right, my fault to include in main dependencies list. Problem of always going under development setup 😃 @mdjong1 this is the right place to include https://github.com/kornia/kornia/blob/master/setup.py#L115

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edge case: complex torch.nn.PoissonNLLLoss has ... - GitHub
Describe the bug Test on the CPU: import torch loss = torch.nn. ... PoissonNLLLoss: returns the result of nan+0j Edge case: complex torch.nn....
Read more >
TorchScript — PyTorch 1.13 documentation
Tracing Edge Cases. There are some edge cases that exist where the trace of a given Python function/module will not be representative of...
Read more >
torch_geometric.nn — pytorch_geometric documentation
from torch.nn import Linear, ReLU from torch_geometric.nn import ... passed to the respective aggregation function in case it gets automatically resolved.
Read more >
From PyTorch to PyTorch Lightning — A gentle introduction
PyTorch Lightning solves exactly this problem. Lightning structures your ... This function handles downloads and any data processing.
Read more >
PyTorch 1.10.0 Now Available - Exxact Corporation
PyTorch just released version 1.10 with support for CUDA Graphs APIs, Frontend and compiler improvements, and more. Read full release notes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found