Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having trouble adding a Mercurial VCS root to a TeamCity Project. When I enter the repository information and click 'Test Connection' the pop-up says 'Connection Failed', shows me a message 'stderr: abort: couldn't find mercurial libraries in [...', ending with the message '(check your install and PYTHONPATH)'.

I am able to copy and paste the command from the error pop-up to the command line and mercurial works as expected. I have read that TeamCity should have no problem using Mercurial if it is working from the command line.

I have attempted to export the PYTHONPATH environment variable directly in the and the with no change after restarting TeamCity. I have also been very careful to ensure the hg executable used by TeamCity is the same one being used on the command line.

What am I missing?

share|improve this question
up vote 2 down vote accepted

I was able to get help from Jet Brains on this issue and TeamCity needed to be patched to pull in the proper environment variable. More information can be found here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.