UiPath Python Integration: “ImportError: No module named sqlite3” Despite Working requests Module
Problem Summary
I’m encountering a sqlite3 module import error when running Python scripts through UiPath, even though other modules like requests work fine.
Environment Details
- OS: Windows 11 (Build 10.0.26100)
- UiPath Version: 23.10.0+Branch.master.Sha.e038c5a32a4f890ba12a3c04ac465dc8811521e0
- Python Integration: UiPath Python Activities
Error Details
When executing a Python script in UiPath that requires sqlite3, I get the following complete error:
Source: Loading Python Script
Message: One or more errors occurred.(加载Python脚本时出错)
Exception Type: System.AggregateException 23.10.0+Branch.master.Sha.e038c5a32a4f890ba12a3c04ac465dc8811521e0
System.AggregateException: One or more errors occurred. (加载 Python 脚本时出错)
---> System.InvalidOperationException: 加载 Python 脚本时出错
---> System.InvalidOperationException: Python 实例化异常
Python Invoker program exception:
ImportError : No module named sqlite3
at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()
at UiPath.Python.Service.PythonProxy.LoadScript(String code)
at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass14_0.<LoadScript>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at UiPath.Python.Activities.LoadScript.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at UiPath.Python.Activities.LoadScript.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
--- End of stack trace from previous location ---
at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)
at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)
at UiPath.Core.Activities.ExecutorInvokeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
What Works
- Other Python modules like
requestsimport and work correctly - The Python environment seems to be properly configured for most operations
What I’ve Tried
- Verified that
sqlite3is typically included in Python standard library - Confirmed other modules work fine in the same UiPath environment
Questions
- Why would
sqlite3specifically be missing from UiPath’s Python environment when other modules work? - How can I resolve this
sqlite3import issue in UiPath? - Is this a known compatibility issue with UiPath’s Python integration?
Minimal Example
The error occurs when trying to run any Python code that imports sqlite3:
import sqlite3 # This line causes the ImportError in UiPath
While this works fine:
import requests # This works without issues in UiPath
Outside of UiPath (in normal Anaconda Python 3.8 environment):
import sqlite3
print(sqlite3.version) # This works perfectly fine
Any help would be greatly appreciated!