ModuleNotFoundError: No module named 'pycountry'

This error is appearing on the submission of the invoice. Anyone facing the same?

Traceback (most recent call last):
File “/opt/erpnext/erpnext/apps/frappe/frappe/app.py”, line 64, in application
response = frappe.api.handle()
File “/opt/erpnext/erpnext/apps/frappe/frappe/api.py”, line 58, in handle
return frappe.handler.handle()
File “/opt/erpnext/erpnext/apps/frappe/frappe/handler.py”, line 30, in handle
data = execute_cmd(cmd)
File “/opt/erpnext/erpnext/apps/frappe/frappe/handler.py”, line 69, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/opt/erpnext/erpnext/apps/frappe/frappe/init.py”, line 1085, in call
return fn(*args, **newargs)
File “/opt/erpnext/erpnext/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 890, in submit
self._submit()
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 879, in _submit
self.save()
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 281, in save
return self._save(*args, **kwargs)
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 316, in _save
self.run_before_save_methods()
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 923, in run_before_save_methods
self.run_method(“validate”)
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 820, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/opt/erpnext/erpnext/apps/frappe/frappe/model/document.py”, line 1109, in composer
hooks.append(frappe.get_attr(handler))
File “/opt/erpnext/erpnext/apps/frappe/frappe/init.py”, line 1076, in get_attr
return getattr(get_module(modulename), methodname)
File “/opt/erpnext/erpnext/apps/frappe/frappe/init.py”, line 853, in get_module
return importlib.import_module(modulename)
File “/opt/erpnext/erpnext/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/opt/erpnext/erpnext/apps/erpnext/erpnext/erpnext_integrations/taxjar_integration.py”, line 3, in
import pycountry
ModuleNotFoundError: No module named ‘pycountry’

I already pip install pycountry and pip3 install pycountry

Can you try running:

bench setup requirements and see if that works

If that doesn’t work, maybe:

bench pip install -r ./apps/erpnext/requirements.txt

or even

bench pip install pycountry?

2 Likes