DistributionNotFound Error when bench restart

hello, i am getting below error when doing bench restart

pkg_resources.DistributionNotFound: The 'Jinja2~=2.11.3' distribution was not found and is required by frappe-bench


/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.18ubuntu0.18.04.1 is an invalid version and will not be supported in a future release
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 573, in _build_master
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 782, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Jinja2 3.0.3 (/home/frappe/.local/lib/python3.6/site-packages), Requirement.parse('Jinja2~=2.11.3'), {'frappe-bench'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 33, in <module>
    sys.exit(load_entry_point('frappe-bench', 'console_scripts', 'bench')())
  File "/usr/local/bin/bench", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/frappe/.bench/bench/cli.py", line 13, in <module>
    from bench.app import get_apps
  File "/home/frappe/.bench/bench/app.py", line 12, in <module>
    from setuptools.config import read_configuration
  File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 17, in <module>
    import setuptools.version
  File "/usr/local/lib/python3.6/dist-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3256, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3231, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3269, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 575, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 588, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Jinja2~=2.11.3' distribution was not found and is required by frappe-bench


It may help to say the operating environment, and version of frappe-bench. The message suggests that jinja2 is not installed or cannot be found. Does pip3 list show it is installed?

yes, its showing in pip3 list
Jinja2 3.0.3

The error message mentions Jinja2~=2.11.3 and pip is reporting version 3.0.3. It may be possible to uninstall the 3.0.3 and use pip to install 2.11.3 , however that may or may not help. It appears the frappe installation is using python3.6 , which is out of date so there may be need to do some updating overall depending on the apps that are being used.