question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

RuntimeError: No such operator image::read_file on Docker

See original GitHub issue

šŸ› Bug

In a Docker environment, torch.io.read_file causes RuntimeError: No such operator image::read_file.

To Reproduce

1. Setup a container

I used the following Docker file.

FROM nvidia/cuda:11.0-base-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -qq \
    && apt install -y -qq \
    apt-utils \
    bzip2 \
    build-essential \
    cmake \
    curl \
    git \
    libncurses5-dev \
    libncursesw5-dev \
    libboost-all-dev \
    locales \
    nasm \
    ruby \
    sudo \
    swig \
    unzip \
    wget \
    zsh \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

ENV CONDADIR ${HOME}/.miniconda
RUN cd ${HOME} \
    && wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \
    && bash miniconda.sh -b -p ${CONDADIR} \
    && rm miniconda.sh
docker build -t test .
docker run --rm -it test
# in the launched container
export PATH=.miniconda/bin:$PATH
conda create -n test python=3.9 -y
source activate test
conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision cudatoolkit=11.1 numpy -y # another issue, but numpy is not automatically installed as a dependency

Run the following

import torchvision
torchvision.io.read_file(".")
# RuntimeError: No such operator image::read_file

Expected behavior

Environment

collect_env.py collects the following information (Docker v20.10.7).

Collecting environment information...
PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: 11.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.1 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.9.5 (default, Jun  4 2021, 12:28:51)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.0-77-generic-x86_64-with-glibc2.31
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.0
[pip3] torch==1.9.0
[pip3] torchvision==0.10.0
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               11.1.74              h6bb024c_0    nvidia
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] libblas                   3.9.0                     9_mkl    conda-forge
[conda] libcblas                  3.9.0                     9_mkl    conda-forge
[conda] liblapack                 3.9.0                     9_mkl    conda-forge
[conda] mkl                       2021.2.0           h06a4308_296
[conda] numpy                     1.21.0           py39hdbf815f_0    conda-forge
[conda] pytorch                   1.9.0           py3.9_cuda11.1_cudnn8.0.5_0    pytorch
[conda] torchvision               0.10.0               py39_cu111    pytorch

Additional context

I could not reproduce this issue in a non-Docker environment. A nightly build resolved this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
saswatppcommented, Sep 4, 2021

Hi this error still persists in pytorch 1.10.0.dev20210902 (cpu only version) and torchvision 0.11.0a0+ad3c3f7. The environment is WSL.

I was trying to build the docs. Torchvision was installed using :

python setup.py develop

Exact Error :

make html
Running Sphinx v3.5.4
loading intersphinx inventory from https://docs.python.org/objects.inv...
loading intersphinx inventory from https://pytorch.org/docs/stable/objects.inv...
loading intersphinx inventory from http://docs.scipy.org/doc/numpy/objects.inv...
loading intersphinx inventory from https://pillow.readthedocs.io/en/stable/objects.inv...
loading intersphinx inventory from https://matplotlib.org/stable/objects.inv...
intersphinx inventory has moved: https://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
intersphinx inventory has moved: http://docs.scipy.org/doc/numpy/objects.inv -> https://numpy.org/doc/stable/objects.inv
generating gallery...
Using Sphinx-Gallery to convert rst text blocks to markdown for .ipynb files.
generating gallery for auto_examples... [ 25%] plot_scripted_tensor_transforms.py
Warning, treated as error:
/mnt/g/devel/vision/gallery/plot_scripted_tensor_transforms.py failed to execute correctly: Traceback (most recent call last):
  File "/mnt/g/devel/vision/gallery/plot_scripted_tensor_transforms.py", line 52, in <module>
    dog1 = read_image(str(Path('assets') / 'dog1.jpg'))
  File "/mnt/g/devel/vision/torchvision/io/image.py", line 222, in read_image
    data = read_file(path)
  File "/mnt/g/devel/vision/torchvision/io/image.py", line 42, in read_file
    data = torch.ops.image.read_file(path)
  File "/home/konoha/.conda/envs/vision/lib/python3.7/site-packages/torch/_ops.py", line 63, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator image::read_file

Makefile:41: recipe for target 'html' failed
make: *** [html] Error 2

EDIT

I tried to install conda install jpeg 9d and tried building the docs. The above error didnā€™t occur but a new one did :

RuntimeError: Not compiled with video_reader support, to enable video_reader support, please install ffmpeg (version 4.2 is currently supported) andbuild torchvision from source.

This is the build log (only the initial part). It is saying that ffmpeg support is disabled because header files are not found.

Building wheel torchvision-0.11.0a0+e95db7a
PNG found: True
libpng version: 1.6.37
Building torchvision with PNG image support
libpng include path: /home/konoha/.conda/envs/vision/include/libpng16
Running build on conda-build: False
Running build on conda: True
JPEG found: True
Building torchvision with JPEG image support
NVJPEG found: False
FFmpeg found: True
libswresample header files were not found, disabling ffmpeg supportlibavformat header files were not found, disabling ffmpeg support
libavcodec header files were not found, disabling ffmpeg support
libavutil header files were not found, disabling ffmpeg support
libswscale header files were not found, disabling ffmpeg support
running develop

EDIT 2 The issue is fixed now. I was building the entire docs even though torchvision wasnā€™t build with ffmpeg support. Setting the Environment variable EXAMPLES_PATTERN=ā€˜modelsā€™ did the job.

1reaction
moskomulecommented, Aug 23, 2021

Hi @datumbox, pytorch-nightly/linux-64::pytorch-1.10.0.dev20210822-py3.9_cuda11.1_cudnn8.0.5_0, the latest nightliy build as of today, causes no problem. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such operator image::read_file Ā· Issue #10 - GitHub
When i'm running camvid.py, This happened "No such operator image::read_file"ļ¼Œ Excuse me, why is this? Related error messagesļ¼š
Read more >
No such operator image::read_file - vision - PyTorch Forums
hello, When I ran main.py in PubMedCLIP with vision encoder ViT-B/32, something wrong: PubMedCLIP/PubMedCLIP at main Ā· sarahESL/PubMedCLIPĀ ...
Read more >
RuntimeError: No such operator image::read_file on Docker
Bug ... In a Docker environment, torch.io.read_file causes RuntimeError: No such operator image::read_file . To Reproduce. 1. Setup a container.
Read more >
č§£å†³RuntimeError: No such operator image::read_file
ęŽę²ēš„ē›®ę ‡ę£€ęµ‹å‡ŗēŽ°ēš„问题.
Read more >
PyTorch for Jetson - Jetson Nano - NVIDIA Developer Forums
RuntimeError : Unable to find a valid cuDNN algorithm to run convolution. in response to: ... RuntimeError: No such operator torchvision::nms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found