Python easy.install with Chocolatey

In my company I’ve basically completely moved to the Windows platform. My company is the typical Microsoft shop and since I’m doing more management stuff with slides and “official” documents Linux wasn’t simply an option any more. My company deploys a method to completely remotely install a PC/Laptop with all the required standard set of software. However there are those very nice to have programs like Notepad++, CCleaner or ConEmu, which make life under Windows bearable or if you want to add a programming language like Python or Ruby.

Anyway, for some time I’ve been using Ninite to install and keep my selection of add-ons up to date. Until I learned about Chocolatey from Scott Hanselmans Dev Tool List. As he says: once you start using it, you’ll be hooked. Here are some additional notes from him.

Worked without any major problems for me until I wanted to install Pip after already having install the Python programming language itself. Pip has a dependency on Easy.install, which is installed in the process. However the installation of Easy.install fails for me with this error message:

> cinst easy.install
Chocolatey (v0.9.8.27) is installing 'easy.install' and dependencies. By installing you accept the license for 'easy.install' and each dependency you are installing.

easy.install v0.6.11.4
Setting PYTHONHOME environment variable to 'C:\tools\python2'
PS: PYTHONHOME variable is not required to Python works, but it is a good practice to have it.
Using python home at 'C:\tools\python2'
Installing easy_install for Python(2.7.8)...
Installing setuptools from http://pypi.python.org/pypi/setuptools ...
Using this proxyserver: 172.25.xx.yyy:zz
Downloading easy.install/setuptools 32 bit
  from 'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe'
Using this proxyserver: 172.25.xx.yyy:zz
Write-Error : easy.install/setuptools did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\TEMP\chocolatey\easy.ins tall\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\ProgramData\chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:30 char:3
+   Write-Error $errorMessage
+   ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Write-Error : easy.install did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\TEMP\chocolatey\easy.ins tall\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\ProgramData\chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:30 char:3
+   Write-Error $errorMessage
+   ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Write-Error : Package 'easy.install v0.6.11.4' did not install successfully: Exception calling ".ctor" with "2" argumen t(s): "Could not find a part of the path 'C:\TEMP\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe '."
At C:\ProgramData\chocolatey\chocolateyinstall\functions\Chocolatey-NuGet.ps1:90 char:17
+                 Write-Error "Package `'$installedPackageName v$installedPackageV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Finished installing 'easy.install' and dependencies - if errors not shown in console, none detected. Check log for error

Apparently there is something wrong with the path setup for download and installing the setuptoolsInstall.exe executable.

I circumvented the problem by executing the following steps. I installed wget via Chocolatey, simply for the fact, that I’m familiar with it. You’ll be able to achieve the same results by using other Windows native tools, you are familiar with.

 > cinst wget

Then I changed to the temporary installation location used by Chocolatey for easy.install and created another easy.install directory and changed into it.

> cd c:\temp\chocolatey\easy.install\setuptools
> mkdir easy.install
> cd easy.install

Your working directory should now be

C:\temp\chocolatey\easy.install\setuptools\easy.install

Notice the 2 easy.install directory components. Now download the setuptools package via wget into this directory under the name setuptoolsInstall.exe. Depending on your location within the larger network, you might additional need to configure the proxy server either in the environment or via additional command line options.

> wget --no-check-certificate -O setuptoolsInstall.exe http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe
> dir

Directory: C:\temp\chocolatey\easy.install\setuptools\easy.install

Mode  LastWriteTime    Length Name
----  -------------    ------ ----
-a--- 27.08.2014 09:16 227956 setuptoolsInstall.exe

After these steps the installation of easy.install via Chocolatey should succeed normally.

> cinst easy.install

I did all the above steps within a PowerShell window. With cmd.exe you mileage may vary.

Emptying the Basement: My Computer History

I’ve started the process of emptying my basement. There is still stuff there, that I’ve build during my apprenticeship years with the company then called “Nixdorf Computers”, basically my computer roots from more than 30 years ago. To remember everything I photographed every note worthy item. Then I I will junk everything. My computer history started with a NASCOM 1 single board computer using the Z80 microprocessor. According to Internet wisdom, this board was designed in 1977 and then sold from 1978 onwards. The size was about a single A4 paper. I bought my system used from a friend of a friend in early 1981. There is a TheRegister article from 2013 “UK micro pioneer Chris Shelton: The mind behind the Nascom 1” about the creator of the NASCOM. On the second page of the article there is a schematic how the individual components were connected, just as I remember it. Here are two more links of pictures of the NASCOM 1 (1 & 2). There is even a blog about “Working NASCOM Microcomputers in the UK”. I distinctly remember the static RAM chips 2102 with an organisation of 1024 x 1bit. Of these 1k roughly a little more than 800 bytes were left for user programs, which needed to be saved/restored to and from a cassette tape. A 2708 EPROM (1k x 8) contained the NASBUG monitor program. One of my first enhancements was the extensions of the RAM size by doubling it using the 2114 static RAM chips. These chips had a 1024 x 4bit organisation. The original NASCOM board is long gone, however this next enhancement still exists.

