Installing Python 2.7 and Modules on Windows

python-logo-master-v3-tm-flattenedInstalling Python isn’t hard. Figuring out what to install is a nightmare. This is my experience with installing Python and some Modules on Windows and it’s good news, I promise.

I’ve done some work with Python on Raspberry Pi Rasbian and on Ubuntu Linux, but I’ve steered well clear of Python on Windows for one simple (albeit embarrassing) reason: I couldn’t figure out how to add modules (also sometimes called packages). Installing Python is really straightforward thanks to the ladies and gentlemen over at the Python Software Foundation,  but third-party modules are extremely daunting to the novice. Enter Python hero: Christoph Gohlke of the Laboratory of Fluorescence Dynamics at UCI. He has compiled versions of popular modules available for free on his UCI website.

Check out “The Short Version” if you only want the step-by-step.

The Long Version:

For those that are unfamiliar with Python, here’s a quick tutorial: Python is a programming language that has been designed to be cross-platform and human-readable. The modules I was referring to earlier are libraries of code, both written in C and python that provide extra functions to vanilla Python that it’s developers didn’t include. For example, Numpy is a popular module which provides mathematical operators like trigonometric, exponential, and logarithmic functions.

Python and the modules I’m talking about in this post are also licensed as open-source software meaning that anyone can download them and use them in their own software solutions, provided they abide by the conditions of the licenses. While Python as the language is governed and distributed by the Python Software Foundation, the modules aren’t and can be created by anyone. You could imagine that this might cause problems like “which modules can be trusted” and “how do I know it will work” and they do. I overcome these issues by either looking online for examples that do similar things to what I want to do, checking out module documentation, and finally, trying it out. It’s a time consuming process to vet a new module, but the price is right.

If you’ve tried to install Python and a module (I’m going to talk about Numpy, for example, but other modules are similar), then you probably found the right Python installer on, installed it without issue, then emboldened by your newly found powers, struck off for only to panic when the download option is for source code from GitHub and not an installer. I was there, friend, I feel your pain.

The expectation with supplying the source code is that you as the user would compile it yourself. They generally provide some instructions, but the general consensus is that their target audience are developers and compiling code is something developers know how to do. To be fair, there is such a variety of compilers that it’s almost impossible to give a universal set of instructions. Because Linux comes with open-source compilers for C and C++, it’s easy for Linux installations to be automated, but no such luck for Windows.

To make installation easier, Eggs (legacy) and Wheels (modern since 2012) were introduced as standardized formats for code and binaries (compiled code). They are essentially Python-specific installation files. Wheels seem great in theory, but at the end of the day, they contain pre-compiled code which means that anyone that uses them are subject to the details of the computer that compiled them. For example, if a developer like Mr. Gohlke wants to contribute to the community and make life easier for the rest of us by compiling the source code, then the wheel that he produces may or may not work for someone else because of the version of source he used, the compiler and any options he selected, the OS running on his computer, the processor architecture, and the versions of Python and PIP he had installed at the time. Generally speaking, this tends to be a non-issue as long as the broad strokes are same, but sometimes the differences between his computer and someone else’s may make the compiled code misbehave. The good news, here is that wheels are generally useful and they can be a lot easier than compiling your own source if your computer science skills are limited.

“Okay, now I know the history of the world, but what can I do with it?” you may ask…

The Short Version:

Based on my (limited) experience, I put together these steps which I’m sharing as a guide to help accelerate your python installation process. To be clear, I’m not guaranteeing that these steps will work and some interpretation may be required to get them to work.

