econchick / new-coder

New Coder tutorials
zlib License
597 stars 394 forks source link

Updated the installation instructions for Windows #54

Closed madjar closed 6 years ago

madjar commented 10 years ago

Hey Lynn

The recent release of virtualenv 1.10 invalidated the installation instructions for Windows. I updated them, simplified them, and added virtualenvwrapper-win so that windows users can also have the workon goodness.

While I was at it, I updated the version of the linked python installer.

Installing pip and virtualenv on Windows is a pain. There's a PEP to include a pip bootstrap in python for 3.4, so hopefully, the problem will be solved someday.

I didn't update the html files for fear of doing it wrong. You'll have to do it after merging.

Thanks a lot for the tutorial, by the way !

econchick commented 10 years ago

To be honest, I was thinking about directing people to use the Git Bash (which is just MinGW) that comes with Windows' Git installation. This would mimic the linux/mac behavior that I work with in these tutorials, including the use of virtualenv + wrapper + pip. Thoughts @madjar @merwok ?

madjar commented 10 years ago

Git Bash might be a good idea to mimic the linux/mac behaviour, especially if you do some manipulation on the command line and don't want to translate it to windows (I have no idea how to do cat in windows). On the other hand, I haven't used it enough to be sure it's friendly enough to new users.

About the ez_setup part, I agree that virtualenv → pip is the way to go, but we still have to install virtualenv. Since the last version, it's not possible to just use virtualenv.py, and installing virtualenv requires setuptools. According to their documentation, the preferred way to install setuptools on windows is ez_setup.

Anyway, I urge you to take a decision (use ez_setup, use http://www.lfd.uci.edu/%7Egohlke/pythonlibs, or another solution), because as of now, the instructions are not usable.

econchick commented 10 years ago

Yeah you're right - definitely have been neglecting the Windows setup instructions. Thanks for the nudge, @madjar

econchick commented 10 years ago

@merwok @madjar can you take a look at this and give me your opinion: https://gist.github.com/econchick/a0fbd9564434ec11a7c2

madjar commented 10 years ago

@econchick It only works if you also install setuptools (possibly from the same source), because pip depends on it. I personally believe that ez_setup is a better solution because 1/ it's the officially recommended one and 2/ checking the version number might be error-prone, especially for newcomers.

virtualenvwrapper doesn't seem to work on git bash. I get "mktemp: command not found". I reckon virtualenvwrapper might need a complete unix environment and not only bash.

econchick commented 10 years ago

@madjar are you sure it's not mktmpenv ?

econchick commented 10 years ago

btw @madjar I updated the gist with the ez_setup. I hope it addresses the issues you brought up.

But I really thought that virtualenvwrapper worked Git Bash - I do remember working with it just fine. I could be wrong/it could have changed since the last I tried. I have a windows VM at home that I'll try with if mktmpenv does indeed not work.

Thank you so much for your help. Windows is definitely a blind spot for me.

madjar commented 10 years ago

@econchick I confirm that I meant mktemp : when I run source virtualenvwrapper.sh, it complains about not being able to create a temporary file because it couldn't find mktemp.

The hardest part here is to try it with a pristine install. I know I've cygwin here and it might interfere in some way that eludes me.

I confirm that the instructions the gist now work. There's still a few things to fix ("Open/run the Git Bash program.", should come before "run easy_install pip"), and the big first part could be replaced with with a simple "add this to .bashrc" once we're sure it works.

merwok commented 10 years ago

There are two ways to bootstrap the install toolchain. Downloading and running ez_setup gives you setuptools with easy_install, easy_install lets you install pip, pip lets you install virtualenv and virtualenvwrapper. The alternate is to download virtualenv.py, which embeds setuptools and pip, and then you can create virtualenvs that contain setuptools and pip. The only advantage of easy_install is the ability to install binary packages (C extensions) on Windows if you don’t have a compiler.

madjar commented 10 years ago

@merwok Downloading virtualenv.py is not supported any more (starting with 1.10)

Using virtualenv.py as an isolated script (i.e. without an associated virtualenv_support directory) is no longer supported for security reasons and will fail with an error. (https://pypi.python.org/pypi/virtualenv)

I'm not saying we should use easy_install over pip, I'm just saying it looks like it's now the way to install pip and virtualenv.

merwok commented 10 years ago

I see. Then amend my message to replace “download virtualenv.py” with “download virtualenv and install it using setup.py” :)

madjar commented 10 years ago

@merwok Except installing virtualenv requires setuptools. So, if we need setuptools anyway, we might as well easy_install pip once we have it.

merwok commented 10 years ago

I see, the virtualenv script is not installed on windows without setuptools :'(

madjar commented 10 years ago

Hello there !

I don't know if this PR is still useful (if not, let's close it), but here is an interesting update from pip:

Beginning with v1.5.1, pip does not require setuptools prior to running get-pip.py. Additionally, if setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.

This means that a few lines of instructions can be replaced by (more or less) "download https://raw.github.com/pypa/pip/master/contrib/get-pip.py and run it with python get-pip.py". Cool, isn't?

econchick commented 10 years ago

Hey @madjar - thanks for the ping/update - I really appreciate it. This definitely looks interesting and I'll look into it further!

madjar commented 6 years ago

Hi there,

Cleaning up my old PRs. Closing this since it's mostly likely outdated.

Have a nice day!