I'll be taking a Python-based computer science class next semester using my MacBook Pro. It will be centered around a custom-designed package for this class. The problem is that this package is being sponsored by Microsoft Research, so it was obviously designed with Windows in mind. Supposedly, it runs on Mac OS and Linux too, but they say they don't officially support Snow Leopard whatsoever.
My concern is that there will be some sort of miniscule differences between the Python code on a Mac and on a PC. The homework is submitted online, and is graded for results. Apparently, they don't actually look at the code itself.
Is this a concern? Should I install Windows in a VM/partition and be done with it? Or should I stay where I feel most comfortable? After all, switching back and forth constantly would be a huge hassle. Thanks for your help!
If the class expects the code to run on Windows then I would install a VM with Windows on it since it is possible that some things may not work quite the same way (especially if you are doing system-specific things like file-system access or executing OS commands).
Classwork/homework always goes smoother when you have the exact same environment as the professor and the rest of the class.
Definitely start with Mac. If it turns out that it really does need Windows, you can switch once you're sure. But Python development is definitely more natural on a Unix-based machine.
Most online graders will let you submit multiple times, and the first assignment is usually easy, so you should know pretty quickly if using a Mac is causing you problems. In the meantime though, you'll have a much smoother ride doing Python on a Mac than on Windows.
If they will be testing your code on windows then you really need to be targeting that platform. However if you feel more comfortable on the Mac, do your dev there but also run a virtual win machine so you can test on the target platform. I would suggest the excellent VirtualBox. You can share local folders with the VM, which reduces the pain of switching back and forth, once the VM has python setup you can just hop in and and run the code direct from the directory on the Mac you developed in.
From their site it looks like Mac is fully supported (up to 10.5 -- it's true that 10.6 is different enough to give occasional problems... I haven't upgraded yet even though I did buy a family pack of 10.5 to 10.6 upgrades, as I'm not looking for trouble right now). If you can use a Macbook with 10.5, I'd say to go for it -- the familiarity and extra productivity are worth the miniscule risk that despite all their claims of support something goes wrong (and you can in fact download and start testing right now!). If your Mac options are limited to 10.6, then I'd go for a VMWare or Parallels VM with a Windows (not sure if Windows 7 is fully supported yet, maybe XP is a more prudent option) installation instead.
Develop and test on a Mac. If it works on the Mac, then test it on Windows before submitting. Done this tons of times with my own programming courses, albeit with a different set of languages and technologies.
Go Mac and never go back.
More seriously, a Mac offers UNIX environment, and Windows offers blue screens.
Related
I have windows xp, I have found some python libraries that only work for windows xp and thus if you have a mac os or linux or windows 7, you can't download my program because it won't work, how to make these libraries compatible with these OS, I can't ask the creator of the libraries so I have to download the source code and modify it, and i have to make it compatible on these OS using my xp :D well my brother's pc is windows 7, but I don't have mac OS or linux (unless i can use VM)
EDIT
my application is not simple
You're asking a very general question. Perhaps overly general.
Generally, unless your application is relatively simple, it's impossible to guarantee that it is going to work on Linux and Mac OS X by only having Windows available. You will have to at least test it on Linux. Mac OS X is rather similar to Linux in many aspects, so you may get off the hook there, although for more complex cases it won't suffice.
Python is not much different from other languages in this respect - it makes writing cross platform code easier, but it won't solve all your problems.
Luckily, installing Linux on a VM is quick and free. Personally I use VirtualBox with a Ubuntu installation on top. It takes less than an hour to set up such a system from scratch (download Vbox, download an Ubuntu image and install it).
Your question is quite broad:
1) Development and testing:
Use VMs, absolutely, they are great for testing on OS you don't natively use, and to have a clean environment for testing (eg. test even windows stuff on a clean windows VM if you can, you might find out you're missing some dependencies that you took for granted on your dev machine).
2) Actual library porting:
Depending on the library this may or may not be difficult. Why is this library only working on windows? does it use specific DLLs, via ctypes or swig or some other bindings. If the library is python code (not a C library), is it tied to windows python APIs?
There are many things to take into account, if using system specific APIs/libs, can they be faked on other OSs (write small abstraction over them), or does it require a lot more code. You get the gist.
I've been developing python web apps using django and appengine.
I'm planning on buying a macbook to develop iPhone apps.
I wonder if I will be able to develop my python apps without too much changes on a mac , or if keeping them on a PC will be better?
Thanks
Macs run Unix, Unix makes python development even easier! (IMHO)
In other news: one of python's big selling points is that it's multi-platform, it can run as well on Windows as on Linux as on a Mac. Heck, here's a list of other platforms it can run on.
All that to say, you can move your python projects back and forth between a mac and pc with relative ease as long as you don't use any platform specific libraries. So, no you shouldn't have to do anything terribly special to make it work.
Developing python for app-engine on a mac works like a charm.
Python development on a Mac will be similar to Python development on other *NIX-based operating systems which, in some ways, can be easier than on Windows. As long as none of the modules you are using are Windows-only then you should have no problem!
I usually develop with Python on OS X and it's a real pleasure to work it.
Just remember to install Macports;
with macports installing Python versions, Python libraries, Eclipse and so on is really easy.
I would look at Homebrew instead of MacPorts - Link
I was working on an update to my application and before I began I migrated to 2.62 because it seemed to be the time to. I walked right into the issue of having problems building my application using py2exe because of the MSVCR90.dlls. There seems to be a fair amount of information on how to solve this issue, including some good answers here on SO.
I am deploying to users that more likely than not have 32 bit XP or Vista machines. Some of my users will be migrated to 64 bit Vista in the near future. My understanding of these issues is that I have to make sure they have the correct dlls that relate to the version of python that exists on the application development computer. Since I have an x86 processor then they need the x86 version of the dlls. The configuration of their computer is irrelevant.
Is this correct or do I have to account for their architecture if I am going to deliver the dlls as private assemblies?
Thanks for any responses
Vista 64bit has a 32 bit emulator I believe, so you will not need to worry about this.
However, I would just tell them to install the msvcrt runtime which is supposed to be the correct way to deal with this sxs mess.
From what I have gathered and learned the correct answer is that I have to worry about the MSCVCR90 dll that is used in the version of Python and mx that the application I am building rely on. This is important because it means that if the user has a different configuration I can't easily fix that problem unless I do some tricks to install the correct dll. If I have them download the MS installer from MS and their hardware (CPU type) does not match mine then they will potentially run into problems. There is a really good set of instructions on the wxpython users group site. WX Discussion.
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development:
"Stock" Apple Python
MacPython
Fink
MacPorts
roll-your-own-from-source
I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other?
Update:
To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
One advantage I see in using the "stock" Python that's included with Mac OS X is that it makes deployment to other Macs a piece of cake. I don't know what your deployment scenario is, but for me this is important. My code has to run on any number of Macs at work, and I try to minimize the amount of work it takes to run my code on all of those systems.
I would highly recommend using MacPorts with Porticus for managing your Python installation. It takes a while to build everything, but the advantage is that whatever you build yourself will be built against the same libraries, so you won't have to futz around with statically linked shared objects, etc. if you want your Python stuff to work with Apache, PostgreSQL, etc.
If you choose to go this way, remember to install the python_select port and use it to make your system use the Python installed from MacPorts.
As an added bonus, MacPorts has packages for most main-stream Python eggs, so if you should be able to have MacPorts keep you up-to-date with the latest versions of all that stuff :)
Here's some helpful info to get you started. http://www.python.org/download/mac/
Depends what you are using python for. If you are using MacOS funitionality and things like PyObjC you are probably best of with MacPython or the python provided by Apple.
I use Python on my Mac mostly for development of server side applications which later will run on FreeBSD & Linux boxes. For that I have used fink python for a few years and ever since MacPorts python. With mac ports it is simple to add required c modules (like database driver etc). It's also easy to keep two python Versions (2.5 & 2.6 in my case) around.
I used "compile your own" python to test pre-3.0 python but generally I find managing dependencies to c modules painfull if done by hand.
Thanks to easy_install installing pure python modules is fast and easy for all the options mentioned above.
I was never very much an IDE person. For development I use command line subversion installed by MacPorts, Textmate and occasionaly Expandrive do directly access files on servers. I personally are very dependent on Bicyclerepairman for Textmade to handle my refactoring needs.
Others seem to be very happy with Eclipse & Pydev.
How about EPD from Enthought? Yes, it's large but it is a framework build and includes things like wxPython, vtk, numpy, scipy, and ipython built-in.
I recommend using Python Virtual environments, especially if you use a Timecapsule because Timecapsule will back everything up, except modules you added to Python!
Based on the number of bugs and omissions people have been encountering in Leopard python (just here on SO!), I couldn't recommend that version. e.g., see:
Why do I get wrong results for hmac in Python but not Perl?
Problems on select module on Python 2.5
I would choose MacPorts.
It does not eliminate your existing python supplied by Apple since it installs by default in /opt/local/bin (plays nice with it) and plus it is easy to download and install additional python modules (even binary modules that you need to compile!). I use Porticus GUI to maintain my MacPorts installed list of packages, including python.
In my windows environment I use Eclipse and PyDev, which works quite well together, even if it's a bit sparse. Apparently the exact same environment is available for the Mac as well, so I suggest downloading Eclipse and using the internal update software function to update PyDev with the URL http://pydev.sourceforge.net/updates/. To look further into PyDev, look here.
Apple's supplied python is quite old – my tiger install has 2.3.5. This may not be a problem for you, but you would be missing out on a lot. Also, there is a risk that Apple will update it. I'm not sure if moving from 2.3.5 to (say) 2.4 would cause code to break, but I guess it's possible. This happened to perl people recently: http://developers.slashdot.org/article.pl?sid=09/02/18/1435227
Macpython is a framework build (as is Apple's, I believe). To be honest, I'm not sure exactly what that means, but it's a prerequisite for some modules, in particular wxPython. If you get python from macports or fink, you will not be able to run wxPython (unless you run it through X11).
And guess what was forgotten by every answer here ... ActivePython.
No compilation required, even for third-party modules such as numpy, lxml, pyqt and thousands of others.
I recommend python (any python?) plus the ipython shell. My most recent experience with MacPython was MacPython 2.5, and I found IDLE frustrating to use as an editor. It's not very featureful, and its' very slow to scroll large quantities of output.
New to python (and programming). What exactly do I need from Cygwin? I'm running python 2.6 on winxp. Can I safely download the complete Cygwin? It just seems like a huge bundle of stuff.
Well, I keep running into modules and functionality (i.e. piping output) which suggest downloading various cygwin components. Will cygwin change or modify any other os functionality or have any other side effects?
There are builds of python which don't require cygwin. For instance (from python.org):
link text
Also, there is the .NET version called Iron Python:
link text
cygwin is effectively a Unix subkernel. Setup and installed in its default manner it won't interrupt or change any existing Windows XP functionality. However, you'll have to start the cygwin equivalent of the command prompt before you can use its functionality.
With that said, some of the functionality you're talking about is available in Windows. Piping definitely is. For instance:
netstat -ano | findstr :1433
is a command line I use to make sure my SQL Server is listening on the default port. The output of netstat is being piped to findstr so I only have to see any lines containing :1433.
I would say the simplest option is to try a Linux Distro. I know if your new Linux can be intimidating, but when I looked at Ubuntu and started developing there my life was changed. Ubuntu is bloated (for linux) however, it comes with the things that I would expect a Microsoft based OS to come pre-packaged with. The limitless amount of free software written by creative minds for creative minds is a wonder. The open-source community is great to get involved in for learning and experience. I can vouch that programming on Linux in any language (except myabe . . . .NET ?) will be a much pleasurable experience from the go. One is windows paths, sure you can still create portable Python applications that will port to windows, it just requires another couple lines of replacing characters and escaping them. If they are personal apps this can be bothersome if you do not plan to distribute them.
I found Ubuntu to be a nice balance suited towards both general usability, and development.
Stock Distro:
Python 2.7
Perl
XTerm
MP3 Player that kills WMP and Winamp =+ V.3.0
E-Mail w/ Thunderbird ( much like outlook express by the makers of Fire Fox browser with add-on and extensions)
Empathy (Internet Chat Client for AIM, ICQ, FACEBOOK, MySpace, etc . . it also keeps all your contacts on one list and operates just like AIM for all accounts)
Gwibber (social networking app that compiles the posts made on your twitter and your Facebook wall into a nice desktop widget that also allows you to reply and comment right from the app.)
Multiple Desktop Support: You can change your "desktop view" by pressing a hot key. Each desktop only has the windows you want on it. So you can create a work space, a chat space, a web browsing space and alternate between them quickly. You can also move windows around between work spaces quickly as needed.
Global Hot-Key Mapper: In your administration options you have an OS wide hot-key map. You can launch programs, and many other tasks simply by assigning a hot-key through the default interface.
Bash, Terminal, Shell, XTerm: These CLI (command line interfaces) offer much more functionality as you found than can be generally found in windows. Yes you can pipe output in windows but that's not what this is about. These CLIs allow you to create scripts that can take user input and perform complex tasks that usually would have to be done manually. The BASH is somewhat a programming language of itself; allowing for the assignment of functions, variables, if statements, etc.
I was very surprised that not only was Ubuntu well and ready to handle the developer but it was also plenty user friendly for your grand-parents. It comes with everything you need out of the box (for an average user not a developer) and the developer only requires a few installs. You're also working in open-source software remember. So you are going to be dealing with bugs and you may be stuck waiting on a ticket to be resolved in Windows for some time. If ever.
Also, Ubuntu is boot-able from CD and you can check out the main interface just by doing so. You can also dual-boot it with a screen asking you which partition/disk to boot after POST boot. There is also a tutorial on running it off a thumb drive.
Linux and the speed of your computer: Linux compared to say Windows 7 is EXTREMELY lightweight. What is considered to be a MID level computer such as an AMD Phenom 955 Black Edition x4 and it will run like a high level computer. 1 gib of memory goes quite a bit further in Linux than it does in windows.
The best way to try a Linux distro is as follows. You do not have to install it on the system. You can sandbox it with a virtual environment if you like it and want the speed and overhead improvements of running it stand-alone maybe consider the dual-boot at first followed by the "change".
Download the Linux Dist ISO of your choosing. For new users again Ubuntu, Mint, something simple. Something debian. Mostly due to the ease of using a good package manager. Download Oracle Virtual Box . Follow the instructions, create a new virtual disk, then start the virtual disk with install media placed in DVD drive or virtual DVD drive and install like a normal OS.
In my experience unless it is essential that you be using windows all the time, there is no reason not to try a Linux Distro. Just be careful because something like ArchLinux or SlackWare may scare you off right away; where as distros like Ubuntu, Mint, and others have built in GUI right off the bat. Linux comes in many varieties. It is more loosely coupled than windows you for example you can use any desktop environment you want. Linux is just a kernal. The distros are collections of tools the group maintaining the distro thinks will fit their over-all goal and purpose. Desktop Environments, programming tools, package managers, and other freely licensed pieces of software.