Musings of a Data professional

Stuart Moore

pywinrm install fail – error in cryptography setup command: Invalid environment marker: python_version < '3'

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.

Previous

Nottingham and East Midlands PowerShell User Group

Next

T-SQL Tuesday #97 – What I’ll be working to improve in 2018

3 Comments

  1. angel

    Thank you for the solution. It saved me a lot of times and investigation.

  2. Toto

    Thank you for sharing the workaround. Much appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress & Theme by Anders Norén