Read_image doesn't work in pytroch 2.0 on google colab

username: gozdi
cooked: <p>Hi</p>
<p>I installed torch 2.0 on google colab using this comand<br>
<code>!pip3 install numpy --pre torch[dynamo] --force-reinstall --extra-index-url https://download.pytorch.org/whl/nightly/cu117</code></p>
<p>and now <code>torchvision.io.read_image </code> doesn’t work. I get this warning when I’m importing it</p>
<p><code>/usr/local/lib/python3.9/dist-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory   warn(f"Failed to load image Python extension: {e}")</code></p>
<p>and this error when I try to load an image</p>
<pre><code class="lang-auto">RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.9/dist-packages/torch/_ops.py in __getattr__(self, op_name)
    704         try:
--&gt; 705             op, overload_names = torch._C._jit_get_operation(qualified_op_name)
    706         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)
3 frames
&lt;ipython-input-4-47407919c77a&gt; in &lt;module&gt;
----&gt; 1 image = read_image('/content/SSIW_single_node/Test_Minist/test_imgs/img1.png')

/usr/local/lib/python3.9/dist-packages/torchvision/io/image.py in read_image(path, mode)
    251     if not torch.jit.is_scripting() and not torch.jit.is_tracing():
    252         _log_api_usage_once(read_image)
--&gt; 253     data = read_file(path)
    254     return decode_image(data, mode)
    255 

/usr/local/lib/python3.9/dist-packages/torchvision/io/image.py in read_file(path)
     45     if not torch.jit.is_scripting() and not torch.jit.is_tracing():
     46         _log_api_usage_once(read_file)
---&gt; 47     data = torch.ops.image.read_file(path)
     48     return data
     49 

/usr/local/lib/python3.9/dist-packages/torch/_ops.py in __getattr__(self, op_name)
    707             # Turn this into AttributeError so getattr(obj, key, default)
    708             # works (this is called by TorchScript with __origin__)
--&gt; 709             raise AttributeError(
    710                 f"'_OpNamespace' '{self.name}' object has no attribute '{op_name}'"
    711             ) from e

AttributeError: '_OpNamespace' 'image' object has no attribute 'read_file'
</code></pre>

username: ptrblck
cooked: <aside class="quote no-group" data-username="gozdi" data-post="1" data-topic="175809">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/gozdi/48/57646_2.png" class="avatar"> gozdi:</div>
<blockquote>
<p>I installed torch 2.0 on google colab using this comand<br>
<code>!pip3 install numpy --pre torch[dynamo] --force-reinstall --extra-index-url https://download.pytorch.org/whl/nightly/cu117</code></p>
</blockquote>
</aside>
<p>This would install the nightly release of PyTorch, not <code>2.0.0</code>, and might also not install <code>torchvision</code> unless it’s detected as a conflicting package.<br>
I don’t know if the pip wheels ever supported custom <code>torchvision.io</code> backends or if source builds are needed so do you know if these ops were available in previous versions?</p>