My process involves changing the existing path variables which if done incorrectly can destabilize your computer, so use extreme caution! These steps are provided for information only. Your actual mileage may vary. If you aren’t comfortable with these steps, I’d suggest you find another way to install Python..

  1. Download and install Python from
  2. Add python and pip to the path variable.
    • Right click on “My Computer” in windows explorer, then click “Properties” in the menu.
    • Click “Advanced System Settings” in the System window (administrative credentials required)
    • In the “System Properties” dialog, click the “Environment Variables…” button in the “Advanced” tab.
    • Find “Path” in the System variables frame of the “Environment Variables” dialog and click “Edit…”
    • Add the python and pip paths to your path variable
      On my computer, Python installed to the default location, so the added text is (no quotes): “;C:\Python27;C:\Python27\Scripts”
    • Click OK all the way back.
  3. Download the pre-compiled pip files for the modules you want from Christoph Gohlke’s webpage.
    • The version you download has to match your computer configuration. For example, I’m installing wheels for Python 2.7 and my computer is an AMD 64 machine, so for Numpy, I picked
  4. Install the wheel files using pip through an admin command prompt.
    • When you go to launch the command prompt, right-click on it and select the “Run as administrator” option.
    • use the “cd” command to navigate to the folder where you downloaded the wheel files
      For example:
      cd C:\Users\Guest\Downloads
      navigates to the default downloads folder on my computer for username “Guest”. (Note the space between cd and C:\…)
    • invoke pip to install the wheel file by typing “pip install <wheel>” where <wheel> represents the filename for the wheel including the .whl extension.
  5. Test out the module by opening IDLE and typing “import <module>” where <module> represents the module name like “numpy” for Numpy and “cv2” for OpenCV. If something went wrong, python will return an error message.

I hope this little guide helps you understand Python a little better and helps you get up and running faster. Please share your experience by leaving a comment below.

If you liked this project, you might also like:

Entry into Machine Vision

Did you like It’s Project Day? You can subscribe to email notifications by clicking ‘Follow’ in the side bar on the right, or leave a comment below.

Applications and Fabrication with Plastics

Essentially, this presentation is going to come down to one question: Why should you use plastics? or phrased differently, How could you use plastics?
Is the strength suitable? Will it stretch? What does the final shape need to be? Do you have the tools? Will the part be abraded? Are there unconventional features that you need to have?



Even though they’re all lumped together as “plastics” different plastic material can have wildly different properties and it’s important to understand those differences so you can pick the right material for the job. At the highest level, plastics can be separated into two groups by the methods that you can use to work them. The first group, thermoplastics will get soft when heated and harden when cooled and this process is repeatable many times. Thermoplastics are often sold in blocks, sheets, tubes, and rods because they are ready to work in their solid form. Thermoset plastics on the other hand, can’t be heated to be worked after their initial forming. They are sold in a liquid or gel form with a matching hardener or that harden by some other means (UV light, exposure to moisture in the air, etc).
Each of those categories has a wide spectrum of plastics with a varied array of properties to choose from. I’ve listed some of the ones I’m going to talk about today.
I’m going to focus mostly on thermoplastics because of their availability and usefulness in robot-building.


How do you know if plastic will do the job as a structure? To know the answer to that question, we can use ultimate tensile strength (write on board) which is the stress at which the part will break. Tensile stress is like the opposite of pressure. When you pull the two ends of a piece apart, the force is distributed over the cross-section of the part and if you apply enough force, the part will break and that’s where the ultimate part comes in. We can use that property to compare different materials to each other. Also, in robotics, weight is your enemy, so I charted the ultimate tensile strength against density so you could have a general idea of how these plastics might perform compared to each other.
For example, UHMW has a strength of about 20MPa and very low density, meaning it’s very light weight. Polyethylene has about the same strength, but a much higher density. You’ll also notice that this distribution is about linear where the heavier the material is, the stronger it is, but that’s not always the case. Some special varieties may have additives that make them stronger or lighter. You can see ABS, Acrylic, Polycarbonate, and PLA.
Now, I’m sure the 3D printers among you are probably looking at this chart and saying “Wait, that’s not right. ABS is stronger than PLA!” But what’s happening here is that PLA IS in fact stronger than ABS if you apply an even, slowly applied force, but PLA is BRITTLE, so it can’t take a beating like ABS can. What I mean is that PLA will break easier if a sudden impulse force is applied.
Also, for comparison:
Aluminum: Density 2.7g/cm³, 80MPa to 570MPa, depending on alloy type. If you buy aluminum at the hardware store, I wouldn’t assume higher than 80MPa. 6061-T6 (aircraft-grade aluminum) has the best properties and is very expensive.
Structural Steel: Density 8.08g/cm³, 400-550MPa. Steels like Chromoly can be stronger than 670MPa.


