Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A beginner's guide to setting up Python on Windows (datanitro.com)
52 points by karamazov on April 11, 2013 | hide | past | favorite | 53 comments


Great tutorial -- but this is exactly why we built Action.IO, so you don't have to deal with these long posts. We have preconfigured Python boxes that you can start coding on with your web browser, with full Linux terminal access.

The unfortunate part of setting up Python on Windows, is that you're still coding on Windows and missing out on using and learning powerful Linux/Unix tools. Most servers operate using Linux, so having the same environment in development is a huge advantage.

If you need an invite, just signup and send us an email at hello at action dot io


Last I checked, I could only setup a Ruby box. Where do we setup a python box?


We added Python, NodeJS and Go boxes last month. Just click "New Box" on the box index page after you sign in and you can choose a box template.


I prefer to install the 64-bit Python 2.7.4, then use the pre-built packages for Win64 at http://www.lfd.uci.edu/~gohlke/pythonlibs/ . I primarily use Python for scientific calculations, plus a little bit of web development, and I have chosen the following packages: Base, NumPy, SciPy, MySQL-Python, Mathplotlib. (NOTE: "Base" is a bundled collection of Python packages you will find at the above site; it is not a package that you will find at the official PyPI repository.) I also installed pip, but since I am behind a corporate firewall and have another program named "pip" (part of Strawberry Perl), it was a bit tricky.


I also have to disagree with quite a bit of this guide. Most windows systems are configured to simply do a `pip install numpy` since they often are missing the specific compiling tools to properly install these packages. For Windows vets, we've probably all seen the "Unable to find vcvarsall.bat" at one point or another.

I've found the easiest way it to point to 3rd party installers that often already have the key c-based tools you'll most often use. PythonXY, WinPython, PortablePython or Continuum's Anaconda. But you have to take the "bloat" with many of these, although PythonXY and WinPython allow you to select what you want and don't want.


Package managers are great until you want something that isn't provided. I used numpy as an example, but our users are just as likely to work with web scraping, SQL, or REDIS as with numerical computations; in that case, they still need to know how to manage packages themselves.


The installers don't stop the user from learning how to manage their packages. Other than Anaconda, the installers still emphasis using easy_install or pip. But what these do that many people don't understand is that when you do hit a compiling problem, it's often easier to find a pre-compiled package and simply install. So for you other examples, lxml is another notoriously difficult to get running on Windows. So you are stuck with a less efficient BeautifulSoup or not able to use PyQuery. So an installer for young python users is a godsend. As they dig deeper into python, the items you highlight are naturally developed.

