"bad interpreter: No such file or directory" when using the "mkdocs" command inside virtualenv

Problem

After installing Mkdocs and other dependencies on virtualenv, when the CI is about to run mkdocs -v, an error occurred with context /bin/bash: /builds/MadeByThePinsHub/handbook/venv/bin/mkdocs: /builds/MadeByThePinsTeam-DevLabs/official-handbook/venv/bin/python: bad interpreter: No such file or directory, making the site build to fail.

# From the GitLab CI Docker+Machine point-of-view
# Setting up virtualenv and install deps inside that env.
$ pip install virtualenv
Collecting virtualenv
  Using cached virtualenv-20.0.30-py2.py3-none-any.whl (7.1 MB)
Collecting appdirs<2,>=1.4.3
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting distlib<1,>=0.3.1
  Using cached distlib-0.3.1-py2.py3-none-any.whl (335 kB)
Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
  Using cached importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB)
Collecting filelock<4,>=3.0.0
  Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting six<2,>=1.9.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting zipp>=0.5
  Using cached zipp-3.1.0-py3-none-any.whl (4.9 kB)
Installing collected packages: appdirs, distlib, zipp, importlib-metadata, filelock, six, virtualenv
Successfully installed appdirs-1.4.4 distlib-0.3.1 filelock-3.0.12 importlib-metadata-1.7.0 six-1.15.0 virtualenv-20.0.30 zipp-3.1.0
$ virtualenv venv
created virtual environment CPython3.7.8.final.0-64 in 1084ms
  creator CPython3Posix(dest=/builds/MadeByThePinsHub/handbook/venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: Babel==2.8.0, GitPython==3.1.7, Jinja2==2.11.2, Markdown==3.2.2, MarkupSafe==1.1.1, PyYAML==5.3.1, Pygments==2.6.1, beautifulsoup4==4.9.1, certifi==2020.6.20, chardet==3.0.4, click==7.1.2, future==0.18.2, gitdb==4.0.5, htmlmin==0.1.12, idna==2.10, importlib_metadata==1.7.0, joblib==0.16.0, jsmin==2.2.2, livereload==2.6.2, lunr==0.5.8, mkdocs==1.1.2, mkdocs_git_revision_date_localized_plugin==0.7, mkdocs_material==5.5.3, mkdocs_material_extensions==1.0, mkdocs_minify_plugin==0.3.0, nltk==3.5, pep562==1.0, pip==20.2.1, pyembed==1.3.3, pyembed_markdown==1.1.0, pymdown_extensions==7.1, pytz==2020.1, regex==2020.7.14, requests==2.24.0, setuptools==49.2.1, six==1.15.0, smmap==3.0.4, soupsieve==2.0.1, tornado==6.0.4, tqdm==4.48.2, urllib3==1.25.10, wheel==0.34.2, zipp==3.1.0
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
$ source venv/bin/activate
$ pip install -r requirements.txt
Requirement already satisfied: Babel in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (2.8.0)
Requirement already satisfied: beautifulsoup4 in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (4.9.1)
Requirement already satisfied: certifi in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 5)) (2020.6.20)
Requirement already satisfied: chardet in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 6)) (3.0.4)
Requirement already satisfied: click in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 7)) (7.1.2)
Requirement already satisfied: future in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 8)) (0.18.2)
Requirement already satisfied: gitdb in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 9)) (4.0.5)
Requirement already satisfied: GitPython in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 10)) (3.1.7)
Requirement already satisfied: htmlmin in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 11)) (0.1.12)
Requirement already satisfied: idna in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 12)) (2.10)
Requirement already satisfied: Jinja2 in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 13)) (2.11.2)
Requirement already satisfied: joblib in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 14)) (0.16.0)
Requirement already satisfied: jsmin in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 15)) (2.2.2)
Requirement already satisfied: livereload in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 16)) (2.6.2)
Requirement already satisfied: lunr in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 17)) (0.5.8)
Requirement already satisfied: Markdown in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 18)) (3.2.2)
Requirement already satisfied: MarkupSafe in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 19)) (1.1.1)
Requirement already satisfied: mkdocs in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 20)) (1.1.2)
Requirement already satisfied: mkdocs-material in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 21)) (5.5.3)
Requirement already satisfied: mkdocs-material-extensions in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 22)) (1.0)
Requirement already satisfied: mkdocs-minify-plugin in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 23)) (0.3.0)
Collecting mkdocs-redirects
  Downloading mkdocs-redirects-1.0.1.tar.gz (4.8 kB)
