I was trying to install libtorch version 1.8.1 on ubuntu 18 following the following code:

git clone GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
cd pytorch/
git checkout v1.8.1
update submodule, this may take a while
git submodule update --init --recursive
change protobuf to v3.6.1
cd third_party/protobuf
git checkout v3.6.1
cd …/…
activate a conda virtual env with python3.8
conda activate py38
python setup.py install
sudo mkdir -p /opt/allride/third_party/libtorch
sudo chmod -R 755 /opt/allride
cp -r torch/lib /opt/allride/third_party/libtorch
cp -r torch/share /opt/allride/third_party/libtorch
cp -r torch/include /opt/allride/third_party/libtorch


echo “export LD_LIBRARY_PATH=/opt/allride/third_party/libtorch/lib:$LD_LIBRARY_PATH” >> ~/.bashrc

Yet, I can execute the last two copy command. It told me that torch/share, torch/include directory can not be found.
Then,

~/pytorch/torch$ libtorch
Error processing line 1 of /home/allride/.local/lib/python3.6/site-packages/google_auth-2.3.0-py3.10-nspkg.pth:
Failed to import the site module
Traceback (most recent call last):
File “/usr/lib/python3.6/site.py”, line 174, in addpackage
exec(line)
File “”, line 1, in 
File “/home/allride/pytorch/torch/types.py”, line 1, in 
import torch
File “/opt/allride/third_party/libtorch/python2.7/torch/init.py”, line 13, in 
import platform
File “/usr/lib/python3.6/platform.py”, line 116, in 
import sys, os, re, subprocess
File “/usr/lib/python3.6/re.py”, line 122, in 
import enum
File “/usr/lib/python3.6/enum.py”, line 2, in 
from types import MappingProxyType, DynamicClassAttribute
ImportError: cannot import name ‘MappingProxyType’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.6/site.py”, line 570, in 
main()
File “/usr/lib/python3.6/site.py”, line 556, in main
known_paths = addusersitepackages(known_paths)
File “/usr/lib/python3.6/site.py”, line 291, in addusersitepackages
addsitedir(user_site, known_paths)
File “/usr/lib/python3.6/site.py”, line 213, in addsitedir
addpackage(sitedir, name, known_paths)
File “/usr/lib/python3.6/site.py”, line 184, in addpackage
import traceback
File “/usr/lib/python3.6/traceback.py”, line 5, in 
import linecache
File “/usr/lib/python3.6/linecache.py”, line 8, in 
import functools
File “/usr/lib/python3.6/functools.py”, line 22, in 
from types import MappingProxyType
File “/home/allride/pytorch/torch/types.py”, line 1, in 
import torch
File “/opt/allride/third_party/libtorch/python2.7/torch/init.py”, line 13, in 
import platform
File “/usr/lib/python3.6/platform.py”, line 116, in 
import sys, os, re, subprocess
File “/usr/lib/python3.6/re.py”, line 122, in 
import enum
File “/usr/lib/python3.6/enum.py”, line 2, in 
from types import MappingProxyType, DynamicClassAttribute
ImportError: cannot import name ‘MappingProxyType’

I searched this error message online and it told me that one possible cause is because of the use of type in one self-defined module.
I do not know how to proceed. Any comments are greatly appreciated.