jpuigcerver / pytorch-baidu-ctc

PyTorch bindinga for Baidu's Warp-CTC
Apache License 2.0
59 stars 11 forks source link

Import error #4

Closed Sangkwun closed 5 years ago

Sangkwun commented 5 years ago

I'm trying to install this library on custom Docker image. But It shows below error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/miniconda/envs/py36/lib/python3.6/site-packages/torch_baidu_ctc/__init__.py", line 4, in <module>
    import torch_baidu_ctc._C as _torch_baidu_ctc
ImportError: /miniconda/envs/py36/lib/python3.6/site-packages/torch_baidu_ctc/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2at19UndefinedTensorImpl10_singleton

Below is my docker file.

# docker run -it -v $(pwd):/ocr -v /ssd/dataset/ai_challenge/recognition:/dataset deep-text
ARG CUDA="9.0"
ARG CUDNN="7"

FROM nvidia/cuda:${CUDA}-cudnn${CUDNN}-devel-ubuntu16.04
ENV LC_ALL=C.UTF-8

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

# install basics
RUN apt-get update -y \
 && apt-get install -y apt-utils git curl ca-certificates bzip2 cmake tree htop bmon iotop g++ \
 && apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev

# Install Miniconda
RUN curl -so /miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
 && chmod +x /miniconda.sh \
 && /miniconda.sh -b -p /miniconda \
 && rm /miniconda.sh

ENV PATH=/miniconda/bin:$PATH

# Create a Python 3.6 environment
RUN /miniconda/bin/conda install -y conda-build \
 && /miniconda/bin/conda create -y --name py36 python=3.6.7 \
 && /miniconda/bin/conda clean -ya

ENV CONDA_DEFAULT_ENV=py36
ENV CONDA_PREFIX=/miniconda/envs/$CONDA_DEFAULT_ENV
ENV PATH=$CONDA_PREFIX/bin:$PATH
ENV CONDA_AUTO_UPDATE_CONDA=false

RUN conda install -y ipython
RUN pip install ninja yacs cython matplotlib opencv-python tqdm tensorboardX

# deep-text dependencies
RUN pip install lmdb pillow nltk torch-baidu-ctc 

# Install PyTorch 1.0 Nightly
ARG CUDA
RUN conda install pytorch-nightly cudatoolkit=${CUDA} -c pytorch \
 && conda clean -ya

# Install TorchVision master
RUN git clone https://github.com/pytorch/vision.git \
 && cd vision \
 && python setup.py install

WORKDIR /ocr
jpuigcerver commented 5 years ago

Hi,

pytorch-baidu-ctc was compiled with PyTorch 1.0.1. The nightly version is 1.1.0, and it seems that the new version has some missing symbols in the library. You have two options:

a) If you want to use pytorch-baidu-ctc with PyTorch 1.1.0 (nightly), clone this repository and install it from source. b) Install PyTorch 1.0.1 and use the pypi package.