Error, Compiled pytorch from source on power9 machine(cannot import name ‘_add_docstr’ from ‘torch._C’ (unknown location)..)

I tried to compile pytorch from source on IBM power9.

The compile progress was success. But when I import torch insider python the error shows


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/castles/nr/projects/d/duanj-ai-in-medical-imaging/.share/download/pytorch/torch/__init__.py", line 326, in <module>
    from .tensor import Tensor
  File "/castles/nr/projects/d/duanj-ai-in-medical-imaging/.share/download/pytorch/torch/tensor.py", line 9, in <module>
    from torch._C import _add_docstr
ImportError: cannot import name '_add_docstr' from 'torch._C' (unknown location)

cc @malfet

1 possible answer(s) on “Error, Compiled pytorch from source on power9 machine(cannot import name ‘_add_docstr’ from ‘torch._C’ (unknown location)..)

  1. Are you starting your python interpreter from pytorch root directory? Depending on how you installed pytorch that might lead to errors, try changing directory.