# Crypto Error On Ansible Playbook Start

**URL:** <https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773>\
**Category:** Ansible Developer\
**Created:** [October 11, 2016, 9:23pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773 "2016-10-11T21:23:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve5](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@steve5](https://forum.ansible.com/u/steve5)\
**Post date:** [October 11, 2016, 9:23pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773/1 "2016-10-11T21:23:05Z")

</div>

I am on the devel branch of ansible and I just started getting this when I went to that branch:

`  
[WARNING]: Optional dependency ‘cryptography’ raised an exception, falling back to ‘Crypto’

`

Probably something I need to install, just not sure what I need to install. Maybe I missed some docs though too. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![steve5](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@steve5](https://forum.ansible.com/u/steve5)\
**Post date:** [October 11, 2016, 9:26pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773/2 "2016-10-11T21:26:53Z")

</div>

Just for more information, this didn’t error out, it still ran my playbook, just noticed the warning and wasn’t sure if I needed to install something or if I could get rid of the warning in some manner. Thanks!

---

<div class="post-metadata">

**Author:** ![alikins](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@alikins](https://forum.ansible.com/u/alikins)\
**Post date:** [October 12, 2016, 2:08pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773/3 "2016-10-12T14:08:04Z")

</div>

The warning message there is a little vague, especially considering  
the names involved ('cryptography' and 'Crypto').

The gist is that importing the python 'cryptography' module failed.  
More than likely because it is not installed.

To install it:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'pip install cryptography'

Running in debug mode will show the stack trace (along with lots of other info):

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ANSIBLE\_DEBUG=1 ansible-playbook \<... your args here ...\>'

Looking at git history, it looks like the error message is a little  
vague because the import can fail for a few different reasons.

I'll take a look at a better error message. I'll also see if it makes  
sense to make that use '-vvv' to show the details  
instead of debug.

---

<div class="post-metadata">

**Author:** ![Jon\_Stanley](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@Jon\_Stanley](https://forum.ansible.com/u/Jon_Stanley)\
**Post date:** [October 12, 2016, 3:45pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773/4 "2016-10-12T15:45:25Z")

</div>

This helped! I'd been running into the same thing with Ansible in a  
virtualenv on EL7. Turns out that there was an ImportError because  
cryptography required a newer version of setuptools. Why this wasn't  
updated when cryptography was installed, I'm not sure - I'm far from a  
pip master 🙂

---

<div class="post-metadata">

**Author:** ![steve5](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@steve5](https://forum.ansible.com/u/steve5)\
**Post date:** [October 13, 2016, 9:55pm UTC](https://forum.ansible.com/t/crypto-error-on-ansible-playbook-start/22773/5 "2016-10-13T21:55:45Z")

</div>

Interesting for me, as I have this in a Dockerfile to install the dependencies, I found that I need to do a pip install cryptography after I installed the source. I previously had the pip install step prior to the source install from git but once I moved that to after I no longer get this error. Thanks!