You may or may not have heard about the strong axis and the weak axis regarding 3D printed parts. If you haven’t, the general idea is this: 3D printed parts act like composites, even though it’s all made of the same material, it can be weaker if pulled in one direction than another direction. This phenomenon can be attributed to the bonding strength between printed layers and the difference in cross-section between slices in different directions.
Consider this example of a 1” cube cross-section of a printing with ¼” beads which I’ve drawn as rounded squares. I realize the proportions aren’t realistic. If you calculate the cross-sectional area between layers (xy), in my example, you’ll find that the rounded corners take about ½ of each square. If you multiply that by the 1” length, you’ll end up with 0.5in² or about 50% of the possible 1×1.
If you do the same with the cross section at the end where we’ve cut it out of the part, you’ll find that the rounded corners only take (4-pi)/32 from each bead, leaving a cross-sectional area of 0.94in² or 94%, nearly double the area between layers!
So in this example, if you pull the cube from the top and bottom as shown (or side from side), the part will break under about half the force required for the axis into and out of the board.
Since FDM printed parts are printed as whole perimeters, the actual cross-section through the whole part will vary significantly with most regions having combinations of cross sections like these and others where layers are stacked up so the strength will be somewhere between the 94% and 50%. For certain, though the strength in the z-axis will be less than any other axis of the part.


While we’re on the topic of 3D printers, I wanted to write for a minute about a problem that FDM printers have called heat creep that happens in the hot end. Also if you’ve printed with ABS and PLA, you may have noticed that it’s more of a problem with PLA than ABS, but why? The answer is the glass transition temperatures of the two plastics. The glass transition temperature refers to the temperature where the plastic becomes rubbery and flexible, but isn’t yet a melted liquid. Before I get to why that’s important, let me start off by explaining the major parts of the extruder:

  • The build plate is where the plastic is deposited
  • The nozzle squeezes the plastic filament diameter down to the printed size
  • The heater block brings the filament to its melting temperature
  • The cooling fins keep the incoming filament cool enough so the pressure from the mover gets transferred all the way down to the nozzle.
  • The incoming plastic which is at room temperature also helps to keep the channel cool because it’s coming in at room temperature.

Generally, you’d use the same extruder for both PLA and ABS, so both plastics will be subject to the same basic principles.
For PLA, generally you can print near 180°C and with ABS, you can print near 220°C. Most of the time when you’re printing perimeters or the first few layers, the filament remains solid in the tube because the combination of ambient cooling and incoming filament keep everything just perfect. But some of the time when you aren’t consuming that much filament, the filament in the tube will heat up and the rubbery filament can get deformed and jam, then the mover just spins and hogs out this nice simicircle right here and you get to spend a couple hours cleaning up the mess. This problem is more prevalent with PLA because the glass transition temperature is so much lower that it happens more easily than with ABS.


here are lots of other ways that plastics can be used. For example:
If you needed a plain bearing material or a non-marking material for bumpers, you might use UHMW because it has high abrasion resistance even though it’s quite soft and bad for structural parts.
Or if you needed a cover for your circuit boards, you might use sheets of styrene, ABS, acrylic, or polycarbonate because they can be heated and formed to any shape.
Everyone knows if you want a part that can’t otherwise be machined, go with a 3D printer which most commonly use ABS or PLA plastic
Another lesser-known use for 3D printer filament is as a rivet material. Basically you mushroom one end using a heat source like a heat gun or soldering iron and then, push the filament through your parts and mushroom the other end.


