Creating Python virtualenv fails with error: Could not find a suitable TLS CA

You can create Python virtualenv using command:

virtualenv -p /usr/bin/python3 py-env3

You may encounter following strange error:

  Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels
...
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt
...
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
    os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_virtualenv.1000.crash'

The error message is not very clear. Problem is caused by ca-certificates and it could be fixed by command:

sudo update-ca-certificates