Dear Reader,
After a long hiatus, I have returned to blogging. I’m taking a bit of a departure from writing about technical issues for the average reader and focusing on a more technical subject in this post. As a part of my studies at the University of Rhode Island for my BS in Computer Science, I’m taking CSC 440: Design and Analysis of Algorithms, an advanced programming class about how to make efficient use of the hardware resources in computers. The teacher has chosen Python so he can provide frameworks to work in for projects. The exercise for the student (me and my classmates) is in choosing / setting up a dev environment to work in.
So far, none of my coursework required me to code in Python so I emailed my teacher for advice. His recommendation is to code from the command line. Further, he said that Python release 2.7.14 was the most stable and least likely to case me issues while doing coursework. Since Windows does not natively support Linux and Python, I knew I would have to do a bit of configuration work.
The last time I used Linux on a PC was about ten years ago – the days of Windows XP and Windows Vista using a virtual machine environment or a dual boot setup. I quickly discovered the shiny new toy that Microsoft has created! Googling Windows 10 and Linux led me to the Windows Subsystem for Linux. “The Windows Subsystem for Linux lets developers run Linux environments — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a virtual machine.”
So the question remained: should I use the Windows Subsystem or install Python and run it in Windows directly? My first instinct was to run on Windows without the Linux subsystem. Why create the added overhead and more complexity if it was not necessary? I researched a bit further by googling Windows 10, Python and had more emails with my teacher. The collective vote among URI faculty was to utilize the subsystem. My teacher felt that the subsystem would be configured to run Python and would work much better. He said that Python didn’t download to Windows very well.
The next item on the agenda was to research Linux distros to find the one I wanted to work with. It turns out I wound up wasting a bit of time on this exercise. The Linux distros for this environment are limited; however, the results of my research are interesting so I will mention it in this post. Another google search led me to “The Best Linux Distributions for 2018” and “The best Linux distros for developers in 2018“. Since this blog post came from the Linux website and was a trusted source, I decided not to research the original data to save myself time. For those interested, I’ve listed the sites in the notes at the end of this post. The choices were overwhelming so I Tweeted and emailed. My teacher recommended Ubuntu and that is one of the distros that Microsoft has added to this feature.
My machine is a Dell Insprion 15 – 5568 and the build version is well-supported as I’m running the most recently updated version of Windows 10.
I decided to follow the instructions in MSDN and ran into problems right away. I needed to enable the Windows Subsystem for Linux and reboot. I opened a command window as directed and typed the command. The system wouldn’t recognize it. I copied and pasted the command. Still no luck. I decided not to troubleshoot that problem due to the semester starting in less than a week.
One of Microsoft’s enduring qualities is that they never have just one way of doing things. I found an older blog post from when the Subsystem was in Beta release and I manually set my computer to developer mode and enabled the Linux Subsystem via the control panel and rebooted. After the fact, I decided to troubleshoot the failed command. It turns out that the directive in the MSDN docs was to use the Windows PowerShell not the CMD terminal window. I opened the PowerShell and typed the previously failed command. It ran successfully, but required no system reboot because of my previous work.
The next task was to download Ubuntu. This was a very simple matter of going to the Windows Store and downloading and running the app I needed. The install of Ubuntu went seamlessly.
Time to make sure Python was functioning for use. Contrary to the collective
information, typing “python” and “python2” at the command line resulted in rebukes from the OS. It WAS familiar with “python3”. Since my teacher recommended python2 and they could both safely run in the same enviornment, I went about downloading python2. I found Tim Reilly’s Blog post “Python with Ubuntu on Windows” and used those intructions. I paused to do some additional reading along the way on what Python virtual enviornments were and why they were necessary. I downloaded and installed PIP to manage packages for Python. I was able to open a Python virtual enviornment, enter the Python enviornment and write instructions from the command line. With the install completed and successful, I left the other packages as an exercise for another day.
The next order of business would be to work through some Python tutorials; however, that is another story for another time.
Comprehensive information on Linux Distributions:
https://lwn.net/Distributions/
https://distrowatch.com/