Groupdocs annotation facing issue with .NET assembly and dependencies for Python support

I am using groupdocs annotation trial version and have my .lic in my path. I am using this for a Python based application.

Error Log:
2025-09-30 20:26:49 - AppLog - INFO - Successfully loaded GroupDocs.Annotation .NET assembly.
2025-09-30 20:26:49 - AppLog - CRITICAL - Failed to initialize GroupDocs.Annotation for .NET.
Traceback (most recent call last):
File “C:\Users<user>\dev\tax-doc-fill-up\tax_doc_fill_up\main.py”, line 43, in initialize_groupdocs_dotnet
from GroupDocs.Annotation import License
ModuleNotFoundError: No module named ‘GroupDocs’
2025-09-30 20:26:49 - AppLog - CRITICAL - Application cannot start due to GroupDocs initialization failure. Exiting.

This is my code snippet:

def initialize_groupdocs_dotnet(app_config):
“”"
Finds, loads, and applies the license for the GroupDocs.Annotation .NET library.
“”"
try:
import clr
import sys

    # --- 1. Finding and adding the DLL path ---
    # Construct an absolute path to the DLL directory from the project root
    dll_path = os.path.join(project_root, "lib", "groupdocs.annotation", "lib", "net462")
    if not os.path.exists(dll_path):
        logger.critical(f"GroupDocs DLL directory not found at: {dll_path}")
        return False

    if dll_path not in sys.path:
        sys.path.append(dll_path)
    
    # --- 2. Loading the assembly ---
    clr.AddReference("GroupDocs.Annotation")
    logger.info("Successfully loaded GroupDocs.Annotation .NET assembly.")
    print(clr.AddReference("GroupDocs.Annotation"))
    print("**")
    # --- 3. Applying the license ---
    from GroupDocs.Annotation import License
    from GroupDocs.Annotation import Annotator
    from GroupDocs.Annotation.Models import Rectangle
    from GroupDocs.Annotation.Models.AnnotationTypes import TextFieldAnnotation, ImageAnnotation

    license_path = app_config.get('groupdocs_annotation', {}).get('license_path')
    print(license_path)
    print("*")
    if license_path and os.path.exists(license_path):
        lic = License()
        lic.SetLicense(license_path)
        logger.info(f"GroupDocs.Annotation license applied successfully from {license_path}.")
    else:
        logger.warning("GroupDocs license file not found. The library will run in evaluation mode.")

    return True
except Exception as e:
    logger.critical("Failed to initialize GroupDocs.Annotation for .NET.", exc_info=True)
    return False

Its from stage # — 3. Applying the license — I am facing issue with Imports. Seems like dependencies are not installed. I used the downloaded zip file - GroupDocs.Annotation for .NET 24.12 – Lightweight DLLs & Security Fixes and unzipped and can see the file in path -C:\Users<user>\dev\tax-doc-fill-up\lib\groupdocs.annotation\lib\net462\GroupDocs.Annotation.dll. Using 64 bit Python

@madhumitha.murali

It seems you’re encountering an issue with importing the GroupDocs.Annotation .NET assembly in your Python application. The error message indicates that the GroupDocs module cannot be found, which typically suggests that the assembly is not being loaded correctly.

Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Check the DLL Path: Ensure that the path to the GroupDocs.Annotation.dll is correct. You mentioned that the DLL is located at C:\Users\amadhum\dev\tax-doc-fill-up\lib\groupdocs.annotation\lib\net462\GroupDocs.Annotation.dll. Make sure this path is accessible and correctly referenced in your code.

  2. Verify .NET Framework Version: Ensure that your Python environment is compatible with the .NET Framework version that the GroupDocs.Annotation library targets. The library you are using is for .NET Framework 4.6.2, so confirm that your Python environment supports this version.

  3. Use the Correct Import Statement: The import statement should match the namespace defined in the DLL. Double-check the documentation or the assembly to confirm that from GroupDocs.Annotation import License is the correct way to import the License class.

  4. Install Dependencies: If there are any additional dependencies required by the GroupDocs.Annotation library, ensure they are also included in your project. Check the installation documentation for any specific requirements.

  5. Consider Using NuGet: If you haven’t already, consider using NuGet to install the GroupDocs.Annotation library. This can help manage dependencies more effectively. You can do this through Visual Studio or the .NET CLI.

If you continue to face issues, please provide more details about your environment, such as the version of Python you are using and any other relevant configurations.

Feel free to reach out if you have more questions!

using python3.11 version. Error happens as no module is found. from GroupDocs.Annotation import License
ModuleNotFoundError: No module named ‘GroupDocs’

Hi @madhumitha.murali !

Thank you for your interest in GroupDocs Annotation product.