Earlier, I mentioned that UHMW was  a good bearing material, but wasn’t good for structures, but why is that? The answer comes down to one number: Young’s Modulus. Earlier, we were talking about stress which is the expression of force distributed over the cross-section of the material. Strain is another related reaction of material to forces. Strain is the measure of how much a material stretches. Young’s Modulus is just the ratio of stress and strain. UHMW has extremely low Young’s modulus meaning that when UHMW is under stress (pulled apart) it changes it’s length drastically. Clearly, such a material would make flimsy structures.


In general, wood-cutting tools will work with most thermoplastics and thermoset plastics. You’ll need to be careful when working with brittle materials like acrylic. Acrylic may chip and shatter if the tool is too aggressive or catches. In those cases, it’s best to take a little at a time by using tools like razorknives that cut slowly or step drills that slowly widen a large hole. It often helps to prevent chipping by using a backing material like a scrap piece of wood. That prevents blowout which chips the material.
When drilling or cutting with power tools, there’s a relationship between the speed of your tool and the amount of pressure you apply. You’ll want to avoid running the tool too fast and overheating your plastic, possibly melting it or, on the other extreme forcing too much material into your tool, causing the plastic to chip or crack. The ideal zone will grow or shrink with different materials. For example, with acrylic because it’s so brittle, the ideal zone will be very small. ABS, Styrene, and Polycarbonate are much more forgiving and you can just tear through UHMW because it cuts like butter.



Some techniques you might not be familiar with are general heat forming where you apply heat to a specific area of the plastic and bend it into a shape and let it cool. For example turning a strip of acrylic into a 90° angle bracket.



Vacuum forming is a more advanced version of heat forming where you heat a sheet of thermoplastic, then stretch it across an object and use a vacuum to suck the air out, forming the part. This is not as hard as it sounds, but generally takes a few tries to get it just right.


A Fun Recipe for Kitchen Chemistry

Chemistry is all around us every day. And now, it’s all over my father-in-laws refrigerator, too.

My father-in-law is a chemical engineer and a kitchen chemist in his free time. My wife and I thought that the chemistry equivalent of poetry fridge magnets would be the perfect Christmas gift for him. The concept is pretty simple, find a set of molecules that are interesting, then imprint their molecular model in some aluminum flat bar and stick some magnetic strips to the back.

In honor of the kitchens they end up in, here is our recipe:

1  –   1″ x 1/16″ aluminum bar, cut to length

1  –   Sharpie marker

1  –   polymer magnetic strip, cut to length

1  –   1/8″ letter/number metal stamping set

Find a set of molecules that you find interesting and figure out their molecular models. Draw them out to scale on a sheet of paper to make sure they fit on the bar stock.

Cut each medallion to length from the aluminum bar with a hacksaw. Leave yourself a little extra around the edges for a cleaner look. Make sure the cut is square to the bar stock and be sure to debur the edges with either a file or a deburring tool.

Plan out the lettering on each medallion by drawing the letters out with the Sharpie marker. My wife figured out this cool trick: press down on the aluminum with the stamps and it will leave the slightest ghost of the image, then trace that with the marker.

Glucose Medallion Before Stamping

Glucose Medallion Before Stamping

Imprint the letters on the surface of the medallion with the metal stamps and a hammer. Use a steel bar as a backing when stamping to make sure the aluminum doesn’t stretch and draw. (drawing is when the edges of the metal curl upward and the spot where the die is struck forms a bowl shape). Wash the marker off with rubbing alcohol or nail-polish remover.

Finish the surface of the medallion whichever way looks good to you. Aluminum can be worked with fine-grit sandpaper to make a brushed finish, hit with a steel wire wheel to give a rough finish, or polished until it shines.

Stick the self-adhesive side of the polymer magnet to the back of each medallion. Make sure the magnetic strip doesn’t delaminate by stacking the finished medallions in width order (widest on the bottom) and clamp the stack to a table for 24 hours or more. Use cardboard to keep from marring the surface.

Refrigerator Magnets!

Refrigerator Magnets!

That was my project day!

If you liked this project, check out some of my others:

Featured Artist Nameplates