Requirement already satisfied: nltk in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 25)) (3.5)
Requirement already satisfied: pep562 in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 26)) (1.0)
Requirement already satisfied: pyembed in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 27)) (1.3.3)
Requirement already satisfied: pyembed-markdown in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 28)) (1.1.0)
Requirement already satisfied: Pygments in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 29)) (2.6.1)
Requirement already satisfied: pymdown-extensions in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 30)) (7.1)
Requirement already satisfied: pytz in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 31)) (2020.1)
Requirement already satisfied: PyYAML in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 32)) (5.3.1)
Requirement already satisfied: regex in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 33)) (2020.7.14)
Requirement already satisfied: requests in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 34)) (2.24.0)
Requirement already satisfied: six in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 35)) (1.15.0)
Requirement already satisfied: smmap in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 36)) (3.0.4)
Requirement already satisfied: soupsieve in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 37)) (2.0.1)
Requirement already satisfied: tornado in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 38)) (6.0.4)
Requirement already satisfied: tqdm in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 39)) (4.48.2)
Requirement already satisfied: urllib3 in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 40)) (1.25.10)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./venv/lib/python3.7/site-packages (from Markdown->-r requirements.txt (line 18)) (1.7.0)
Requirement already satisfied: zipp>=0.5 in ./venv/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->Markdown->-r requirements.txt (line 18)) (3.1.0)
Building wheels for collected packages: mkdocs-redirects
  Building wheel for mkdocs-redirects (setup.py): started
  Building wheel for mkdocs-redirects (setup.py): finished with status 'done'
  Created wheel for mkdocs-redirects: filename=mkdocs_redirects-1.0.1-py3-none-any.whl size=5362 sha256=5c827a40842ac7e2debd2babfced706d6bc5ebb6cf38d24dea6a7ade64b8e821
  Stored in directory: /builds/MadeByThePinsHub/handbook/.cache/pip/wheels/fe/a0/1a/26f8490ff72de6a547b713b2561534ac9661cd6eebc7e30234
Successfully built mkdocs-redirects
Installing collected packages: mkdocs-redirects
Successfully installed mkdocs-redirects-1.0.1
WARNING: You are using pip version 20.2.1; however, version 20.2.2 is available.
You should consider upgrading via the '/builds/MadeByThePinsHub/handbook/venv/bin/python -m pip install --upgrade pip' command.
# Then build the handbook website
$ mkdocs -v
/bin/bash: /builds/MadeByThePinsHub/handbook/venv/bin/mkdocs: /builds/MadeByThePinsTeam-DevLabs/official-handbook/venv/bin/python: bad interpreter: No such file or directory

Links and Info

Logs: https://gitlab.com/MadeByThePinsHub/handbook/-/jobs/684576386
GitLab Host info: GitLab.com | GitLab EE 13.3.0-pre 638869faaa1

My .gitlab-ci.yml file

Copied from https://gitlab.com/MadeByThePinsHub/handbook/-/blob/34eea5a4940a213e00b7e0e2fbdc1996854770b2/.gitlab-ci.yml.

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  BUILDS_TYPE: "develop"

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
  paths:
    - .cache/pip
    - venv/
    
stages:
  - build
  - dry-run
  - triage
  - deploy

dry-run:mkdocs_buildTester:
  image: python:3.7
  stage: dry-run
  script:
    - pip install virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - pip install -r requirements.txt
    - mkdocs build -v
  artifacts:
    paths:
      - site
    expire_in: 7 days
  only:
    refs:
      - branches
  except:
    - develop
    - master
    - staging

develop:mkdocs_build:
  image: python:3.7
  stage: build
  script:
    - pip install virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - pip install -r requirements.txt
    - mkdocs build -v
    - cp -R ./site ./public
    - ls -al ./public
  artifacts:
    paths:
      - public
    expire_in: 7 days
    when: on_success
  only:
    refs:
      - develop

dry-run:words_counter:
  image: alpine:latest
  stage: dry-run
  script: 
    - bash ./scripts/builds/count-words.sh
  allow_failure: true

dry-run:triage-ops:
  image: ruby:latest
  stage: dry-run
  script: 
    - bash ./scripts/dry-runs/gl-triage-ops.sh
  only:
    - manual
  except:
    - schedules

triage-ops:
  image: ruby:latest
  stage: triage
  script:
    - gem install gitlab-triage
    # Use your own token! Do not steal.
    - gitlab-triage --token $API_TOKEN --source-id  --host-url $HOST_URL
  only:
    - schedules
  except:
    - manual

pages:
  image: ubuntu:latest
  stage: deploy
  script:
    - echo "Doing stuff..."
    - echo "I do nothing because the builds are done."
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    refs:
      - develop
  environment:
    name: develop
    url: https://en.handbooksbythepins.gq