Z80 Buffercard
Z80 Buffercard

Z80 Buffercard (Backside)
Z80 Buffercard (Backside)

This contraption replaced the Z80 CPU on the main board and the Z80 CPU moved the 40 pin socket on this extension. The 74LS244 TTL chips are one directional bus driver chips mostly located in the address and other signal lines of the CPU. The 74LS245 TTL chip is a bi-directional bus driver, sitting in the data lines of the CPU. With this extension the CPU lines are low impedance enough that is allowed me to connect the following bus card to the NASCOM motherboard.

Bus backplane
Bus backplane With this bus card

I gradually moved the NASCOM to a number of boards consisting of cards in 100 x 160mm in size. I used a design from the electronics magazine Elektor, which I etched myself.

Multiple Sound Cards under Linux

End of last year, I decided it was time for a hardware update of my desktop computer. I exchanged the Gigabyte GA-P35-DS3 motherboard and the Core2 E6350 processor with an ASROCK Fatal1ty H87 motherboard and an Intel i5-4670 quad core processor.

The reason, why I choose this particular motherboard, are the on-board sound components. ASROCK put a little more effort into the design and the selection of the audio circuitry to achieve a better signal to noise ratio. I can’t compare with other H87 board designs, but compared to my old Gigabyte board this effort has definitely paid off. I’m hearing significantly less noise for instance when the mouse is moved. I guess that’s the best they can do considering that frequencies well into the giga hertz range are at work on a motherboard. The next step up is the use of an external USB sound card. My old Edirol UA1EX USB sound card is once again noticeably quieter than the motherboard sound.

Anyway, the hardware update went with minimal fuss and soon after installing everything the system was up and running again.

The only problem left was a reliable order of all available audio devices (two motherboard devices for standard and HDMI audio, a Webcam with microphone and the Edirol UA1EX). Searching on the internet didn’t supply an immediate solution applicable to my setup.

In the end this article provided the right hints in that the suggestions for the USB sound cards basically also need to be applied to the Intel HD audio driver.

This is my configuration for the ALSA sound system:

% cat /etc/modprobe.d/alsa.conf
…
options snd-hda-intel index=0,1 id=PCH,HDMI
alias snd-card-0 snd-hda-intel
alias snd-card-1 snd-hda-intel

options snd-usb-audio index=2,3 vid=0x0582,0x046d pid=0x0096,0x081d
alias snd-card-2 snd-usb-audio
alias snd-card-3 snd-usb-audio
alias sound-slot-0 snd-hda-intel
alias sound-slot-1 snd-hda-intel
alias sound-slot-2 snd-usb-audio
alias sound-slot-3 snd-usb-audio
…
# Set this to the correct number of cards.

options snd cards_limit=4

This leads to the following reliable order of sound devices:

% cat /proc/asound/cards                                                               
 0 [PCH            ]: HDA-Intel - HDA Intel HDMI
                      HDA Intel HDMI at 0xf0534000 irq 45
 1 [HDMI           ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf0530000 irq 46
 2 [UA1EX          ]: USB-Audio - UA-1EX
                      EDIROL UA-1EX at usb-0000:00:14.0-8, full speed
 3 [U0x46d0x81d    ]: USB-Audio - USB Device 0x46d:0x81d
                      USB Device 0x46d:0x81d at usb-0000:00:1a.0-1.6.2, high speed

There is a Linux dependency with the above. Before Linux 3.11 or 3.12 the HDMI sound device was actually called MCH if I remember correctly.

Linux 2.6.33

Shortly after Linux 2.6.33 was released the respective Gentoo kernel sources became available as well. Curious as I am, I decided to give the new kernel a quick whirl, possibly in the hope that my Pulseaudio<->ALSA problem might be fixed.

I tried this with my PC at work, which is equipped with an old GeForce FX 5200 Nvidia graphics card. To get the kernel with that card going, the legacy Nvidia driver 173.14.25 is required. In the current Gentoo Portage tree unfortunately there is only 173.14.22. That is not too much of a problem however. As a very Quick’n Dirty solution simply copy nvidia-drivers-173.14.22.ebuild to nvidia-drivers-173.14.25.ebuild, execute

ebuild nvidia-drivers-173.14.22.ebuild digest

and then emerge the driver, after you have compiled the 2.6.33 kernel.

The Pulseaudio<->ALSA problem however is not fixed, although it appears to take longer until the problem shows up. What is worse, my previous workaround (compiling the ALSA 1.0.20 driver and install the modules over the kernel modules) does not work any, since the ALSA driver won’t compile with the new kernel, since some include files have been moved in the kernel tree.

So I guess I’ll stay with kernel 2.6.32 for the time being until I receive my new PC in the not to distant future.

Comparing analog and digital radio on the cable.

Out of curiosity I decided to compare the audio quality of a local radio station (1Live), which I can receive in analog and in digital via my local cable operator. The privately owned radios on the cable are encrypted and can only be received with the appropriate CA Module and a SmartCard for the DVB-C card. The publicly funded station are however available unencrypted.

I use these two cards to record the audio from DVB-C (the first) and for the analog broadcast (the second):

05:00.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
    Subsystem: KNC One Device 0022

05:02.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Hauppauge computer works Inc. WinTV Series

Comparison Digital & Analog Volume

This first picture compares the volume levels. The above half is from the digital broadcast and the lower half from the analog broadcast, both showing about 1 hour from the same show. Both recordings are normalized to -0.2db of maximum level with Audacity.

As you can see, the analog broadcast has a certain dynamic range left, while the digital broadcast is completely flat. Apparently, the signal, which is used to create the digital stream is passed through a compressor, which reduces the dynamic range to a minimum. Not very nice. Apparently not every station does this compressor thing. Another station from Berlin I’m occasionally listening to in digital has a lot more dynamic range left.

Noise

This next picture provides a detailed waveform view. The upper shows a very clean signal from the digital broadcast, as is to be expected. On the lower half the noise is apparent in the analog broadcast, which is overlayed on the normal signal. An analog broadcast simply can’t provide the same absolute maximum dynamic range as a the digital signal can. Another problem probably is, that the old BTTV TV-card doesn’t carry very high quality electronic components, which adds to the level of noise.

Frequency Range

The last picture compares the frequency ranges, which each broadcast type offers. There is nothing much left above 15KHz. In the analog broadcast the peak at 19KHz is stereo pilot signal used to indicate stereo broadcasts. This is not a usable audio signal.

Our local cable operator is trying pretty aggressively to get new customers and are trying to convince the customers of the advantages of digital TV and radio. From the above pictures the digital advantage is not really visible, except maybe for the better signal-noise ratio. Additional problem is the requirement of SmartCards, if you want to listen to private radios. With the digital receiver provided by the cable operator, where you insert the SmartCard, you can either watch TV or listen to radio, not both at the same time. So, the remaining receivers in the house hold need to use the analog signal anyway. Who would spend another 5€ per month for another SmartCard?

Fixes for ACPI wakeup and X11 resolution switch

I wrote here, that since my switch to Linux kernel 2.6.32 the ACPI wakeup didn’t work anymore. After a new search through the internet I came across this article mentioning a conflict with the HPET. As a workaround booting with hpet=disable is suggested.

And indeed with this workaround ACPI wakeup works again. Looking at the output of cat /proc/driver/rtc

rtc_time    : 11:44:20
rtc_date    : 2010-02-17
alrm_time   : 07:21:16
alrm_date   : ****-**-17
alarm_IRQ   : no
alrm_pending    : no
24hr        : yes
periodic_IRQ    : no
update_IRQ  : no
HPET_emulated   : no
DST_enable  : no
periodic_freq   : 1024
batt_status : okay

the HPET_emulated line should report no.

Another fix was released with the xorg-server 1.7.5. Since the switch to xorg-server 1.7 I was basically unable to switch from the X11 display running with 1600×1200 resolution to a virtual console. Switching to a virtual console resulted in a dark display complaining about illegal operating parameters. This was particular annoying, when shutting the system down.

As a workaround with earlier xorg-servers I switched X11 resolution to 1280×1024 with “Ctrl + Alt + Keypad -” and then switched to a virtual console. Now the virtual console was operable.

The fix for xorg-server 1.7 was announced in this email. Unfortunately stupid me didn’t think about the xfce4-display-settings utility (I’m a XFCE4 user), then I would have been able to switch resolutions graphically.