spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

RuntimeError: function '_has_torch_function' already has a docstring #15987

Closed naomiS-R closed 3 years ago

naomiS-R commented 3 years ago

Description

What steps will reproduce the problem?

  1. Import PyTorch
  2. Run code, works fine
  3. Run code again
  4. Error occurs

This is an issue with Spyder and nothing else, as I can do this in IDLE just fine. This issue has been raised before and marked as solved, when it is happening still. Running Python 3.8, latest version of Spyder.

Full Error message below:

Reloaded modules: torch._utils, torch._utils_internal, torch.version, torch._six, torch._C, torch._namedtensor_internals, torch.overrides, torch.utils.throughput_benchmark, torch.utils._crash_handler, torch.utils, torch.utils.hooks, torch._tensor, torch.storage, torch.random, torch.types, torch.serialization, torch._tensor_str, torch.cuda._utils, torch.cuda.streams, torch.cuda.memory, torch.cuda.random, torch.cuda.sparse, torch.cuda.profiler, torch.cuda.nvtx, torch.cuda.amp.common, torch.cuda.amp.autocast_mode, torch.cuda.amp.grad_scaler, torch.cuda.amp, torch.cuda, torch.sparse, torch.nn.parameter, torch.nn.modules.module, torch._torch_docs, torch.distributed.constants, torch.distributed.rendezvous, torch.distributed.distributed_c10d, torch.distributed, torch.distributed.rpc, torch.futures, torch.package.analyze.trace_dependencies, torch.package.analyze, torch.package._mangling, torch.package.analyze.is_from_package, torch.package.glob_group, torch.package.file_structure_representation, torch.package.importer, torch.package._digraph, torch.package._importlib, torch.package._package_pickler, torch.package._stdlib, torch.package.find_file_dependencies, torch.package.package_exporter, torch.package._mock_zipreader, torch.package._package_unpickler, torch.package.package_importer, torch.package, torch._jit_internal, torch.nn._reduction, torch.nn.modules.utils, torch.nn.grad, torch.nn.functional, torch.nn.init, torch.nn.modules.lazy, torch.nn.modules.linear, torch.nn.common_types, torch.nn.modules.conv, torch.nn.modules.activation, torch.nn.modules.distance, torch.nn.modules.loss, torch.nn.modules.container, torch.nn.modules.pooling, torch.autograd.variable, torch.autograd.function, torch.testing._core, torch.testing._asserts, torch.testing._check_kernel_launches, torch.testing, torch.utils._pytree, torch._vmap_internals, torch.autograd.gradcheck, torch.autograd.grad_mode, torch.autograd.anomaly_mode, torch.autograd.functional, torch.autograd.forward_ad, torch.autograd.profiler, torch.autograd, torch.nn.modules._functions, torch.nn.modules.batchnorm, torch.nn.modules.instancenorm, torch.nn.modules.normalization, torch.nn.modules.dropout, torch.nn.modules.padding, torch.nn.modules.sparse, torch.nn.utils.rnn, torch.nn.utils.clip_grad, torch.nn.utils.weight_norm, torch.nn.utils.convert_parameters, torch.nn.utils.spectral_norm, torch.nn.utils.fusion, torch.nn.utils.memory_format, torch.nn.utils.parametrize, torch.nn.utils.parametrizations, torch.nn.utils, torch.nn.modules.rnn, torch.nn.modules.pixelshuffle, torch.nn.modules.upsampling, torch.nn.modules.fold, torch.nn.modules.adaptive, torch.nn.modules.transformer, torch.nn.modules.flatten, torch.nn.modules.channelshuffle, torch.nn.modules, torch.nn.parallel.parallel_apply, torch.cuda.nccl, torch.nn.parallel.comm, torch.nn.parallel.replicate, torch.nn.parallel._functions, torch.nn.parallel.scatter_gather, torch.nn.parallel.data_parallel, torch.nn.parallel.distributed, torch.nn.parallel, torch.nn, torch._linalg_utils, torch._lowrank, torch._autograd_functions, torch.functional, torch.fft, torch.nn.intrinsic.modules.fused, torch.nn.intrinsic.modules, torch.nn.intrinsic, torch.nn.quantized.modules.utils, torch.jit._monkeytype_config, torch.jit._state, torch.jit.annotations, torch.jit.frontend, torch.backends, torch.backends.cudnn, torch.jit._builtins, torch.jit._check, torch.jit._recursive, torch.jit._fuser, torch.jit._serialization, torch.distributed.autograd, torch.jit._script, torch.jit._trace, torch.jit._async, torch.jit._freeze, torch.jit, torch.nn.quantized.functional, torch.nn.quantized.modules.activation, torch.nn.quantized.modules.batchnorm, torch.nn.quantized.modules.normalization, torch.nn.qat.modules.linear, torch.nn.qat.modules.conv, torch.nn.qat.modules, torch.nn.qat, torch.nn.intrinsic.qat.modules.linear_relu, torch.nn.intrinsic.qat.modules.conv_fused, torch.nn.intrinsic.qat.modules, torch.nn.intrinsic.qat, torch._ops, torch.nn.quantized.modules.conv, torch.nn.quantized.modules.linear, torch.nn.quantized.modules.embedding_ops, torch.nn.quantized.modules.functional_modules, torch.nn.quantized.modules, torch.nn.quantized, torch.nn.quantizable.modules.activation, torch.nn.quantizable.modules.rnn, torch.nn.quantizable.modules, torch.nn.quantizable, torch.optim._functional, torch.optim.optimizer, torch.optim.adadelta, torch.optim.adagrad, torch.optim.adam, torch.optim.adamw, torch.optim.sparse_adam, torch.optim.adamax, torch.optim.asgd, torch.optim.sgd, torch.optim.rprop, torch.optim.rmsprop, torch.optim.lbfgs, torch.optim.lr_scheduler, torch.optim.swa_utils, torch.optim, torch.optim._multi_tensor.adam, torch.optim._multi_tensor.adamw, torch.optim._multi_tensor.sgd, torch.optim._multi_tensor.rmsprop, torch.optim._multi_tensor.rprop, torch.optim._multi_tensor.asgd, torch.optim._multi_tensor.adamax, torch.optim._multi_tensor.adadelta, torch.optim._multi_tensor, torch.multiprocessing.reductions, torch.multiprocessing.spawn, torch.multiprocessing, torch.special, torch.utils.backcompat, torch.onnx, torch.linalg, torch.hub, torch.distributions.constraints, torch.distributions.utils, torch.distributions.distribution, torch.distributions.exp_family, torch.distributions.bernoulli, torch.distributions.dirichlet, torch.distributions.beta, torch.distributions.binomial, torch.distributions.categorical, torch.distributions.cauchy, torch.distributions.gamma, torch.distributions.chi2, torch.distributions.transforms, torch.distributions.constraint_registry, torch.distributions.continuous_bernoulli, torch.distributions.exponential, torch.distributions.fishersnedecor, torch.distributions.geometric, torch.distributions.uniform, torch.distributions.independent, torch.distributions.transformed_distribution, torch.distributions.gumbel, torch.distributions.half_cauchy, torch.distributions.normal, torch.distributions.half_normal, torch.distributions.laplace, torch.distributions.multivariate_normal, torch.distributions.lowrank_multivariate_normal, torch.distributions.one_hot_categorical, torch.distributions.pareto, torch.distributions.poisson, torch.distributions.kl, torch.distributions.kumaraswamy, torch.distributions.lkj_cholesky, torch.distributions.log_normal, torch.distributions.logistic_normal, torch.distributions.mixture_same_family, torch.distributions.multinomial, torch.distributions.negative_binomial, torch.distributions.relaxed_bernoulli, torch.distributions.relaxed_categorical, torch.distributions.studentT, torch.distributions.von_mises, torch.distributions.weibull, torch.distributions, torch.backends.cuda, torch.backends.mkl, torch.backends.mkldnn, torch.backends.openmp, torch.backends.quantized, torch.nn.intrinsic.quantized.modules.linear_relu, torch.nn.intrinsic.quantized.modules.conv_relu, torch.nn.intrinsic.quantized.modules.bn_relu, torch.nn.intrinsic.quantized.modules, torch.nn.intrinsic.quantized, torch.nn.quantized.dynamic.modules.linear, torch.nn.quantized.dynamic.modules.rnn, torch.nn.quantized.dynamic.modules, torch.nn.quantized.dynamic, torch.quantization.stubs, torch.quantization.observer, torch.quantization.fake_quantize, torch.quantization.quant_type, torch.quantization.utils, torch.quantization.quantization_mappings, torch.quantization.qconfig, torch.quantization.quantize, torch.quantization.fuser_method_mappings, torch.quantization.fuse_modules, torch.quantization.quantize_jit, torch.quantization, torch.utils.data.sampler, torch.utils.data._typing, torch.utils.data.dataset, torch.utils.data.distributed, torch.utils.data._utils.signal_handling, torch.utils.data._utils.worker, torch.utils.data._utils.pin_memory, torch.utils.data._utils.collate, torch.utils.data._utils.fetch, torch.utils.data._utils, torch.utils.data.dataloader, torch.utils.data._decorator, torch.utils.data.datapipes.utils, torch.utils.data.datapipes.utils.common, torch.utils.data.datapipes.iter.listdirfiles, torch.utils.data.datapipes.iter.loadfilesfromdisk, torch.utils.data.datapipes.iter.readfilesfromtar, torch.utils.data.datapipes.iter.readfilesfromzip, torch.utils.data.datapipes.utils.decoder, torch.utils.data.datapipes.iter.routeddecoder, torch.utils.data.datapipes.iter.callable, torch.utils.data.datapipes.iter.combining, torch.utils.data.datapipes.iter.combinatorics, torch.utils.data.datapipes.iter.grouping, torch.utils.data.datapipes.iter.selecting, torch.utils.data.datapipes.iter, torch.utils.data.datapipes, torch.utils.data, torch.config, torch.future, torch.profiler.profiler, torch.profiler, torch._tensor_docs, torch._storage_docs, torch._classes, torch.quasirandom, torch.multiprocessing._atfork, torch._lobpcg, torch, torchvision.extension, torchvision.models.utils, torchvision.models.alexnet, torchvision.models.resnet, torchvision.models.vgg, torchvision.models.squeezenet, torchvision.models.inception, torch.utils.checkpoint, torchvision.models.densenet, torchvision.models.googlenet, torchvision.models.mobilenetv2, torchvision.models.mobilenetv3, torchvision.models.mobilenet, torchvision.models.mnasnet, torchvision.models.shufflenetv2, torchvision.models._utils, torchvision.models.segmentation._utils, torchvision.models.segmentation.deeplabv3, torchvision.models.segmentation.fcn, torchvision.models.segmentation.lraspp, torchvision.models.segmentation.segmentation, torchvision.models.segmentation, torchvision.ops._box_convert, torchvision.ops.boxes, torchvision.ops.deform_conv, torchvision.ops._utils, torchvision.ops.roi_align, torchvision.ops.roi_pool, torchvision.ops.ps_roi_align, torchvision.ops.ps_roi_pool, torchvision.ops.poolers, torchvision.ops.feature_pyramid_network, torchvision.ops.focal_loss, torchvision.ops._register_onnx_ops, torch.onnx.utils, torch.onnx.symbolic_helper, torch.onnx.symbolic_opset9, torch.onnx.symbolic_opset7, torch.onnx.symbolic_opset8, torch.onnx.symbolic_opset10, torch.onnx.symbolic_opset11, torch.onnx.symbolic_opset12, torch.onnx.symbolic_opset13, torch.onnx.symbolic_registry, torchvision.ops, torchvision.ops.misc, torchvision.models.detection._utils, torchvision.models.detection.image_list, torchvision.models.detection.anchor_utils, torchvision.models.detection.generalized_rcnn, torchvision.models.detection.rpn, torchvision.models.detection.roi_heads, torchvision.models.detection.transform, torchvision.models.detection.backbone_utils, torchvision.models.detection.faster_rcnn, torchvision.models.detection.mask_rcnn, torchvision.models.detection.keypoint_rcnn, torchvision.models.detection.retinanet, torchvision.models.detection.ssd, torchvision.models.detection.ssdlite, torchvision.models.detection, torchvision.models.video.resnet, torchvision.models.video, torchvision.models.quantization.utils, torchvision.models.quantization.mobilenetv2, torchvision.models.quantization.mobilenetv3, torchvision.models.quantization.mobilenet, torchvision.models.quantization.resnet, torchvision.models.quantization.googlenet, torchvision.models.quantization.inception, torchvision.models.quantization.shufflenetv2, torchvision.models.quantization, torchvision.models, torchvision.datasets.vision, torch.utils.model_zoo, torchvision.datasets._utils, torchvision.datasets.utils, torchvision.datasets.lsun, torchvision.datasets.folder, torchvision.datasets.coco, torchvision.datasets.cifar, torchvision.datasets.stl10, torchvision.datasets.mnist, torchvision.datasets.svhn, torchvision.datasets.phototour, torchvision.transforms.functional_pil, torchvision.transforms.functional_tensor, torchvision.transforms.functional, torchvision.transforms.transforms, torchvision.transforms.autoaugment, torchvision.transforms, torchvision.datasets.fakedata, torchvision.datasets.semeion, torchvision.datasets.omniglot, torchvision.datasets.sbu, torchvision.datasets.flickr, torchvision.datasets.voc, torchvision.datasets.cityscapes, torchvision.datasets.imagenet, torchvision.datasets.caltech, torchvision.datasets.celeba, torchvision.datasets.widerface, torchvision.datasets.sbd, torchvision.datasets.usps, torchvision.io._video_opt, torchvision.io.video, torchvision.io.image, torchvision.io, torchvision.datasets.video_utils, torchvision.datasets.kinetics, torchvision.datasets.hmdb51, torchvision.datasets.ucf101, torchvision.datasets.places365, torchvision.datasets.kitti, torchvision.datasets, torchvision.utils, torchvision.version, torchvision Traceback (most recent call last):

