[Fixed] No Module Named imwatermark

You might have thought of using the imwatermark module to watermark your images. However, you may have encountered a no module named imwatermark error while using this module. Go through this blog to interpret the correct usage of Python’s imwatermark module.


In case you want a simple and easy-to-use API to watermark images in Python, you are in the correct spot. The imwatermark module is used to embed and extract such images. It is open source. Apart from this, it’s free to use. It helps to curate two different types of watermarks: text-based and image-based.

Syntax and Working of imwatermark

The given piece of code demonstrates the correct method to use the imwatermark module. First, you need to install the module and then load the image. Create the watermark, and lastly, watermark the image. You can save the newly generated image too.

pip install imwatermark
import imwatermark

# Load the image to be watermarked
image = imwatermark.imread("image.png")

# Create the watermark
watermark = imwatermark.Watermark("Watermark text")

# Watermark the image
watermarked_image = imwatermark.watermark(image, watermark)

# Save the watermarked image
imwatermark.imwrite(watermarked_image, "watermarked_image.png")

Reasons for the missing module

You may get no module named imwatermark error due to a couple of reasons. Some of these are:

  • Installing the module incorrectly
  • The path of the module is different from the one the interpreter is currently placed in.
  • The module might have been installed in a virtual environment that is not active.

Fixing the error

The following methods will definitely help you in resolving the no module named imwatermark error.

Installing the module

You need to delete all the current dependencies of the module along with the module itself. Now, install it with the help of the pip command. Its syntax is:

pip install imwatermark

Update the path of the imwatermark module

Check environment variables, and copy and paste the path where the module has been installed. Now, edit the environment variables, remove the older path, and add the newly copied one. This step basically implies the updation of the module path.

First, check the path using the sys module

import sys

Then update it using the append function:

import sys

Activating the virtual environment

The given command will help you in activating the virtual environment.

python -m venv my_virtual_environment

After activating the virtual environment, you need to install the imwatermark module using the pip command.

pip install imwatermark

Once the image watermarking has been accomplished, you may deactivate the environment.


Fixing the error in Anaconda

To fix this error in Anaconda, first, install the imwatermark module in this environment.

conda install -c conda-forge imwatermark

As the next step, you need to activate this environment. Make sure to check the location where you have installed the environment.

conda activate environmentname

Thirdly, you need to assess the Python paths.

python -m site

In case the directory doesn’t match, you need to export the path.

export PYTHONPATH=$PYTHONPATH:/path/to/imwatermark/package

Fixing the error in stable diffusion

To resolve this error, first, you need to install this library.

pip install imwatermark

As a next step, you need to provide the path.

export PYTHONPATH=$PYTHONPATH:$PWD/imwatermark

Lastly, you have to restart the stable diffusion package. Just make sure that the package is updated.

Fixing the error in pycharm

First place, you need to install the imwatermark module. Secondly, you need to press Ctrl+Alt+S on Windows to access the PyCharm dialog box. Select the + button and add the imwatermark module. Once this is done, you just need to restart pycharm for correct loading.

Some Tips to Consider

You can also consider a few points if the aforementioned ones don’t work.

  • imwatermark module may not work with old versions of Python. Hence, it’s better to update.
  • Check the version of pip also.
  • Use alternative modules like watermark and pymarkov
  • Use Python to write your own code for image watermarkings.
  • Check for syntactical errors while installing the imwatermark module.

Alternative usage of imwatermark module

In case the no module named imwatermark problem still persists, you can go for two other modules provided by Python for the purpose of image watermarking. These are the watermark module and the invisible watermark module.

watermark module

You can use the watermark module to watermark the images.

pip install watermark
import watermark

# Watermark the image
watermarked_image = watermark.apply_watermark(image, "watermark.png")

# Save the watermarked image

invisible-watermark module

invisible-watermark module also helps to create watermarked images.

pip install invisible-watermark
import invisible_watermark

# Watermark the image
watermarked_image = invisible_watermark.watermark(image, "watermark")

# Save the watermarked image


What are some alternative Python modules that can be used to watermark images?

Pillow, OpenCV, and Watermark are libraries that can also be used to watermark the images using Python.

Can you create text-based watermarks with the imwatermark module?

Yes, it is possible to create text-based watermarks with the imwatermark module.


In case you want to watermark images, you may have stumbled upon the no module named imwatermark error. This article covers an in-depth analysis of this error. It discusses how you can fix the error and some additional tips to get rid of the error. It also has some alternative modules which can be used instead of the imwatermark module.

Notify of
Inline Feedbacks
View all comments