Error - No module named 'sql_metadata'
Could not find app "erpnext": No module named 'sql_metadata'
Traceback (most recent call last): File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/caching.py", line 57, in wrapper return frappe.local.request_cache[func][args_key] KeyError: 5740354900026072187
During handling of the above exception, another exception occurred:
The error indicates that the Python module sql_metadata
is missing, which is a dependency required for your Frappe application to work correctly. This commonly happens when required dependencies are not installed properly. Follow these steps to resolve the issue:
Steps to Fix the Issue
1. Activate the Virtual Environment
Ensure you are working inside the virtual environment where Frappe is installed. Run the following command:
source /home/ubuntu/frappe-bench/env/bin/activate
2. Install the Missing Dependency
Install the sql_metadata
module using pip
:
pip install sql_metadata
3. Verify Installation
After installation, confirm that the module has been installed by running:
pip show sql_metadata
4. Restart Bench
Once the module is installed, restart your bench instance:
cd /home/ubuntu/frappe-bench
bench restart
5. Retry the Command
Run your bench migrate
or any other Frappe commands again to check if the issue is resolved:
bench migrate
If the Issue Persists
Reinstall All Dependencies
Reinstall all Python dependencies for your Frappe environment:bench setup requirements
Check for Missing Modules
If any other modules are missing, install them as shown above.Update the Frappe and ERPNext Apps
Ensure you are using the latest versions of Frappe and ERPNext. Update them if needed:bench update
Check Logs for Errors
If errors persist, check the logs for additional details:tail -f logs/bench.log
Let me know if you encounter any other issues!