File "C:\Users\naomi.spyder-py3\temp.py", line 8, in import torch

File "C:\Users\naomi\AppData\Local\Programs\Python\Python38\Lib\site-packages\torch__init__.py", line 515, in from ._tensor import Tensor

File "C:\Users\naomi\AppData\Local\Programs\Python\Python38\Lib\site-packages\torch_tensor.py", line 13, in from torch.overrides import (

File "C:\Users\naomi\AppData\Local\Programs\Python\Python38\Lib\site-packages\torch\overrides.py", line 1262, in has_torch_function = _add_docstr(

RuntimeError: function '_has_torch_function' already has a docstring

Traceback

Exception in comms call get_namespace_view:
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 314, in _comm_message
    buffer = cloudpickle.loads(msg['buffers'][0],
AttributeError: type object 'Size' has no attribute 'numel'

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.22.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.9.0 (OK)
pylint >=1.0                  :  2.9.3 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2;<0.4.0    :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.1.0             :  5.1.0 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=39.0.0           :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                :  4.0.2 (OK)
spyder_kernels >=2.0.3;<2.1.0 :  2.0.3 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  20.0.0 (OK)

# Optional:
cython >=0.21                 :  0.29.23 (OK)
matplotlib >=2.0.0            :  3.4.2 (OK)
numpy >=1.7                   :  1.20.2 (OK)
pandas >=1.1.1                :  1.2.5 (OK)
scipy >=0.17.0                :  1.6.2 (OK)
sympy >=0.7.3                 :  1.8 (OK)
dalthviz commented 3 years ago

Hi @naomiS-R thanks for the feedback! Could you deactivate the UMR functionality and try again?

image

Also, our latest release is 5.0.5, could you update Spyder and check again?

Let us know if that helps!

dalthviz commented 3 years ago

Closing due to lack of response

SoumyadipYT-OSS commented 10 months ago

Thank you for this knowledge @dalthviz