ModuleNotFoundError with PyTorch and setting a custom interpreter
See original GitHub issueDescription
What steps will reproduce the problem?
i install Spyder_64bit_full.exe
5.1.2, Because the built-in spyderIDE does not have a pytorch library, I use the pytorch that has been installed in Anaconda before, and then import exteral module ,spyder report internal problem,for example:
import torch
b = torch.arange(0,20)
k = b.numpy()
print(k)
i have already set python interpreter is D:/Anaconda3/python.exe
,anaconda have many modules before.
Traceback
Exception in comms call get_namespace_view:
File "D:\Program Files\spyder\pkgs\spyder_kernels\comms\commbase.py", line 315, in _comm_message
encoding='latin-1')
ModuleNotFoundError: No module named 'torch'
Versions
- Spyder version: 5.1.2
- Python version: 3.7.9
- Qt version: 5.12.10
- PyQt5 version: 5.12.3
- Operating System: Windows 10
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.3 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree : None (OK)
IPython >=7.6.0 : 7.27.0 (OK)
jedi >=0.17.2;<0.19.0 : 0.18.0 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 23.1.0 (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.9.0 : 0.8.2 (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.10.0 (OK)
pylint >=2.5.0;<2.10.0 : 2.9.6 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.2.2;<1.3.0 : 1.2.2 (OK)
pylsp_black >=1.0.0 : None (OK)
qdarkstyle =3.0.2 : 3.0.2 (OK)
qstylizer >=0.1.10 : 0.2.1 (OK)
qtawesome >=1.0.2 : 1.0.3 (OK)
qtconsole >=5.1.0 : 5.1.1 (OK)
qtpy >=1.5.0 : 1.10.0 (OK)
rtree >=0.9.7 : 0.9.7 (OK)
setuptools >=49.6.0 : 57.4.0 (OK)
sphinx >=0.6.6 : 4.1.2 (OK)
spyder_kernels >=2.1.1;<2.2.0 : 2.1.1 (OK)
textdistance >=4.2.0 : 4.2.1 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog : 2.1.5 (OK)
zmq >=17 : 22.2.1 (OK)
# Optional:
cython >=0.21 : 0.29.24 (OK)
matplotlib >=2.0.0 : 3.4.3 (OK)
numpy >=1.7 : 1.19.3 (OK)
pandas >=1.1.1 : 1.3.2 (OK)
scipy >=0.17.0 : 1.7.1 (OK)
sympy >=0.7.3 : 1.8 (OK)
Anaconda prompt input conda list
, and I get pytorch have installed:
conda list
pytorch 1.7.0 py3.7_cuda102_cudnn7_0 pytorch
pytorch-lightning 1.2.1 pypi_0 pypi
pytorch-metric-learning 0.9.89 pypi_0 pypi
…
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Module not found in pycharm (Windows) - Stack Overflow
Ok I solved this problem: First install anaconda and open the prompt then type conda install pytorch -c pytorch and pip3 install torchvision ......
Read more >Python ModuleNotFoundError: No Module Named 'torch'
Quick Fix: Python raises the ImportError: No module named 'torch' when it cannot find the library torch . The most frequent source of...
Read more >ImportError: No module named _C · Issue #7 - GitHub
Hi, I met the same problem when installing PyTorch with Python 2.7.13, centos 7 and Anaconda 4.3.0 (64-bit). I also use '/root/anaconda2/bin/python' to...
Read more >torch.fx — PyTorch 1.13 documentation
An Interpreter executes an FX graph Node-by-Node. This pattern can be useful for many things, including writing code transformations as well as analysis...
Read more >How to change Python Version (Interpreter) in VSCode ...
This tutorial will show you the fastest way to change your Python environment in Visual Studio code.00:00 VSCode how to change Python ...
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
@ccordoba12 I was able to reproduce this. @cuixing158 as a workaround seems like checking the option
Exclude unsupported data types
in the variable explorer options menu prevents the error dialog poping-up. Let us know if that helps!@dalthviz, could you try to solve this problem next week to see if we can include a fix for this in 5.2.0?