Frank Ridderbusch


About things, that are of interest to me (in English and in German).


Python easy.install with Chocolatey

In my company I’ve basically completly 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 completly 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.