We don’t currently ship a Python edition of GroupDocs.Annotation.
https://pypi.org/search/?q=groupdocs
We usually prepare special Python version of product via .NET
You can see similar packages like
https://pypi.org/project/groupdocs-comparison-net/

What you’re trying is an unsupported interop scenario (loading the .NET DLL from Python). It can work in some environments via pythonnet, but it’s not tested well.
However let’s pin down your environment and walk through the typical gotchas.

Can you please share the following points ?

  1. your OS and environment - is it under Win/Linux/Mac, version, x86/x64/arm ?

  2. .Net framework installed - I assume you are using .net standard version of GroupDocs.Annotation
    if version pythonnet (- pip show pythonnet) is 3.x

  3. Based on above - double check if correct .net version dll is referenced (net 462 framework or standard)

  4. How you load the DLL ?

Are you using
clr.AddReference("GroupDocs.Annotation")
or
clr.AddReferenceToFileAndPath(r"full\path\GroupDocs.Annotation.dll") ?

  • Please paste the exact console output of print(clr.AddReference(...)).
  1. Import failure details
  • After the “Successfully loaded” log line, the failure is ModuleNotFoundError: No module named 'GroupDocs'.
  • Please try import importlib; importlib.import_module("GroupDocs.Annotation") and share the exact error + traceback.
  • Also try import System; from System import AppDomain; print([a.GetName().Name for a in AppDomain.CurrentDomain.GetAssemblies()]) to verify the assembly is actually loaded.
  1. Lets share public repo over GitHub

We will be glad to help you with this case so for quick and easy fixes sharing - may I ask you to make a GitHub project with all settings and code (please without license file!) for we can support you more efficiently ?

  1. OS - Win, x64

  2. Yes, .NET Standard Version (GroupDocs.Annotation_24.12-NET.zip) for DLLs
    Name: pythonnet
    Version: 3.0.5
    Summary: .NET and Mono integration for Python
    Home-page: https://pythonnet.github.io/

  3. dll is referenced at (net 462)

  4. This is my code:
    dll_path = os.path.join(project_root, “lib”, “groupdocs.annotation”, “lib”, “net462”)
    if not os.path.exists(dll_path):
    logger.critical(f"GroupDocs DLL directory not found at: {dll_path}")
    return False
    if dll_path not in sys.path:
    sys.path.append(dll_path)
    # Loading the assembly
    clr.AddReference(“GroupDocs.Annotation”)
    I am using clr.AddReference(“GroupDocs.Annotation”)
    With print(clr.AddReference(“GroupDocs.Annotation”))
    Output:
    GroupDocs.Annotation, Version=24.12.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXX

  5. Tried import importlib; importlib.import_module("GroupDocs.Annotation")
    Traceback (most recent call last):
    File “C:\Users\amadhum\dev\tax-doc-fill-up\tax_doc_fill_up\main.py”, line 40, in initialize_groupdocs_dotnet
    importlib.import_module(“GroupDocs.Annotation”)
    File “C:\Users\amadhum\dev\dbconda-2023_09-py311-r36\envs\tax-doc-split-env\Lib\importlib_init_.py”, line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File “”, line 1206, in _gcd_import
    File “”, line 1178, in _find_and_load
    File “”, line 1128, in _find_and_load_unlocked
    File “”, line 241, in _call_with_frames_removed
    File “”, line 1206, in _gcd_import
    File “”, line 1178, in _find_and_load
    File “”, line 1142, in _find_and_load_unlocked
    ModuleNotFoundError: No module named ‘GroupDocs’

Tried import System; from System import AppDomain; print([a.GetName().Name for a in AppDomain.CurrentDomain.GetAssemblies()])
Output
[‘mscorlib’, ‘ClrLoader’, ‘Python.Runtime’, ‘netstandard’, ‘System.Core’, ‘System’, ‘System.Runtime.InteropServices.RuntimeInformation’, ‘System.Reflection.Emit’, ‘__Python_Runtime_Generated_Assembly0’, ‘System.Configuration’, ‘System.Xml’, ‘System.Numerics’, ‘GroupDocs.Annotation’, ‘System.ValueTuple’]
6. Not able to publish the repo - due to organisation violations- This is an attempt to check a POC, would want to go for licensed version if suitable.

@madhumitha.murali , thank you for the update!

While I will be discovering the issue

please try to refer for .net standard dll not the .net framework 462

1 Like

Alright, the error seems to be with the module -No module GroupDocs . Traceback (most recent call last):
File “C:\Users\amadhum\dev\tax-doc-fill-up\tax_doc_fill_up\main.py”, line 52, in initialize_groupdocs_dotnet
import GroupDocs
ModuleNotFoundError: No module named ‘GroupDocs’