“Unable to find vcvarsall.bat” error when trying to install lxml

I needed the lxml library on a machine for some python script that I coded earlier. I tried using easy_install by doing

easy_install lxml

but then I got the following error:

Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3.3
Downloading http://lxml.de/files/lxml-2.3.3.tgz
Processing lxml-2.3.3.tgz
Running lxml-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\edin\appdata\local\
Building lxml version 2.3.3.
Building without Cython.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt
warning: no files found matching 'lxml.etree.c' under directory 'src\lxml'
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxml'
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml'
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxml'
warning: no files found matching 'etree_defs.h' under directory 'src\lxml'
warning: no files found matching 'pubkey.asc' under directory 'doc'
warning: no files found matching 'tagpython*.png' under directory 'doc'
warning: no files found matching 'Makefile' under directory 'doc'
error: Setup script exited with error: Unable to find vcvarsall.bat

I tried installing libxml2 and libxslt, but it resulted in similar errors.

Searching for libxml2
Reading http://pypi.python.org/simple/libxml2/
Couldn’t find index page for ‘libxml2’ (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for libxml2
Best match: None
Traceback (most recent call last):
File “C:\Python27\Scripts\easy_install-script.py”, line 8, in
load_entry_point(‘setuptools==0.6c11’, ‘console_scripts’, ‘easy_install’)()
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py”, line 1712, in main
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py”, line 1700, in with_ei_usage
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py”, line 1716, in
File “C:\Python27\lib\distutils\core.py”, line 152, in setup
File “C:\Python27\lib\distutils\dist.py”, line 953, in run_commands
File “C:\Python27\lib\distutils\dist.py”, line 972, in run_command
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py”, line 211, in run
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\com
mand\easy_install.py”, line 434, in easy_install
File “C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\pac
kage_index.py”, line 475, in fetch_distribution
AttributeError: ‘NoneType’ object has no attribute ‘clone’

In one of my previous posts I pointed out how you can solve a similar problem with a missing vcvarsall.bat error, but unfortunately that approach did not solve my problem. Compiling the sources from the ground up was a too intensive job (which I might try to figure out in the future), so I chose the easy path.

The issue was solved by installing these packages from this site which lists a lot of (unoffical) Windows binaries for Python. Everything suddenly started to work as it should. ūüôā

Cannot Install Microsoft .NET Framework 3.5 SP1

There might be several reasons as to why you can’t install the .NET Framework. I had the problem while installing the framework via the Windows Update.

While trying to install¬†Microsoft .NET Framework 3.5 SP1 Update for Windows 7 x86 (KB982526),¬†Windows Update told me that the update was unsuccessful and gave me the following “useful” error:

“WindowsUpdate_800F081F” “WindowsUpdate_dt000”

You might also get several other errors similar to the following:

  • an error of type 0x643
  • Microsoft .NET Framework 3.5 (x64) ‘package’: [2] Error: Installation failed for component Microsoft .NET Framework 3.5 (x64) ‘package’. MSI returned error code 1601
  • Microsoft .NET Framework 3.5 (x64) ‘package’: [2] Error: Installation failed for component Microsoft .NET Framework 3.5 (x64) ‘package’. MSI returned error code 1603
  • Microsoft .NET Framework 3.0SP1 (x64) (CBS): [2] Error: Installation failed for component Microsoft .NET Framework 3.0SP1 (x64) (CBS). MSI returned error code -2146762496
  • WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0SP1 (CBS) is not installed
Regarding the installation via Windows Update, you might furthermore experience problems with installing Windows Internet Explorer 9 for Windows 7 by getting an error similar to this:

“WindowsUpdate_00009C47” “WindowsUpdate_dt000”

It strongly depends on the situation and your system but you might try one of the following solutions:

  • You can first try to install the¬†System Update Readiness Tool for Windows 7 which is an August 2011¬†release (KB947821¬†– 32-bit (x86)) at this moment of writing. This should solve any inconsistencies in the Windows servicing store¬†which may prevent the successful installation of future updates, service packs, and software. There is also a 64-bit version for Windows 7. Windows Vista: 32-bit¬†(x86), 64-bit (x64).
  • If you’re not using Windows Update, then you can try to download and install the framework manually:¬†Microsoft .NET Framework 3.5 Service Pack 1.
  • There is also a newer version of the framework which most newer applications use which might also suffice:¬†Microsoft .NET Framework 4 (Web Installer).
  • Another thing that you can try on top of all the above is to first remove all the existing .NET framework versions. Do it via Add or remove programs from the Configuration Panel. You can also try the¬†.NET Framework Cleanup Tool.
  • Do the following: Start > Run > type “services.msc”. Now check whether the Startup Type¬†of¬†Windows Installer is set to Manual.
  • Go to¬†Start > Control Panel > Programs > Turn Windows features on or off.¬†Check now that the Microsoft .NET Framework 3.5.1 is checked on.
  • Disable any security/antivirus software while trying to install. Usually this shouldn’t give problems, but it’s worth a try.
If you still didn’t fix your problem, you can start a discussion in the comments below. If you fixed it in another way, then please share it and I’ll add it to the list above.

“LaTeX source files more than 5 years old!”

Got this compile error from LaTeX today and I really don’t have any idea what is exactly going on.

This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8)
Running miktex-pdftex.exe...
This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8) (INITEX)
entering extended mode
("C:\Program Files\MiKTeX 2.8\tex\latex\config\latex.ini"
("C:\Program Files\MiKTeX 2.8\tex\latex\base\latex.ltx"
("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\texsys.cfg")
./texsys.aux found

\@currdir set to: ./.

Assuming \openin and \input
have the same search path.

Defining UNIX/DOS style filename parser.

catcodes, registers, compatibility for TeX 2,  parameters,

! You are attempting to make a LaTeX format from a source file
! That is more than five years old.
! If you enter <return> to scroll past this message then the format
! will be built, but please consider obtaining newer source files
! before continuing to build LaTeX.

! LaTeX source files more than 5 years old!.
l.545 ...aTeX source files more than 5 years old!}

No pages of output.
Transcript written on latex.log.
miktex-makefmt: miktex-pdftex.exe failed on latex.ini.
initexmf.exe: The operation failed for some reason.
initexmf.exe: Data: C:\Program Files\MiKTeX 2.8\miktex\bin\miktex-makefmt.exe
I can't find the default format file!

However, I did find a workaround that seemed to solve the problem and I decided to share it. Perform the following steps:

  1. Open “C:\Program Files\MiKTeX 2.8\tex\latex\base\latex.ltx” (or wherever your latex.ltx resides). One alternative path that is different from mine is “C:\Program Files\MiKTeX\miktex\bin\tex\latex\base”.
  2. Find “\ifnum\count@65>” and change it into “\ifnum\count@>100” (or some number larger than 100)
  3. Save the file.

The real problem is not fixed, but at least you should now be able to compile your files.

Note that in Windows Vista and Windows 7 you’ll have to have administrator access to be able to overwrite this file since Program Files is a system directory. One way to accomplish this is to simply copy the file to let’s say the desktop, edit it, and then overwrite the original file with the edited file.

Restore Outlook Account Settings From Second Drive

In some strange situations it might occur that you want to recover your Outlook Account Settings from an old drive or partition on which you are unable to boot in Windows (or you just don’t want to). Unlike the Outlook mails which are stored in a PST file, the Outlook account settings are located in the Windows Registry. If you haven’t deleted your Windows files it is possible to access certain registry keys so that you can export all the account settings information and import it in your current registry.

This tutorial applies for Outlook 2007, but it might also be usable for Outlook 2003 and Outlook 2010.

Continue reading Restore Outlook Account Settings From Second Drive

How to Recover Lost or Deleted Partitions

Here I will describe how to recover lost or deleted partitions with a cool tool called TestDisk that I recently found with which

I successfully restored my own broken partition. The tool is OpenSource and is licensed under the terms of the GNU General Public License (GPL).

Symptoms and problem description
You are not able to boot your hard drive because the partition is damaged or deleted and you want to recover all your files.

Multiple recover options
There are a few ways to fix the problem since it depends on your specific situation and what options we have available.

If your lost partition is on a second drive that is also plugged in, like it was in my case, or you have a working partition on your hard drive that you can boot normally (while the damaged/deleted partition is on the same drive) , then read Recover partition from a booted working partition.

It is very possible that your only partition that you used to boot became corrupted and you don’t have a second working hard drive available. In that case you can use a Live CD by following the steps described in the part¬†Recover partition by a Live CD.

Recover partition from a booted working partition
Your best way to recovery is from an already booted OS (Windows/Linux/Mac). You can download TestDisk from here. In the following description I will use TestDisk version 6.11.3 and show the recovery steps that may include some Windows specific details. This should be¬†analogous to other versions and OS’es.

  1. After you have extracted the downloaded file, run TestDisk from your extracted testdisk folder (win/testdisk_win.exe).
  2. Now follow the TestDisk Step by Step instructions that are described on the TestDisk wiki page.

Recover partition by a Live CD
You might not be able to boot anything since you don’t have another working partition. In that case you can use a Live CD that will basically boot in memory after which you can start TestDisk without having to boot an operating system. Hence:

  1. Download and then burn the TestDisk Live CD on an empty CD, insert it in your machine and boot from it. *
  2. Now you can basically follow the same TestDisk Step by Step instructions as if booted from an OS.

* Note that you have to setup your BIOS such that your first boot option is your CD/DVD drive. In case your first boot option is your hard drive, the Live CD will not boot up!

Keep in mind
Keep also in mind that you have to be careful when performing the above described operations. Don’t overwrite or fully format the partition if you want to be able to recover your partition and files. Also note that there may be various situations that you can encounter that are not covered by this tutoriol, and hence I cannot be held responsible for any consequences that might occur after you decide to use the tool. It should not get dramatic, but keep in mind anyway that you use it at your own risk.

Windows 7 Login Error “The referenced account is currently locked out and may not be logged on to”

Today I started my desktop PC and when I wanted to login I got an unexpected Windows message:

The referenced account is currently locked out and may not be logged on to.”

I retyped my username and password without thinking much about it, but it showed again the same message. Even after rebooting the PC, the same message was visible every time. A few minutes I sat and thought about it, but then suddenly I figured out what the real problem was.

Some time earlier I was testing some stuff and changed the domain and computer name of the PC to that of my laptop. So basically, both machines were connected to the network with the same name on the same domain, and that was the obvious problem.

So the problem was clear, and the solution simple. I just had to change the computer name and everything should be fine again, but the problem was that I was unable to login on my PC since my laptop was also running. I switched off the wireless adapter of the laptop, but it didn’t help. I had to switch off the PC wireless adapter, restart the machine and login. After changing the computer name and restarting again, the problem was resolved.

To summarize everything, if you get the same error, it might be the case that two machines are using the same name on the same domain, as was in my case. You should proceed as follows:

  1. If you cannot login to Windows because you are getting the above mentioned error, switch off the wireless adapter, unplug your¬†Ethernet¬†cable or turn off the router and then (re)start your machine and login to Windows (so the machine shouldn’t be connected to the network/internet).
  2. After you have logged in, make sure to change your computer name to some unique name that is accepted by the domain (or fix some other issues if you are experiencing another similar problem).
  3. Now connect again to the network/internet and restart your machine.
  4. You should be able to login again as usual.

Windows Live Essentials Uninstaller

It is now exactly a year ago since I released Windows Live Messenger Uninstaller and mentioned planning to build a “more general remover for the Windows Live series“. The time has finally come for a public release of Windows Live Essentials Uninstaller. But first, a few things I have to mention about WLMU.

Windows Live Messenger Uninstaller was an unexpected success and showed that many people were experiencing the same stated problem and were looking for a decent and quick solution.  Almost everyone that I got a reaction from, either through mails, comments or other sites, claimed to have successfully solved the problem by removing Windows Live Messenger with WLMU.

Until now I have tracked some statistics about the downloads on WLMU and can proudly say that in a year time, the tool has been downloaded more than 30.000 times from my site alone! I’m very glad to see that so many people have found the tool useful. This was one of the main reasons for me to publish a follow up tool, which I will describe in some detail below.

Windows Live Essentials Uninstaller
Windows Live Essentials Uninstaller scans the system and tries to find Windows Live Essentials products that were installed during the setup. If any products were found, it presents them in a list from which you can choose to remove or repair such a product.

WLEU is hereby published as a first public version 1.2.1 and is, as I mentioned earlier, a direct follow up of the tool WLMU. WLEU is built on the same principles as was the case with WLMU and therefore again uses the product’s CLSID with Windows Installer to accomplish a clean removal. Refer to the changelog below for specific changes that were made.

You can download the tool from the following link:

Download Windows Live Essentials Uninstaller 1.2.1 (837kB)

MD5 hash: 1512df1cadd7c804957d2d83f380659b

The tool is very simple to use. If it finds any WLE components it will give you a list from which you can select the component you want to uninstall/repair.  You will also get a generated command that you can use to manually remove it. When you press UNINSTALL or REPAIR,  the tool will run the command automatically for you.

Note: This software comes with absolute no warranty! By using this program you agree that I am not responsible for anything caused by this software whatsoever.

Future releases
If you have any comments, suggestions or bugs, please put them here in the comments or contact me by mail. If it is useful/serious I will add/fix it in the next release.

{First public version 1.2.1}
+ Added new WLE component trace scan
+ Added uninstall finish confirmation
+ Added Setup, Boot and Display options
+ Added component information: Version, Install Date, Local Package, Install source and Product ID

Calling external programs from Python

The story
I’m currently automating a certain process with a Python script that needs to call external programs with some specific parameters. An additional problem is with this letter s in the word parameters, for my external call requires an execution with more than one argument.

I tried the os.system call but unfortunately it didn’t work on my system because the function was apparently not present. This conclusion followed after I got the error “ImportError: No module named system”. Instead of resolving this error, I¬† decided to dig into google for some alternatives.¬† And I did succeed, when I met the lovely miss subproccess. ūüôā

Let subprocess do all the calls
To keep it short and skip the syntax explanation, learn from the following example:

import subprocess
subprocess.call(‘expand catalog-web.cab -F:* -r’, shell=True)

As you can see, the magic only happens when you pass the string (your complete command) together with the shell=True option.

Happy Python calling. ūüôā

Extract Microsoft CAB Files in Windows

In short
To extract Microsoft CAB files, you can use the expand command in command line as follows:

expand cabfile -F:* path

which will extract all the files from the cabfile in the give path. For example

expand en-catalog-web.cab -F:* c:\expanded

Single files
I experienced problems with extracting a cab file where within a single xml file was stored. I found out that renaming the files after extraction can solve the problem. This is done by doing the previous example with an -r option:

expand en-catalog-web.cab -F:* c:\expanded -r

Extracting all the files to the current working directory can be done as follows:

expand cabfile -F:*  -r

Google Instant not working in Firefox

Identifying the problem
Since a day or two I noticed that the auto-complete search field on Google was not working in Firefox (version 3.6.9 at least). Another problem that I was facing was that the Settings link was not working. Change background image was also missing (not that I ever use it).

My first intuition was that some plugin was updated and was causing the error. After disabling all the plugins and restarting firefox, the problem was still present. Some digging in the Error console in Firefox brought up the following error, which of course is causing all the unhappiness:

Error: uncaught exception: [Exception… “Security error” code: “1000” nsresult: “0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)” location: “http://www.google.com/extern_js/f/CgJlbiswRTgBLCswWjgALCswDjgALCswFzgALCswJzgELCswPDgALCswUTgALCswWTgOLCswCjh_QC8sKzAWOAAsKzAZOCAsKzAhOD9AASwrMCU4z4gBLCswKjgLLCswKzgRLCswNTgELCswQDgTLCswQTgFLCswTjgGLCswVDgBLCswYzgALCswHThXLCswXDgXLCswGDgALCswJjgOLIACGZACGw/SdYmPxFHWrc.js Line: 114”]

So the problem is really with this Google script that you cannot do much about, but there is a workaround however that I will describe below.

Disabling DOM storage workaround
I came across a few pages [1][2] where the same problem is discussed and where a workaround is proposed. The solution is that you have to disable DOM storage in the configuration options in Firefox. You can do it as follows:

  1. Type in a new tab and open: about:config
  2. Then search for dom.storage.enabled and set it to true.
  3. Google instant should be working now.

Just auto-complete
If you just want auto-complete working again, you can visit the preferences page where you can select Do not use Google Instant as your preferred choice.

Note that Google instant is currently only working on google.com and not for example google.nl or any other country specific domain. So if you just use your countries domain, you can also avoid the problem.

The error seems to be fixed now. It is now wise to switch the dom.storage back to false. ūüôā