(Don't get me wrong, by the way, props for helping out the often less technical Windows crowd.)


I'm not a Windows user, but I'd probably suggest trying https://www.enthought.com/products/canopy/ (formerly the enthought python distribution EPD) for a relatively hassle-free setup with numpy and other scientific packages. It also works on linux and mac, but I usually go with repository versions on linux.

Other comments suggest https://store.continuum.io/cshop/anaconda which I haven't tried to compare, but also looks promising.


Spyder's nice too, and free:

http://code.google.com/p/spyderlib/

I use it on both Windows and Linux.


Spyder has single-highhandedly allowed me to convert MATLAB users to Python.


Exactly, I was one of those MATLAB users.


Doesn't windows have a standard windows installer for python? Why are we still teaching beginners Python 2.7? What is wrong with python 3?


There's still many popular libraries that haven't been ported over. Django has recently been taken off the list but PIL, paramiko (and by extension, fabric) and other libraries that a beginner might see mentioned on python tutorials are still not ready. I recently gave python 3 another try and had to switch back to 2.7 pretty quickly.


I'm starting to think that if a library won't switch to Python 3 then it's time for the library to die and people move on to a new library that offers similar functionality and does work on Python 3.

For example, PIL doesn't support Python 3, but there's a GraphicsMagick wrapper [1] which does. Graphics Magick is more functional anyway.

You may have time invested in PIL and other Python 2 libraries, but newbies don't, and there's no reason to start them off on a dying version of the language. It's contributing to the chicken and egg problem that's holding Python back.

[1] https://pypi.python.org/pypi/pgmagick/0.5.5


Most widely-used libraries have not actually switched to Python 3, they just support it using 2to3.

Someone who only knows Python 3 would have a hard time hacking on the source code of most libraries.


re PIL. It's "friendly fork"/successor pillow does support python 3.x https://pypi.python.org/pypi/Pillow/2.0.0


They explain why at the end of the article. See: "A note on Python versions"


I found Anaconda (https://store.continuum.io/) to be the easiest way to get people setup with Python on nearly any system. It has the added benefit of bundling ipython, pip and numpy which is notoriously a huge pain to get working on Windows and Mac OS X.


If you're in a position where you need to follow a guide to install Python on Windows, then you're probably so new to Python that you're unlikely to be working with legacy code. Therefore, I'd suggest working with Python 3 and using 64-bit.


The R guys do a really easy to use package of mingw for satisfying compiler / linker requirements youll find you need (and all the other bits and bobs required).

Another thing worth mentioning is "user site packages" directory for those on locked down corporate machines. Pip install --user <package> will pop the package in %UserProfile%\Python\Python2X\site-packages\ - which is automatically on your $PYTHONPATH saving a little setup hassle.


ETA - user site packages is a 2.6-onwards feature. Rtools: http://cran.r-project.org/bin/windows/Rtools/


Will numpy actually cleanly install with `pip` or `easy_install` on a system that doesn't have the proper version of Visual Studio? If so, that's news to me.


No you have to have the correct version of VS or Mingw with the proper commands in the way `pip` is configured.


easy_install works fine out of the box for numpy, though pip won't.


This isn't much better than what Zed Shaw's book has for instuctions. Consider some screen shots, using Enthoughts or Continuum disributions, etc...


Author here. I've pointed people to his book for a while, but they tend to come back with questions. I'm hoping this'll help.


I'd recommend pointing beginners to PythonXY, WinPython, PortablePython, or Anaconda. Just like many Mac people get pointed to `brew` installs, it's just easier for Windows users to run with these installers.


Anaconda is a great install, especially for those dealing with data analysis, but the conda upgrade process from one version to another (1.3 to 1.4) has been hit or miss under Windows. But I still love the packaging and such they and others do...


I really don't understand why you'd use Windows for Python development unless you need to regularly use Creative Suite, mostly use Visual Studio/.NET and just do Python on the side, or for some reason play AAA games while you are working.


I do all the time, mainly because of lock-in at work and family laptop. Python is really easy to do this with. But yes, web code gets deployed to a Linux box.

But you can do quite a bit from desktop application to the source of this post, DataNitro (Use Python in Excel).

> mostly use Visual Studio/.NET and just do Python on the side

I have nothing to back myself up, but I would be surprised if this is actually the case (ie most Windows users program with VS/.NET). I'd like to find out if there is any real data on this.


I usually kickoff with the ActiveState download on windows http://www.activestate.com/activepython/downloads its a nice bundle with good help docs etc.


for me it is better run python behind cygwin, a linux guy on python feels more confortable


install linux...


Or better , fire a virtual machine with linux. I used to develop python and php on windows only to get loads of problems as soon as i had to deploy my script on a linux server. Having a dev and test environment that is close to the production server will save you a lot of time. Working on linux is a great experience, and makes a difference when looking for a job.

Whatever os you choose you just cant get wrong learning python , it is so awesome.


While it's definitely useful for production, test, and dev to all match, it's pretty easy to write Python that runs everywhere. In my experience the Python community is a lot better than most at making libraries and extensions work across platform.

I've written GUI apps with PyQT where I developed them on Linux and had them run without change on both Windows and OSX. Similarly, I've done some web development on my Mac, deployed to a Linux server, and everything's worked.

On the other hand, IMO, developing on Linux is far easier and faster than developing on Windows, so there may be other benefits to using a VM.


oh god i really need to test that QT stuff , sounds great !


Still use Linux as the host\development box and test the Windows version(s) in virtual machine(s). ;)


I understand that a lot of people prefer and/or are stuck with Windows, but people who can't or won't move beyond that just are not likely to get much utility out of Python.

If you're looking to learn it for any actual, practical application, e.g. any kind of development that will be deployed on the web or any kind of native system scripting, spending time setting it up on Windows is a waste of time you will need to spend at some point anyway learning to use an operating system that's actually suitable for such a purpose.

It's good that Windows users have the option of installing Python, I suppose, but something like this seems aimed at people who either are not actually going to do anything with or learn anything from it or are likely to simply give up after hitting the quirks and limitations of the platform.

A far more useful article that would accomplish the same purpose more effectively would be on setting up a free virtualization environment in Windows, then pointing people to the normal doc on using Python in some flavor of Linux.


If you're looking to learn it for any actual, practical application, e.g. any kind of development that will be deployed on the web

My first Python program was automating .csv creation based off of a bunch of arbitrary files in a folder. I did it as a marketing intern, after spending an hour convincing my boss that I could save the company literally tens of hours of time a month. I did it on a Windows XP box.

A few months later, I changed my major to CS.

If we want more people programming -- and being good at it -- saying 'hey use Linux lol' is not the way to go about it. Especially in a corporate environment.


I did not say "hey use Linux lol." I'm not one of those people. I made a considered argument for learning Linux for people who actually want to get the most out of Python, so the very least you can do is not lump me in with chatspeakers.

Also, your assertion that we (whoever that is) "want more people programming" is not one that I accept.


" people who can't or won't move beyond that just are not likely to get much utility out of Python."

You are absolutely wrong about this. Being able to use Python & Django/Flask/PyQT/wxPython/numpy/matplotlib etc in a corporate environment is a huge win. I have deployed multiple Python applications (both Django & wxPython gui apps) on Windows platforms with great success. (I work in a large Canadian hospital FWIW).

Would I prefer to deploy on Linux? Absolutely. Am I delighted that I can still use Python at my Windows only day job? You bet.


you can set up a linux server with a virtual machine on Windows.


I think Python is an excellent choice for people transfering their know-how from other platforms (e.g. Linux) to Windows.

The win32* libraries (as installed on a stock ActivePython .msi install) allow you to automate a lot of the windows platform, including a lot of the native api, implementing or controlling services, babysitting/killing/restarting windows tasks, talking to office applications, odbc databases, ... and I used it quite a lot to do automation tasks involving all these things.

Python is a very nice glue-language, not only on Linux. And I've used it to much advantage on Windows. I've

- talked to lab-equipment using provided .dlls (using ctypes) or serial ports (using py-serial)

- talked to other applications via OLE (querying some windows-only document management system and retrieving data, querying Excel to get data out, remote-controlling Word to fill in forms) to interface with the Windows-only crowd that is prevalent in big corporations.

- accessed databases over odbc

...and had most of my Unix-based tools, scripting know-how and methods (talking over network-sockets, using urllib, ascii-files, regular expressions) available to me, without resorting to ugly .bat-files, vb-script or vba.

Also I did some rudimentary UI development using wxpython.

I normally prefer coding under Linux, too, but I have to say, python under windows was not unpleasant at all.


I just wrote my first Python program (a tetris clone using the pygame library). Not everyone using python is doing it for web development, as many comments to this article seem to believe. I happen to have written it on Windows, but it makes no difference because I'm sure the exact same code will work when I copy it to Linux. (I think I'll copy it to my new Raspberry Pi and see if it works. I'm sure it will.)

quote: If you're looking to learn it for any actual, practical application, e.g. any kind of development that will be deployed on the web or any kind of native system scripting

There's a lot more to computing than that. I personally have nearly zero interesting in web development at the moment.


I'm an avid Python user. A beautiful aspect of the language is that, once installed (often as simple as running the default python.org MSI under Windows), the experience is essentially homogeneous whether the machine I'm running is Windows, Linux, BSD, OS X, etc. In short: preferences and politics aside, who cares about the underlying OS? Let's get things done!


A programmer wants to learn Python. He switches his OS from Windows to Linux. Now learning Linux stands between him and Python.

The procedure described is problematic due to the nature of the Python community, not any shortcoming of Windows.


Completely disagree. That's what is so great about DataNitro's tool to begin with. You get people using a more powerful tool...in the tool they most often use (Excel), then you are off.

Another reason is that Python is a great alternative to mathematical tools like MatLab, Maple, etc. And people's experience with these are most commonly in Windows. Having a python windows environment is key. I don't know how many people I've been able to get them to dump MatLab by showing them python and Spyder.


I'm currently pressed into service by a client as a lightweight db admin on a Windows box. Scripting the various tasks in Python there lets me use a language I already know, with code transferable on the day they decide to shift to a Linux server.


this comment reinforces the theory that comments on HN are not sorted only by their score in the current thread, but more significantly by the commenters' average or total karma.

at time of posting, the parent's user had 3.74 avg karma, but the comment was already graying-out relative to comments that were lower down the thread.


Dont know why you got downvoted , you are telling the truth. Virtualization is so cheap and easy today, you can even set up a virtual server on a windows machine and serve content on a local network , no need to buy another machine running just linux : cost = 0.


My comment emphasized the fact that people will get more utility out of Python in a non-Windows environment. Instead of disagreeing, here we have several Windows Python users deciding that the comment deserved to be downvoted instead of simply discussed. I don't think that's the correct use of a downvote, but I expected it; not a big deal.


Consider being less condescending. Condescension is like a gigantic flashing neon sign saying "I'm not worth arguing with because I'll just be a jerk to you if you reply". Your original post was absolutely dripping with it, and the one I'm directly replying to isn't really much better.


The cost of becoming marginally proficient in Linux is substantial. Futhermore for most people the cost of Windows is already sunk, and even the cost of a new copy doesn't mean going hungry.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: