AttributeError: module ‘torch._C’ has no attribute ‘ExtraFilesMap’
Hi,everyone,I was in trouble with the compilation from pytorch source code cloned from master branch, during the compilation, there was no error, but after the compilation, trying to import torch from python interpreter raise an error:
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/torch/__init__.py", line 478, in <module>
import torch.nn.quantized
File "/usr/local/lib/python3.6/site-packages/torch/nn/quantized/__init__.py", line 6, in <module>
from .modules import *
File "/usr/local/lib/python3.6/site-packages/torch/nn/quantized/modules/__init__.py", line 9, in <module>
from .conv import Conv1d, Conv2d, Conv3d
File "/usr/local/lib/python3.6/site-packages/torch/nn/quantized/modules/conv.py", line 16, in <module>
from torch._ops import ops
File "/usr/local/lib/python3.6/site-packages/torch/_ops.py", line 9, in <module>
import torch.jit
File "/usr/local/lib/python3.6/site-packages/torch/jit/__init__.py", line 133, in <module>
DEFAULT_EXTRA_FILES_MAP = torch._C.ExtraFilesMap()
AttributeError: module 'torch._C' has no attribute 'ExtraFilesMap'
PS: the compilation is completed in a running docker container (ubuntu16.04, cuda10.0, cudnn7.6.5, RTX2070 graphic card on the host machine, gpu driver 418.39)
To Reproduce
Steps to reproduce the behavior:
- conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses
- USE_CUDNN=1 python setup.py install
- import torch from python interpreter
Expected behavior
AttributeError: module ‘torch._C’ has no attribute ‘ExtraFilesMap’
Environment
- PyTorch Version (e.g., 1.0):1.7.0a0
- OS (e.g., Linux): 16.04.1-Ubuntu
- How you installed PyTorch (
conda
,pip
, source): source - Build command you used (if compiling from source):
-
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses
-
USE_CUDNN=1 python setup.py install
-
Python version: 3.6.10
-
CUDA/cuDNN version: 10.0, V10.0.130/7.6.5
-
GPU models and configuration: RTX2070, driver 418.39
-
Any other relevant information:
compilation is done in a running docker container started with nvidia-docker.
Additional context
below is my Dockerfile for building the docker image I use.
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04
RUN apt-get clean && \
rm -rfv /var/lib/apt/lists/* && apt-get clean
RUN apt-get update && \
apt-get install -y software-properties-common
RUN apt-get update --fix-missing && apt-get install -y --no-install-recommends --allow-unauthenticated \
libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \
build-essential \
software-properties-common \
curl \
cmake \
libfreetype6-dev \
libpng12-dev \
libzmq3-dev \
pkg-config \
rsync \
zip \
unzip \
git \
wget \
vim \
openssh-server \
openssl libssl-dev \
ca-certificates \
apt-utils libsm6 libxrender1 libxext-dev libglib2.0-0 \
language-pack-zh-hans \
&& \
apt-get update --allow-unauthenticated && apt-get install libsndfile1 -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# configure python 3.6.10
ADD python-3.6.10.tar /python_build
RUN cd /python_build/Python-3.6.10 \
&& ./configure && make && make install
# update pip
# RUN python3.6 -m pip install pip --upgrade && \
# python3.6 -m pip install wheel
RUN ln -s $(which python3) /usr/bin/python && \
ln -s $(which pip3) /usr/local/bin/pip && pip install --upgrade pip && pip install wheel
RUN python -V && pip -V && rm -rfv /python_build
# Chinese Charactors support
RUN apt-get install -y locales \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV LANG=LANG=zh_CN.UTF-8
ENV PYTHONIOENCODING=utf-8
ENV PYTHONPATH=/usr/src/app
ENV TZ=Asia/Shanghai
# CUDA environment
ENV PATH /usr/local/cuda/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH
the link to the python3.6.10 source code.