Wooden Time Machine

Set your Creativity Adrift

Did you like It’s Project Day? You can subscribe to email notifications by clicking ‘Follow’ in the side bar on the right, or leave a comment below.


Salvage – It’s Not Just for Sinking Boats

What do you do when your beloved printer, scanner, blender, or remote controlled car breaks? I’m glad you asked because this weeks’ post is about salvage. I’m going to use my experience to help you quickly sift through the junk and help you find the good stuff.


( sal-vij )  – To rescue or save from fire, shipwreck, danger, etc.

In this sense of the word, I mean “to rescue the engineering from broken devices.” I know that seems a simple, but confusing turn-of-phrase, but I’ll break it down into two parts. First, I disassemble broken devices or more broadly, devices that people don’t want any more, so I’m not contributing to waste and I’m squeezing just a little more utility out of it than it would normally have. Second, I’m taking away from the device the engineering knowledge that I can glean from the arrangement of parts and the parts themselves to use in my own projects. From when I was a kid, I thought taking things apart was kind of a puzzle and still do. Since I’ve earned my degrees in engineering, I also look at each product I disassemble as a lesson in ‘continuing education’.

wpid-img_20140724_190319.jpgAmazing Little Peristaltic Pump Salvaged from an Inkjet Printer

You wouldn’t think about it just by looking, but a lot of engineering goes into the devices we use on a daily basis. Take a ‘simple’ motor for example, its an assembly of no fewer than 6 different materials brought together using additive (casting), subtractive (punching, machining, and polishing), and forming (sheet metal rolling, bending, and wire winding) methods which takes into account electricity, magnetism, thermodynamics, fluid dynamics, and mechanics. So why did the engineers that brought this product together select this motor? What are its special properties? Is it fast? Lots of torque? High voltage (low current)? What about the arrangement of the components? What decisions did the designers make to save money? What cleverness went into making the movement? What about specialty materials like the nichrome wire in toasters? I ask these questions almost reflexively when I take a look ‘under the hood’.

wpid-img_20140723_062032.jpgPrinter / Scanner Combo Destined for the Trash

To help illustrate the process I use to salvage, I’ll refer to a tear-down I did recently of a HP combination inkjet printer and scanner that had stopped printing, given to me by my friend Farzan.

Before I start taking a product apart, even before I bring it home, I try to figure out what parts I’m going in for. Lets face it, with places like Best Buy taking old electronics to recycle the e-waste, it’s far better for the environment to take it in than take it apart. (Maybe a peek inside the case before you take it in wouldn’t hurt) At the same time, also learn to recognize when something has no redeeming value and send it on its way. With the inkjet printer, I was sure from my experience stripping down other flatbed scanners that I’d find at least one stepper motor inside, a linear guide, and maybe a photogate or two. Knowing what you expect to find will inform how aggressively you can take the product apart. What I actually got out of the inkjet printer leads me to salvaging lesson number 1: When you salvage for parts, you don’t always get what you were expecting.

wpid-img_20140723_063139.jpg wpid-img_20140724_181056.jpg
DC Motor with Integrated Encoder
Strange USB Adapter and Wifi Card

I was really just blown away by how many interesting, useful things I was able to get out of this printer/scanner: 3 motors (1 with a linear drive belt and another with a built-in encoder), a fully enclosed dual-voltage 12V & 32V power supply (low current), screen with faceplate and bevel that I might be able to repurpose, peristaltic pump with bleed valve and drive gearing, wifi adapter card for experimentation (maybe), springs, rollers, USB cable adpater, button-cell battery holder, several photo gates, a pane of glass, and an SD card adapter. I already have two projects in mind using some of these components.

Always exercise caution when taking an unknown device apart. Since you didn’t design it, you have no way to know what’s in it. The watch-outs I’ve seen are: springs that are stretched or compressed, so they go flying when they slip, unknown lubricants that get everywhere, glass and other pointy / sharp things, and the occasional glass tube filled with a gas. Especially when taking apart flatbed scanners, take care with the lightbulb which I think has mercury in it, but is only marked with the “Do not throw away” symbol. As a mimimum, I recommend safety glasses, but gloves and a well-ventilated area might also be a good idea. So, salvaging lesson number 2: Safety first… even though it’s mentioned second.

