Upgrading python to python3 gives error

I am using frappe with virtualbox production.ova file.

So, after following standard steps to update frappe, I found that while upgrading python using following command it gives error.

bench migrate-env python3

Gives error:

DEBUG:bench.commands:Clearing Redis Cache…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHDB
OK
DEBUG:bench.commands:Backing up Virtual Environment
DEBUG:bench.commands:Setting up a New Virtual python3 Environment
INFO:bench.utils:/usr/local/bin/virtualenv --python /usr/bin/python3 /home/frappe/frappe-bench/env
Running virtualenv with interpreter /usr/bin/python3
Using base prefix ‘/usr’
New python executable in /home/frappe/frappe-bench/env/bin/python3
Also creating executable in /home/frappe/frappe-bench/env/bin/python
Installing setuptools, pip, wheel…

Complete output from command /home/frappe/frappe-bench/env/bin/python3 - setuptools pip wheel:
Looking in links: /usr/local/lib/python2.7/dist-packages/virtualenv_support
Collecting setuptools
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),)’: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),)’: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),)’: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),)’: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),)’: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)’),))


…Installing setuptools, pip, wheel…done.
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 2567, in
main()
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 793, in main
symlink=options.symlink,
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 1088, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 935, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 1025, in _install_wheel_with_search_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 886, in call_subprocess
raise OSError(“Command {} failed with error code {}”.format(cmd_desc, proc.returncode))
OSError: Command /home/frappe/frappe-bench/env/bin/python3 - setuptools pip wheel failed with error code 1
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/init.py”, line 159, in migrate_env
), cwd = path)
File “/home/frappe/.bench/bench/utils.py”, line 159, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: /usr/local/bin/virtualenv --python /usr/bin/python3 /home/frappe/frappe-bench/env

Then, run following command.

sudo pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org

Then, it shows following…

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory ‘/home/frappe/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/frappe/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (19.0.3)
frappe@ubuntu:~/frappe-bench$ sudo -H pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (19.0.3)

… issue if python not getting upgraded.

What steps are still missing?