Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

RaisesTypeError: 'torch._C._TensorMeta' object is not iterable when import torch #104496

Closed
craii opened this issue Jul 1, 2023 · 5 comments
Closed
Assignees
Labels
module: windows Windows support for PyTorch needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@craii
Copy link

craii commented Jul 1, 2023

馃悰 Describe the bug

TypeError: 'torch._C._TensorMeta' object is not iterable

[TOC]

system and environment

  • Hardware
    sys
    gpu
    gpu1

  • cuda
    cuda

  • python

steps

  1. create the venv (workenv) with : python -m venv workenv

  2. install pytorch:

  3. check

I have tried reinstall cuda 12.1 and repeat step 1. 2. 3 but bugs remains

Versions

torch 2. 0. 1

cc @ezyang @gchanan @zou3519 @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite

@zou3519 zou3519 added high priority needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user module: windows Windows support for PyTorch labels Jul 5, 2023
@zou3519
Copy link
Contributor

zou3519 commented Jul 5, 2023

Likely hi-pri if it repros

@malfet malfet added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jul 10, 2023
@malfet
Copy link
Contributor

malfet commented Jul 10, 2023

Can not reproduce it on my end, so removing hi-pri for now (but will add it back if more users encounter it):

PS C:\Users\nshulga>python -m venv  workenv
PS C:\Users\nshulga> .\workenv\Scripts\Activate.ps1
(workenv) PS C:\Users\nshulga> pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
Looking in indexes: https://download.pytorch.org/whl/cu117
Collecting torch
  Downloading https://download.pytorch.org/whl/cu117/torch-2.0.1%2Bcu117-cp38-cp38-win_amd64.whl (2343.7 MB)
     |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 2343.7 MB 2.9 kB/s
Collecting torchvision
  Using cached https://download.pytorch.org/whl/cu117/torchvision-0.15.2%2Bcu117-cp38-cp38-win_amd64.whl (4.9 MB)
Collecting torchaudio
  Using cached https://download.pytorch.org/whl/cu117/torchaudio-2.0.2%2Bcu117-cp38-cp38-win_amd64.whl (2.5 MB)
Collecting typing-extensions
  Using cached https://download.pytorch.org/whl/typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting jinja2
  Using cached https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting sympy
  Using cached https://download.pytorch.org/whl/sympy-1.11.1-py3-none-any.whl (6.5 MB)
Collecting networkx
  Using cached https://download.pytorch.org/whl/networkx-3.0-py3-none-any.whl (2.0 MB)
Collecting filelock
  Using cached https://download.pytorch.org/whl/filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting numpy
  Using cached https://download.pytorch.org/whl/numpy-1.24.1-cp38-cp38-win_amd64.whl (14.9 MB)
Collecting pillow!=8.3.*,>=5.3.0
  Using cached https://download.pytorch.org/whl/Pillow-9.3.0-cp38-cp38-win_amd64.whl (2.5 MB)
Collecting requests
  Using cached https://download.pytorch.org/whl/requests-2.28.1-py3-none-any.whl (62 kB)
Collecting MarkupSafe>=2.0
  Downloading https://download.pytorch.org/whl/MarkupSafe-2.1.2-cp38-cp38-win_amd64.whl (16 kB)
Collecting mpmath>=0.19
  Using cached https://download.pytorch.org/whl/mpmath-1.2.1-py3-none-any.whl (532 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached https://download.pytorch.org/whl/urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
Collecting charset-normalizer<3,>=2
  Using cached https://download.pytorch.org/whl/charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Using cached https://download.pytorch.org/whl/certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting idna<4,>=2.5
  Using cached https://download.pytorch.org/whl/idna-3.4-py3-none-any.whl (61 kB)
Installing collected packages: typing-extensions, MarkupSafe, jinja2, mpmath, sympy, networkx, filelock, torch, numpy, pillow, urllib3, charset-normalizer, certifi, idna, requests, torchvision, torchaudio
Successfully installed MarkupSafe-2.1.2 certifi-2022.12.7 charset-normalizer-2.1.1 filelock-3.9.0 idna-3.4 jinja2-3.1.2 mpmath-1.2.1 networkx-3.0 numpy-1.24.1 pillow-9.3.0 requests-2.28.1 sympy-1.11.1 torch-2.0.1+cu117 torchaudio-2.0.2+cu117 torchvision-0.15.2+cu117 typing-extensions-4.4.0 urllib3-1.26.13
(workenv) PS C:\Users\nshulga> python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.0.1+cu117'
>>> torch.__file__
'C:\\Users\\nshulga\\workenv\\lib\\site-packages\\torch\\__init__.py'
>>> exit()

@laddg95
Copy link

laddg95 commented Jul 31, 2023

#97748

Solution: Downgrade Python version. The recommended version is 3.8, but please be aware not to go too low. Refer to the discussion at https://discuss.pytorch.org/t/pytorch-2-0-supported-python-version/174962.

I just resolved the same error. Initially, my CUDA version was 12.0, PyTorch version was torch 2.0.1 for CUDA 11.8, and Python versions were 3.10.0 and 3.9.0, but all gave me an error. I thought the issue was due to the compatibility between PyTorch and CUDA versions, so I tried installing CUDA 11.8. The result proved that the issue was not due to CUDA, although this might also be a potential important factor.

Now, my CUDA version is 11.8, PyTorch version is torch 2.0.1 for CUDA 11.8. I failed to load torch using Python 3.9.0, but successfully loaded it using Python 3.8.8.

@alinpahontu2912
Copy link
Collaborator

@craii are you still having this issue ? I tried reproducing it with your configuration (python 3.10 and pytorch 2.0.1+cu117) and did not run into this issue. According to this pytorch post, the python, cuda and pytorch versions used by you should work well together.

@iremyux
Copy link
Collaborator

iremyux commented Sep 26, 2023

Closing this issue because it is a duplicate of #97748, and lack of activity.
Please feel free to open a new issue if you encounter any other problems or have any feature requests.

@iremyux iremyux closed this as completed Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: windows Windows support for PyTorch needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: Done
Development

No branches or pull requests

7 participants