Closed jayvdb closed 9 years ago
Thanks for the report, any suggestion where this check should be included? Would you like to submit a PR for this?
I've submitted a PR to include 2.6.6 in the build matrix, with a link to this issue. That should be sufficient for most people. We could add a sanity check in install.ps1 for 2.6.7+, but the error that occurs now (cant download msi) is pretty self explanatory, if a little ugly. I am keen on getting the pip bug fixes so that 2.6.5 will work, as that is the supposed minimum that https://github.com/wikimedia/pywikibot-core works on.
Closing this now that #10 is merged.
How can I install pip
on Python 2.6? I could do this:
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "%PYTHON%/python.exe C:/get-pip.py"
- "%PYTHON%/python.exe -m pip install ..."
...but I'm not sure how to use conditionals, that is: execute the code above only for python 2.6. Any hint?
@giampaolo , install.ps1
does install pip
for all versions of Python that are in the example build matrix. For Python 2.6, you must use Python version 2.6.6, rather than the latest 2.6.9 as it is the latest 2.6 release with an MSI installer.
PYTHON=C:\Python266, PYTHON_VERSION=2.6.6, PYTHON_ARCH=32
See https://ci.appveyor.com/project/ogrisel/python-appveyor-demo/build/1.0.129/job/mfdtlye9bd3gvrlp#L73
And it can be invoked using
%CMD_IN_ENV% pip install -r dev-requirements.txt
See https://ci.appveyor.com/project/ogrisel/python-appveyor-demo/build/1.0.129/job/mfdtlye9bd3gvrlp#L83 to see this in action.
If you still need conditionals, you'll need to use either cmd.exe IF syntax (ugly!), or (my preference) PowerShell, or ... use python since it is also available.
Problem is I want to do this:
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "%PYTHON%/python.exe C:/get-pip.py"
...only for python 2.6.
Problem is I want to do this: ... ...only for python 2.6.
The install.ps1 already does that internally. Why not just reuse it?
I can reuse it but I don't want to install pip twice for all supported python versions, only once for python 2.6. See where I'm getting at?
As I said this is precisely what the script does. Read the code I linked in my previous comment.
Wow, sorry for the noise above. I didnt realise it would spam this issue number. (The problem in my previous PR was I needed a 'noop' :/)
I now have two working solutions for this problem.
Both of them used --trusted-host for get-pip.py , however they differ in how they install ndg-httpsclient and its dependencies. Either:
Option 1 is easier for people copying this demo into their own project. I am a bit uneasy about automatically installing a lot of extra packages automatically - that taints the build so it is no longer a vanilla Python environment.
So I prefer the second option, as it allows the re-user of this demo to see what is needed, and why.
The second option might be improved by adding something like the following into the relevant if branch.
Write-Host "On Python 2.6.5 and lower, either install ndg-httpsclient or add pip option: --trusted-host pypi.python.org"
Just noting that the original problem with Python 2.6.5 still exists https://ci.appveyor.com/project/jayvdb/python-appveyor-demo/build/job/g5h90f8llfe0mmwr
So others don't have to reproduce my pain, documenting this delightful fact somewhere would be good.
get-pip.py fails for 2.6.5 or lower : https://github.com/pypa/pip/issues/2494
And later releases of Python 2.6 do not include msi installers. e.g. https://www.python.org/ftp/python/2.6.9/