GitLab CI virtualenv creation problem

When deploying using GitLab CI, if I proceed with virtualenv venv in the before_script of gitlab-ci.yml, the job fails with the following error.

FileNotFoundError: [Errno 2] No such file or directory: '/builds/<proj_name>/server/venv/lib/python3.9/site-packages/pip/./'

The docker image uses python:3.9, and the virtualenv installation proceeds with the following script.

pip install virtualenv

If I install virtualenv version 20.0.1, I don’t get that error.

My guess is that the problem is caused by an incorrect reference to pip/./ in this part of python3.9/site-packages/pip/./

What could be the cause?