I’ve been playing around with Ansible again for an incoming project. It involves Windows, DSC and SQL Server as well, so I needed WinRM available to do anything. Since I last played with Ansible installing pywinrm seems to have got a lot trickier. I followed a number of online guides, and kept banging up against this error:
Error
Downloading/unpacking cryptography>=1.3 (from requests-ntlm>=0.3.0->pywinrm) Downloading cryptography-2.1.4.tar.gz (441kB): 441kB downloaded Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography error in cryptography setup command: Invalid environment marker: python_version < '3' Complete output from command python setup.py egg_info: error in cryptography setup command: Invalid environment marker: python_version < '3' ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography Storing debug log for failure in /root/.pip/pip.log
This is on the Ubuntu/trusty64 image I’m using to build my control node with Packer.
With a couple of hours of bingling around I tracked it down to an issue with python’s setuptools package, which then meant an upgrade was needed to pip itself. The set of steps needed in the end is:
Solution
sudo apt-get install libffi-dev libssl-dev -y sudo apt-get install python-pip -y sudo -H pip install --upgrade setuptools sudo -H pip install --upgrade pip sudo -H pip install pywinrm sudo -H pip install ansible
And this is now giving me a solid install each time, apart from a couple of deprecated warnings that aren’t anything that are going to affect my needs for a while.
Hopefully this will save someone else a day running around various github and support sites.