I’m getting below error while importing torch version 1.9.0
---> 22 import torch
23 from tqdm import tqdm
24 from attrdict import AttrDict
/python/PROJ/torch/1.9.0-py37/exec/lib/torch/__init__.py in <module>()
227
228
--> 229 __all__ += [name for name in dir(_C)
230 if name[0] != '_' and
231 not name.endswith('Base')]
NameError: name '_C' is not defined
Note: imported Cython 0.29.21 version as I see here. But no luck.
I verified that my current working directory is project home, and not torch directory.
Are you able to cd into an empty directory and import torch there? If so, I guess some scripts in your current wdir might be using “common” names and could thus interact with Python or PyTorch internals.
my current working directory is: /user/rahul/MyApp/examples
I created a notebook in this path and just doing import torch in the notebook. Then, I get the above mentioned error. The directory: /user/rahul/MyApp/examples has no files except the notebook that I created. This error happens only when I change torch version from 1.4.0 to 1.9.0.