Pytorch method 'detach' already has a docstring
See original GitHub issueProblem Description
Hello, whenever the pytorch/torch package is imported and I try to import again (say when I just run the whole script or another script that uses import torch) I get the error output: “method ‘detach’ already has a docstring”. I’m not the only one experiencing this issue (see https://discuss.pytorch.org/t/method-detach-already-has-a-docstring/74676/12) and it seems to be a Spyder specific issue.
What steps reproduce the problem?
- Import torch in Spyder
- rerun import torch (rerun a script)
What is the expected output? What do you see instead?
The script runs normally the first time, but upon rerunning, it errors on import.
Paste Traceback/Error Below (if applicable)
File "/home/alex/Documents/QML_Research/Variational_Learning_Implementations/Python_Autoregressive/Test_E_loc", line 9, in <module>
import torch
File "/home/alex/anaconda3/envs/Pytorch/lib/python3.6/site-packages/torch/__init__.py", line 188, in <module>
from .tensor import Tensor
File "/home/alex/anaconda3/envs/Pytorch/lib/python3.6/site-packages/torch/tensor.py", line 41, in <module>
class Tensor(torch._C._TensorBase):
File "/home/alex/anaconda3/envs/Pytorch/lib/python3.6/site-packages/torch/tensor.py", line 282, in Tensor
""")
RuntimeError: method 'detach' already has a docstring
Versions
- Spyder version: 3.2.8
- Python version: 3.6
- Qt version: 5.9.6
- PyQt version: 5.9.2
- Operating System name/version: Ubuntu, 18.04
Dependencies
Thanks for the help and hard work, Spyder is a great IDE
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Method 'detach' already has a docstring - PyTorch Forums
Hi When i try to save my model using torch.save i get this error.
Read more >method 'detach' already has a docstring" Can someone help?
I tried reinstalling, upgrading, downgrading nothing seems to help. Programs that don't import torch run fine.
Read more >Why do we call .detach() before calling .numpy() on a Pytorch ...
This other Tensor can then be converted to a numpy array. In other words, the detach method means "I don't want gradients," and...
Read more >Issue 7954: detach method has no docstring - Python tracker
The detach() method has no docstring, so it's impossible to find out about it with pydoc or help(). It would be great if...
Read more >Source code for transformers.file_utils - Hugging Face
Note that if you have a local folder named `datasets` or a local python file named ... docstyle-ignore PYTORCH_IMPORT_ERROR = """ {0} requires...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, You are right. Installing the newest version of Spyder worked for me.
I have a fresh install of the latest version of Spyder (4.2.4) but still get this error. In my case, torch is being called by another library (allosaurus). It will run with no problems the first time, but I have to restart the kernel before it will work again
`Traceback (most recent call last):
File “C:\projects\allosaurus test.py”, line 8, in <module> from allosaurus.app import read_recognizer
File “C:\Program Files\Spyder\pkgs\allosaurus\app.py”, line 1, in <module> from allosaurus.am.utils import *
File “C:\Program Files\Spyder\pkgs\allosaurus\am\utils.py”, line 1, in <module> import torch
File “C:\Program Files\Spyder\pkgs\torch_init_.py”, line 447, in <module> from .tensor import Tensor
File “C:\Program Files\Spyder\pkgs\torch\tensor.py”, line 13, in <module> from torch.overrides import (
File “C:\Program Files\Spyder\pkgs\torch\overrides.py”, line 1229, in <module> “”"
RuntimeError: function ‘_has_torch_function’ already has a docstring`