pythongoogle-colaboratoryissue-trackingwand

python colab issue with wand library


greetings ---

hey gues , I have an a problem with google.colab when I want to run this code :

     # Import Image from wand.image module
from wand.image import Image

# Read image using Image() function
with Image(filename ="/content/Hand.jpeg") as img:

    # Generate noise image using spread() function
    img.noise("poisson", attenuate = 0.9)
    img.save(filename ="noise_hand.jpeg")

the issue is with this command :

from wand.image import Image

it keep saying :

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-c8294d82387e> in <module>()
      1 # Import Image from wand.image module
----> 2 from wand.image import Image

this issue only appears in colab, I mean, for example, it works fine with Microsoft visual studio.

pls guess someone help me to fix this problem, and thanks in advance

note: I already installed and imported the wand library


Solution

  • Try installing ImageMagick by running these in a cell before your code.

    !sudo apt install imagemagick
    !pip install wand