Getting errors while upgrading v12 to v13 beta

when i was trying to upgrade from v12 to v13 beta, i got some errors. Please help to resolve the issue:-

Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 568, in _build_master
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 886, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 777, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (setuptools 54.1.1 (/usr/local/lib/python3.8/dist-packages), Requirement.parse(‘setuptools==40.8.0’), {‘bench’})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 6, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 3243, in
def _initialize_master_working_set():
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 3226, in _call_aside
f(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 570, in _build_master
return cls._build_from_requirements(requires)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 583, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/”, line 772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘setuptools==40.8.0’ distribution was not found and is required by benc


May we know the operating environment that frappe/bench/ERPNext is installed on?

Could please check those steps for upgrade?

Sorry, did not get your point.

Sir, I have already used these commands, but now, when I am using any command like bench update, I got the errors as mentioned above.

The error message suggests there is a version problem with setuptools. You may need to upgrade or install it. If you could tell us what operating system is hosting your ERPNext we may be able to help with commands needed to fix the problem.

We are using ubuntu 20.04.

Refer , @sachin1

try : sudo apt install python3-setuptools

It did not work for me. Please suggest any other solution.

What does : apt-cache policy python3-setuptools return?

bench@erpnext:~/frappe-bench$ sudo apt-cache policy python3-setuptools
[sudo] password for bench:
Installed: 45.2.0-1
Candidate: 45.2.0-1
Version table:
*** 45.2.0-1 500
500 Index of /ubuntu focal/main amd64 Packages
500 Index of /ubuntu focal/main i386 Packages
100 /var/lib/dpkg/status

The error message says The ‘setuptools==40.8.0’ distribution was not found and is required by benc, and the distro seems to have version 45.2.0-1. It seems odd that others have not run across the same problem. May we know the command that was used that produced the message?

Not any specific command, but when i use bench restart or bench update, this error occurs.