I am required to support a project with a legacy version of python (3.5) and I'm struggling to create a virtualenv because latest setuptools (>51) no longer supports python==3.5. It throws syntax errors during installation of packages as it tries to run the setuptools.setup function which contains "future" syntax. I'm trying to figure out a way to create a virtualenv with an older version of setuptools as its default.
My current workaround is to create the virtualenv normally, then downgrade setuptools. This works for now, but could break at any time if other setuptools modules change syntax such that pip install setuptools==old can't run.
virtualenv -p python3 venv
source venv/bin/activate
pip install --upgrade setuptools==50.3.2 # This line could break in future
pip install my_project
I can see the virtualenv --extra-search-dir option (https://virtualenv.pypa.io/en/legacy/userguide.html#the-extra-search-dir-option) but that defaults to the latest version it can find since "virtualenv will look for wheels in the specified directories, but will use pip’s standard algorithm for selecting the wheel to install", so will ignore the old setuptools version I try to point it at.