diff --git a/nomad/datamodel/datamodel.py b/nomad/datamodel/datamodel.py
index b5a48f2204c1dd1b4fda21e3a9e5e5328c43ead5..2fa0098b4bf0c472d19cd80f2e938cca2dd8dc2c 100644
--- a/nomad/datamodel/datamodel.py
+++ b/nomad/datamodel/datamodel.py
@@ -76,7 +76,10 @@ logger = utils.get_logger(__name__)
 
 
 def _check_mongo_connection():
-    from nomad.infrastructure import mongo_client
+    try:
+        from nomad.infrastructure import mongo_client
+    except ImportError | ModuleNotFoundError:
+        return
 
     global has_mongo
     if has_mongo or mongo_client is None: