Email - Error: cannot import name 'HeaderWriteError'

Not able tio access email related documents getting error as below.
ImportError: Module import failed for Email Account, the DocType you’re trying to open might be deleted.
Error: cannot import name ‘HeaderWriteError’ from ‘email.errors’ (/usr/lib/python3.10/email/errors.py)

(anonymous) @ request.js:457

Started getting this error from today suddenly.

@shreelaxmi run this command
bench setup requirements --python
bench build
bench migrate
bench restart

2 Likes

I am getting error on running 1st command

Installing paras
$ /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/apps/paras
error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Traceback (most recent call last):
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 353, in
main()
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 335, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 132, in get_requires_for_build_editable
return hook(config_settings)
File “/tmp/pip-build-env-84l20zvi/overlay/lib/python3.10/site-packages/setuptools/build_meta.py”, line 464, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
File “/tmp/pip-build-env-84l20zvi/overlay/lib/python3.10/site-packages/setuptools/build_meta.py”, line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=)
File “/tmp/pip-build-env-84l20zvi/overlay/lib/python3.10/site-packages/setuptools/build_meta.py”, line 302, in _get_build_requires
self.run_setup()
File “/tmp/pip-build-env-84l20zvi/overlay/lib/python3.10/site-packages/setuptools/build_meta.py”, line 503, in run_setup
super().run_setup(setup_script=setup_script)
File “/tmp/pip-build-env-84l20zvi/overlay/lib/python3.10/site-packages/setuptools/build_meta.py”, line 318, in run_setup
exec(code, locals())
File “”, line 3, in
ModuleNotFoundError: No module named ‘pip’
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/apps/paras
subprocess.CalledProcessError: Command '/home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/apps/paras ’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/bin/bench”, line 8, in
sys.exit(cli())
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/cli.py”, line 132, in cli
bench_command()
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/commands/setup.py”, line 230, in setup_requirements
bench.setup.requirements(apps=apps)
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/bench.py”, line 466, in requirements
app = App(path_to_app, bench=self.bench, to_clone=False).install(
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/app.py”, line 254, in install
install_app(
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/app.py”, line 909, in install_app
bench.run(
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/bench.py”, line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
File “/home/devuser/webapps/mooflowuatnew.smartmoo.com/venv/lib/python3.10/site-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/devuser/webapps/mooflowuatnew.smartmoo.com/frappe-bench/apps/paras

Below command worked for me. Thanks.

supervisorctl stop all
supervisorctl start all
1 Like

Please refer to:

1 Like