3

I'm just getting started with virtualenv and virtualenvwrapper on Windows 7. I've created 3 different test projects using (respectively) Python 2.7, 3.4 and 3.5

I'd like to create a single requirements.txt file that installs the right binary lxml module for each version of Python. That way I can run pip install -r "C:\PyModules\requirements.txt" on any virtualenv I may create. Following an example listed elsewhere I tried a requirements.txt file like this:

C:\PyModules\lxml-3.5.0-cp27-none-win_amd64.whl; python_version == '2.7'
C:\PyModules\lxml-3.5.0-cp34-none-win_amd64.whl; python_version == '3.4'
C:\PyModules\lxml-3.5.0-cp35-none-win_amd64.whl; python_version == '3.5'

But it didn't work. Using this file with pip within a 2.7 environment gives:

lxml-3.5.0-cp34-none-win_amd64.whl is not a supported wheel on this platform.

and trying it in my 3.4 environment gives:

lxml-3.5.0-cp27-none-win_amd64.whl is not a supported wheel on this platform.

I had hoped the environment markers (python_version == '2.7') would cause pip to skip the lines entirely that referred to packages that were not intended for that Python version. But it appears Python is ignoring the python_version marker when it examines the WHL files.

Is there a way to accomplish what I'm wanting in a single requirements file?

EDIT #1: This is Windows 7 (64-bit), pip 7.1.2 and virtualenv 13.1.2

EDIT #2: As Sebastian suggested, I tried removing the quotes around the numbers in the requirements.txt file, which appears to be the right way to do it:

C:\PyModules\lxml-3.5.0-cp27-none-win_amd64.whl; python_version == 2.7
C:\PyModules\lxml-3.5.0-cp34-none-win_amd64.whl; python_version == 3.4
C:\PyModules\lxml-3.5.0-cp35-none-win_amd64.whl; python_version == 3.5

But with a 2.7 environment, I now get this new error:

SyntaxError: don't know how to evaluate 'num' '2.7'

and in 3.4 it's still this error:

lxml-3.5.0-cp27-none-win_amd64.whl is not a supported wheel on this platform.
Community
  • 1
  • 1
George Adams
  • 458
  • 4
  • 15

0 Answers0