wpid-img_20140724_180635.jpgAlways Check Under the Stickers for Those Last Few Screws

Disassembly seems pretty straightforward, but a lot of the ease I have comes from experience. Over the dozens of products I’ve disassembled, I’ve dealt with glues, screws, tabs, catches, springpins, retaining rings, and press-fits, so I know how to recognize how a thing is held together. If you want the product to go back together, start your disassembly process with some pictures and continue taking them throughout. Next, if you’re salvaging for parts, I recommend only taking one part off at a time, when you do that, you get a better understanding of how the parts went together. Start by removing the screws because they are always obvious, but look before you pull pieces apart. A lot of the times, screws are used with tabs or slots or other things that make it easy for the assembly line worker (or robot) to slap parts together, but not easier for you to take apart. On the printer, for example, there were some screws hidden under stickers and some removable components.

The first question I ask myself when I get a device open is “How does this thing work?” Seeing how the components are arranged and how they work together will help you understand the general operation of the device. This will help you figure out which parts you want to keep, find the parts you want, and help you understand the decisions that went into the design.

During this ‘inspection phase’ is where the whole thing becomes a fun puzzle for me. Did the designer make the same arrangement choices I would have? Did they choose the same kinds of parts I would have chosen? Why is that part black and the others white? Is there something special about that connector or this wire or the thickness of the plastic? In general, recognizing differences and figuring out why it’s different is the name of the game. I found a lot of interesting things inside the HP printer. It had a peristaltic pump I wasn’t expecting, included no stepper motors (I was shocked), had a fully-enclosed DC power supply inside the printer case (like Russian nesting dolls), and had a USB jumper that went from a mini B USB port on the board to the standard B port on the case. All of these things were very surprising. I was also in awe of the sophisticated mechanisms used to drive the printing process: I found that through a set of clutches and sliders, the two motors in the printer were able to control two discrete roller movements to draw up the one sheet of paper and keep it moving smoothly past the print head while in a completely different mode, drive the peristaltic pump to (I assume) clean the print heads when they are in the home position. Just remarkable! That makes lesson number 3: If all you get out of a disassembly is the knowledge of how things are put together, then you win.

wpid-img_20140723_062901.jpgNatural Environment of DC Motors

Once you’ve convinced yourself that a part is useful, make sure to take a picture of it in its ‘natural environment’ before diving in. This reference will be a huge help later when you try to build with it. Also, consider what components are upstream and downstream of it. I pulled several motors out of the printer and with those, I had to consider if there was a motor controller built into the circuit board for me to use or if the mechanical linkage on the shaft was useful. Finally, after you pull the component out, make sure you don’t have to save the mounting hardware. I’ve spent many, many hours trying to find the right screw to fit the thread pattern and length on the end-cap of many DC motors, so take some advice and save the mounting hardware. Lesson 4: Save the screws.

After you’ve learned all you need to learn and taken all there is to take, what happens to the left-overs? Depending on what was removed and how much is left, there are lots of options. Generally speaking, I want to consider the environment as much as possible, so my hierarchy for disposal is: reuse, recycle, and then toss if you have to. In the case of computers and peripherals like this printer, if you only take one or two things like a motor or something, you can still button it all back up and turn it in at places like Best Buy and they’ll recycle the e-waste. If all you have are a few body panels, it would be okay to recycle them or throw them out if necessary (that’s what would happen to them if they went to Best Buy anyway). Take care not to throw out anything hazardous like that mercury lamp I mentioned earlier or batteries, etc. For those, check with your waste management company to find out how to dispose of those properly.

That was my project day, how was yours?

Did you like It’s Project Day? You can subscribe to email notifications by clicking ‘Follow’ in the side bar on the right, or leave a comment below.