No such operator image::read_file

S200331082: <p>hello, When I ran <code>main.py</code> in <code>PubMedCLIP</code> with <code>vision encoder ViT-B/32</code>, something wrong:<br>
<a href="https://github.com/sarahESL/PubMedCLIP/tree/main/PubMedCLIP" rel="noopener nofollow ugc">PubMedCLIP/PubMedCLIP at main · sarahESL/PubMedCLIP (github.com)</a></p>
<pre><code class="lang-auto">-------Loading CLIP with vision encoder ViT-B/32 -------
-------Training started-------
Traceback (most recent call last):
  File "C:/Users/fhdu/PycharmProjects/PubMedCLIP/main/main.py", line 51, in &lt;module&gt;
    train(cfg, train_loader, val_loader, device)
  File "C:\Users\fhdu\PycharmProjects\PubMedCLIP\main\train.py", line 65, in train
    for i, (image, caption) in enumerate(train_loader):
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torch\utils\data\dataloader.py", line 521, in __next__
    data = self._next_data()
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in &lt;listcomp&gt;
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\fhdu\PycharmProjects\PubMedCLIP\lib\dataset\ROCOdataset.py", line 80, in __getitem__
    **image = self._load_image(index)**
  File "C:\Users\fhdu\PycharmProjects\PubMedCLIP\lib\dataset\ROCOdataset.py", line 70, in _load_image
    **image = read_image(path, mode=ImageReadMode.RGB)**
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torchvision\io\image.py", line 222, in read_image
    data = read_file(path)
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\site-packages\torchvision\io\image.py", line 42, in read_file
    data = torch.ops.image.read_file(path)
  File "E:\SoftwareFile\Anaconda3\envs\med_vqa\lib\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
</code></pre>
<p>Not sure the wrong version of torch leads to this issue? my version:<br>
torch 1.10.0 , torchvision 0.11.1</p>
<p>Looking forward to your answer, thanks in advance.</p>

tom: <p>TorchVision depends on C+±implemented modules to provide JITed operations. Apparently, this has not been/canbot be loaded.<br>
Do you get a warning about that?</p>
<p>Best regards</p>
<p>Thomas</p>

S200331082: <p>thanks for your reply, I did not get such a warning you mentioned. To be honestly, I hadn’t even heard of JITed.</p>

S200331082: <p>bro，你解决了吗，是因为版本的问题吗，为什么又删了 <img src="https://discuss.pytorch.org/images/emoji/apple/joy.png?v=12" title=":joy:" class="emoji" alt=":joy:" loading="lazy" width="20" height="20"></p>

wadewang: <p>Yesterday I met this error when running <a href="https://pytorch.org/vision/main/auto_examples/plot_scripted_tensor_transforms.html#sphx-glr-auto-examples-plot-scripted-tensor-transforms-py" class="inline-onebox" rel="noopener nofollow ugc">Tensor transforms and JIT — Torchvision main documentation</a>, that time is midnight, so I decide to retry it tomorrow. Because I doubt I mixed two versions of pytorch, today I uninstall pytorch(by <code>pip uninstall pytorch</code> and <code>conda uninstall pytorch</code>) and reintall it(by <code>pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html</code>), this error disappear… Now my env infos are:</p>
<pre><code class="lang-auto">C:\WINDOWS\system32&gt;python -m torch.utils.collect_env
Collecting environment information...
PyTorch version: 1.10.1+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 专业工作站版
GCC version: (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 7.3.0
Clang version: Could not collect
CMake version: version 3.22.2
Libc version: N/A

Python version: 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19041-SP0
Is CUDA available: True
CUDA runtime version: 10.2.89
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 SUPER
Nvidia driver version: 511.23
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\cudnn_ops_train64_8.dll
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] Minetorch==0.6.17
[pip3] numpy==1.19.5
[pip3] pytorch-lightning==1.5.5
[pip3] torch==1.10.1+cu102
[pip3] torch-model-archiver==0.4.2b20211023
[pip3] torch-workflow-archiver==0.1.2b20211023
[pip3] torchaudio==0.10.1+cu113
[pip3] torchcam==0.2.0
[pip3] torchfile==0.1.0
[pip3] torchinfo==1.5.4
[pip3] torchmetrics==0.6.1
[pip3] torchserve==0.4.2
[pip3] torchsummary==1.5.1
[pip3] torchtext==0.10.0
[pip3] torchvision==0.11.2+cu102
[pip3] torchviz==0.0.2
[pip3] vit-pytorch==0.23.2
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               10.2.89              h74a9793_1
[conda] minetorch                 0.6.17                   pypi_0    pypi
[conda] mkl                       2021.4.0           haa95532_640
[conda] mkl-service               2.4.0            py38h2bbff1b_0
[conda] mkl_fft                   1.3.1            py38h277e83a_0
[conda] mkl_random                1.2.2            py38hf11a4ad_0
[conda] numpy                     1.21.3                   pypi_0    pypi
[conda] numpy-base                1.21.5           py38hc2deb75_0
[conda] pytorch-lightning         1.5.5                    pypi_0    pypi
[conda] tensorflow                2.3.0           mkl_py38h8557ec7_0
[conda] torch                     1.10.1+cu102             pypi_0    pypi
[conda] torch-model-archiver      0.4.2b20211023           pypi_0    pypi
[conda] torch-workflow-archiver   0.1.2b20211023           pypi_0    pypi
[conda] torchaudio                0.10.1+cu113             pypi_0    pypi
[conda] torchcam                  0.2.0                    pypi_0    pypi
[conda] torchfile                 0.1.0                    pypi_0    pypi
[conda] torchinfo                 1.5.4                    pypi_0    pypi
[conda] torchmetrics              0.6.1                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.11.2+cu102             pypi_0    pypi
[conda] torchviz                  0.0.2                    pypi_0    pypi
[conda] vit-pytorch               0.23.2                   pypi_0    pypi
</code></pre>
<p>the torchvision upgrade from <code>torchvision==0.10.0+cu102</code> to <code>torchvision==0.11.2+cu102</code>, I am not sure it is the issue of low version of torchvision or the issue of mixing two versions of pytorch</p>

S200331082: <p>thx, I will try soon</p>

wchen61: <p>I just had this problem too, after some inverstigation, I found install jpeg can solve my problem.</p>
<p>For ubuntu: apt-get install libjepg-dev</p>

itorch: <aside class="quote no-group" data-username="wadewang" data-post="6" data-topic="148303">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/w/85f322/48.png" class="avatar"> wadewang:</div>
<blockquote>
<p>conda uninstall pytorch</p>
</blockquote>
</aside>
<p>I am relatively new to google colab. How do you uninstall PyTorch from colab. I am facing a similar error (starting today, it was fine until yesterday!) while running my NN implementation on colab. To be exact here is the error message:</p>
<pre><code class="lang-auto">RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/torch/_ops.py in __getattr__(self, op_name)
    197         try:
--&gt; 198             op, overload_names = torch._C._jit_get_operation(qualified_op_name)
    199         except RuntimeError as e:

RuntimeError: No such operator image::read_file

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
</code></pre>
<p>It seems the origin is an object called ‘_OpNamespace’ which apparently does not have the read_file attribute.</p>