Cancel addon registering I am developing an add-on, which only works if some specific conditions are satisfied (e.g. some other add-on is installed). Hence, I want the user to be unable to register this add-on if the conditions are not satisfied.
I thought I can ensure the conditions during the register() function. If the conditions are not satisfied, I want Blender to cancel the add-on registering, while displaying a message, saying what the user has to do.
I figured out how to display the message following https://blender.stackexchange.com/a/118183/117198
def display_error(message):
    display_text = lambda self, context: self.layout.label(text = message)
    bpy.context.window_manager.popup_menu(display_text, title='Error', icon='ERROR')

However, I don't know how to properly cancel the add-on registering. I figured that raising an error would cancel registering, but it displays the traceback, which is not user-friendly.
def register():
    if not my_conditions:
        raise Exception(&quot;The conditions were not met.&quot;)
    else:
        # Continue register

Traceback (most recent call last):
  File &quot;C:\Program Files\Blender Foundation\Blender 2.90\2.90\scripts\modules\addon_utils.py&quot;, line 382, in enable
    mod.register()
  File &quot;C:\Users\VirtualUser\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\my_addon.py&quot;, line 116, in register
    raise Exception(&quot;The conditions were not met.&quot;)
Exception: The conditions were not met.

Is there a proper way to cancel add-on registering? Alternatively, is there a way to hide the traceback?
Some alternatives.
I am not sure what you ask is possible without some serious dicking around.
If these are bundled addons can simply enable and disable them as required in your code https://blender.stackexchange.com/a/58208/15543  In that you can enable an addon  when required  eg https://blender.stackexchange.com/a/189435/15543
Use a different Preferences if missing dependencies.

As it happens, am currently writing an addon prefs class to display any missing import dependencies.
Here is a &quot;fudge-together&quot; to show the warning message and suggest that the user investigate the addon on prefs.  The addon checks if the cell fracture addon is present and enabled, if present but not enabled puts a button in prefs to enable it.
Could add a big &quot;Retry&quot; button to check again.
bl_info = {
    &quot;name&quot;: &quot;Test Deps&quot;,
    &quot;author&quot;: &quot;Your Name Here&quot;,
    &quot;version&quot;: (1, 0),
    &quot;blender&quot;: (2, 80, 0),
    &quot;location&quot;: &quot;View3D &gt; Add &gt; Mesh &gt; New Object&quot;,
    &quot;description&quot;: &quot;Adds a new Mesh Object&quot;,
    &quot;warning&quot;: &quot;&quot;,
    &quot;doc_url&quot;: &quot;&quot;,
    &quot;category&quot;: &quot;Add Mesh&quot;,
}

import bpy
import addon_utils
from bpy.types import AddonPreferences

deps = [&quot;object_fracture_cell&quot;]   

class AddonDepsPrefs(AddonPreferences):
    bl_idname = __name__
    bl_label = &quot;Missing Deps&quot;
    def draw(self, context):
        layout = self.layout
        layout.label(text=&quot;Errors Registerning&quot;)
        fake_mods = addon_utils.addons_fake_modules
        for dep in deps:
            if dep in fake_mods:
                if not addon_utils.check(dep)[1]:
                    op = layout.operator(&quot;preferences.addon_enable&quot;)
                    op.module = dep                 

def register():

    fake_modules = addon_utils.fake_modules
    all_exist = all((dep in fake_modules) for dep in deps)
    all_enabled = all(addon_utils.check(dep)[1] for dep in deps)
    satisfied = all_exist and all_enabled
    if not satisfied:
        bpy.utils.register_class(AddonDepsPrefs)
        #unregister()    
        def display_error(message):
            display_text = lambda self, context: self.layout.label(text = message)
            bpy.context.window_manager.popup_menu(display_text, title='Error', icon='ERROR')
        display_error(&quot;Expand Addon Prefs for Details&quot;)
        

def unregister():
    if AddonDepsPrefs.is_registered:
        bpy.utils.unregister_class(AddonDepsPrefs)



if __name__ == &quot;__main__&quot;:
    register()