# Issue with fresh monolith deployment

**URL:** <https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982>\
**Category:** Developers\
**Created:** [July 18, 2023, 1:36pm UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982 "2023-07-18T13:36:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![erobinson](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/erobinson/32/2652_2.png) [@erobinson](https://forum.dimagi.com/u/erobinson)\
**Post date:** [July 18, 2023, 1:36pm UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/1 "2023-07-18T13:36:43Z")

</div>

During the installation as per this: [Install Using Commcare-Cloud on one or more machines — CommCareHQ Deployment documentation](https://commcare-cloud.readthedocs.io/en/latest/installation/2-manual-install.html)  
The installation fails during the first time deployment at

`TASK [bootstrap-users : Add public keys for current devs]`

with

`An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'`

From what I can see, this could be a compatibility issue between the python cryptography and pyopenssl libraries as per [here](https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss)

I have the following versions:

```auto
Name: cryptography
Version: 39.0.2

Name: pyOpenSSL
Version: 23.0.0

```

Any advice? I didn't want to manually start substituting versions before I got feedback.

Thanks!

---

<div class="post-metadata">

**Author:** ![zandre\_eng](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/z/a698b9/32.png) [@zandre\_eng](https://forum.dimagi.com/u/zandre_eng)\
**Post date:** [July 26, 2023, 10:47am UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/2 "2023-07-26T10:47:25Z")

</div>

Hi Ed,

The current requirements for commcare-cloud are for `cryptography~=41.0` and `pyOpenSSL~=23.2`. Could you try doing an update on your commcare-cloud and then update the packages to the newer versions that are reflected in the requirements?

---

<div class="post-metadata">

**Author:** ![erobinson](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/erobinson/32/2652_2.png) [@erobinson](https://forum.dimagi.com/u/erobinson)\
**Post date:** [July 26, 2023, 12:26pm UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/3 "2023-07-26T12:26:05Z")

</div>

Thank you Zandre, I'll try that and revert.

---

<div class="post-metadata">

**Author:** ![erobinson](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/erobinson/32/2652_2.png) [@erobinson](https://forum.dimagi.com/u/erobinson)\
**Post date:** [July 26, 2023, 2:22pm UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/4 "2023-07-26T14:22:14Z")

</div>

Hi @zandre_eng , I did an update-code and confirmed the versions of cryptography (41.0.2) and pyOpsnSSL (23.2.0) but I'm still getting this on first time deployment:

```auto
TASK [bootstrap-users : Add public keys for current devs] ************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
failed: [10.0.0.4] (item=ccc) => {"ansible_loop_var": "item", "changed": false, "item": "ccc", "module_stderr": "Shared connection to 10.0.0.4 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible-tmp-1690381212.6824517-150129-94364565846504/AnsiballZ_authorized_key.py\", line 100, in <module>\r\n _ansiballz_main()\r\n File \"/tmp/ansible-tmp-1690381212.6824517-150129-94364565846504/AnsiballZ_authorized_key.py\", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/tmp/ansible-tmp-1690381212.6824517-150129-94364565846504/AnsiballZ_authorized_key.py\", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ansible.posix.plugins.modules.authorized_key', init_globals=dict(_module_fqn='ansible_collections.ansible.posix.plugins.modules.authorized_key', _modlib_path=modlib_path),\r\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_authorized_key_payload_9nktqfw0/ansible_authorized_key_payload.zip/ansible_collections/ansible/posix/plugins/modules/authorized_key.py\", line 217, in <module>\r\n File \"/tmp/ansible_authorized_key_payload_9nktqfw0/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py\", line 115, in <module>\r\n File \"/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py\", line 50, in <module>\r\n import OpenSSL.SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/ __init__.py\", line 8, in <module>\r\n from OpenSSL import crypto, SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/crypto.py\", line 3279, in <module>\r\n _lib.OpenSSL_add_all_algorithms()\r\nAttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

```

Any ideas what could be causing it?

```auto

(cchq) ccc@myserver:~/commcare-cloud$ pip show cryptography

Name: cryptography
Version: 41.0.2
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page:
Author:
Author-email: The Python Cryptographic Authority and individual contributors <cryptography-dev@python.org>
License: Apache-2.0 OR BSD-3-Clause
Location: /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages
Requires: cffi
Required-by: ansible-core, commcare-cloud, pyOpenSSL

(cchq) ccc@myserver:~/commcare-cloud$ pip show pyOpenSSL

Name: pyOpenSSL
Version: 23.2.0
Summary: Python wrapper module around the OpenSSL library
Home-page: https://pyopenssl.org/
Author: The pyOpenSSL developers
Author-email: cryptography-dev@python.org
License: Apache License, Version 2.0
Location: /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages
Requires: cryptography
Required-by: commcare-cloud

```

---

<div class="post-metadata">

**Author:** ![zandre\_eng](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/z/a698b9/32.png) [@zandre\_eng](https://forum.dimagi.com/u/zandre_eng)\
**Post date:** [July 27, 2023, 9:49am UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/5 "2023-07-27T09:49:14Z")

</div>

Hi Ed,

Looking at the traceback of the error you gave, it seems that the issue is happening from outside the virtual environment. The error therefore stems from the library versions on the OS python install itself, and not in commcare-cloud's runtime environment.

Could you please try running `python3 -m pip install -U cryptography pyOpenSSL` without the virtual environment activated? This will need to be run on each machine in the ansible inventory: `cchq <env> run-shell-command all -b 'python3 -m pip install -U cryptography pyOpenSSL`.

---

<div class="post-metadata">

**Author:** ![erobinson](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/erobinson/32/2652_2.png) [@erobinson](https://forum.dimagi.com/u/erobinson)\
**Post date:** [July 27, 2023, 10:29am UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/6 "2023-07-27T10:29:19Z")

</div>

I'm getting 'no such option: -U'

```auto
(cchq) ccc@myserver:~/commcare-cloud$ python3 -m pip -U cryptography pyOpenSSL

Usage:
  /home/ccc/.virtualenvs/cchq/bin/python3 -m pip <command> [options]

no such option: -U

```

I'm not sure if the command was meant to be pip install:

```auto
(cchq) ccc@myserver:~/commcare-cloud$ python3 -m pip install -U cryptography pyOpenSSL
Requirement already satisfied: cryptography in /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages (41.0.2)
Requirement already satisfied: pyOpenSSL in /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages (23.2.0)
Requirement already satisfied: cffi>=1.12 in /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages (from cryptography) (1.14.6)
Requirement already satisfied: pycparser in /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.20)

```

_EDIT_  
Apologies... I wasn't running it outside the venv. Will revert shortly.  
_EDIT 2_ since this issue has come up before the first time deployment, I'm unable to get an ansible shell. The system still logs in using password. I used sudo su - ansible and ran it there:

```auto
(monolith) ansible@myserver:~$ python3 -m pip install -U cryptography pyOpenSSL
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cryptography in /usr/local/lib/python3.10/dist-packages (41.0.2)
Requirement already satisfied: pyOpenSSL in /usr/lib/python3/dist-packages (21.0.0)
Collecting pyOpenSSL
  Downloading pyOpenSSL-23.2.0-py3-none-any.whl (59 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.0/59.0 kB 2.0 MB/s eta 0:00:00
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/dist-packages (from cryptography) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/dist-packages (from cffi>=1.12->cryptography) (2.21)
Installing collected packages: pyOpenSSL
Successfully installed pyOpenSSL-23.2.0

```

Going to test now...

Unfortunately that hasn't resolved it:

```auto
TASK [bootstrap-users : Add public keys for current devs] ******************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
failed: [10.0.0.4] (item=ccc) => {"ansible_loop_var": "item", "changed": false, "item": "ccc", "module_stderr": "Shared connection to 10.0.0.4 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible-tmp-1690455288.2291405-5065-220532194928638/AnsiballZ_authorized_key.py\", line 100, in <module>\r\n _ansiballz_main()\r\n File \"/tmp/ansible-tmp-1690455288.2291405-5065-220532194928638/AnsiballZ_authorized_key.py\", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/tmp/ansible-tmp-1690455288.2291405-5065-220532194928638/AnsiballZ_authorized_key.py\", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ansible.posix.plugins.modules.authorized_key', init_globals=dict(_module_fqn='ansible_collections.ansible.posix.plugins.modules.authorized_key', _modlib_path=modlib_path),\r\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_authorized_key_payload_uvwm1_6f/ansible_authorized_key_payload.zip/ansible_collections/ansible/posix/plugins/modules/authorized_key.py\", line 217, in <module>\r\n File \"/tmp/ansible_authorized_key_payload_uvwm1_6f/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py\", line 115, in <module>\r\n File \"/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py\", line 50, in <module>\r\n import OpenSSL.SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/ __init__.py\", line 8, in <module>\r\n from OpenSSL import crypto, SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/crypto.py\", line 3279, in <module>\r\n _lib.OpenSSL_add_all_algorithms()\r\nAttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

```

EDIT 3 - if I use deactivate and check with:

```auto
ccc@myserver:~/commcare-cloud$ pip show pyOpenSSL
Name: pyOpenSSL
Version: 21.0.0
Summary: Python wrapper module around the OpenSSL library
Home-page: https://pyopenssl.org/
Author: The pyOpenSSL developers
Author-email: cryptography-dev@python.org
License: Apache License, Version 2.0
Location: /usr/lib/python3/dist-packages
Requires:
Required-by:

ccc@myserver:~/commcare-cloud$ pip show cryptography
Name: cryptography
Version: 41.0.2
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page:
Author:
Author-email: The Python Cryptographic Authority and individual contributors <cryptography-dev@python.org>
License: Apache-2.0 OR BSD-3-Clause
Location: /usr/local/lib/python3.10/dist-packages
Requires: cffi
Required-by: ansible-core

```

I've now run the pip install without the venv

```auto
ccc@myserver:~/commcare-cloud$ python3 -m pip install -U cryptography pyOpenSSL
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cryptography in /usr/local/lib/python3.10/dist-packages (41.0.2)
Requirement already satisfied: pyOpenSSL in /usr/lib/python3/dist-packages (21.0.0)
Collecting pyOpenSSL
  Using cached pyOpenSSL-23.2.0-py3-none-any.whl (59 kB)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/dist-packages (from cryptography) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/dist-packages (from cffi>=1.12->cryptography) (2.21)
Installing collected packages: pyOpenSSL
Successfully installed pyOpenSSL-23.2.0

```

Going to test again...

Unfortunately that hasn't fixed it

```auto
TASK [bootstrap-users : Add public keys for current devs] **********************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
failed: [10.0.0.4] (item=ccc) => {"ansible_loop_var": "item", "changed": false, "item": "ccc", "module_stderr": "Shared connection to 10.0.0.4 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible-tmp-1690456180.77125-5790-212047453903062/AnsiballZ_authorized_key.py\", line 100, in <module>\r\n _ansiballz_main()\r\n File \"/tmp/ansible-tmp-1690456180.77125-5790-212047453903062/AnsiballZ_authorized_key.py\", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/tmp/ansible-tmp-1690456180.77125-5790-212047453903062/AnsiballZ_authorized_key.py\", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ansible.posix.plugins.modules.authorized_key', init_globals=dict(_module_fqn='ansible_collections.ansible.posix.plugins.modules.authorized_key', _modlib_path=modlib_path),\r\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_authorized_key_payload_m7h2xu1j/ansible_authorized_key_payload.zip/ansible_collections/ansible/posix/plugins/modules/authorized_key.py\", line 217, in <module>\r\n File \"/tmp/ansible_authorized_key_payload_m7h2xu1j/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py\", line 115, in <module>\r\n File \"/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py\", line 50, in <module>\r\n import OpenSSL.SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/ __init__.py\", line 8, in <module>\r\n from OpenSSL import crypto, SSL\r\n File \"/usr/lib/python3/dist-packages/OpenSSL/crypto.py\", line 3279, in <module>\r\n _lib.OpenSSL_add_all_algorithms()\r\nAttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

```

EDIT 4  
I did a quick find to see where any other pyOpenSSL files are stored:

```auto
(cchq) ccc@myserver:~/commcare-cloud$ sudo find / -name pyOpenSSL*
/usr/lib/python3/dist-packages/pyOpenSSL-21.0.0.egg-info
/home/ansible/.local/lib/python3.10/site-packages/pyOpenSSL-23.2.0.dist-info
/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pyOpenSSL-23.2.0.dist-info
/home/ccc/.local/lib/python3.10/site-packages/pyOpenSSL-23.2.0.dist-info

```

And the cryptography files:

```auto
/usr/lib/python3/dist-packages/cryptography-3.4.8.egg-info
/usr/local/lib/python3.10/dist-packages/cryptography-41.0.2.dist-info
/snap/core20/1950/usr/lib/python3/dist-packages/cryptography-2.8.egg-info
/snap/core20/1974/usr/lib/python3/dist-packages/cryptography-2.8.egg-info
/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/cryptography-41.0.2.dist-info

```

(cchq) ccc@myserver:~/commcare-cloud$ ls -l /home/ansible/.local/lib/python3.10/site-packages/  
total 8  
drwxrwxr-x 3 ansible ansible 4096 Jul 27 10:48 OpenSSL  
drwxrwxr-x 2 ansible ansible 4096 Jul 27 10:48 pyOpenSSL-23.2.0.dist-info

(cchq) ccc@myserver:~/commcare-cloud$ ls -l /home/ccc/.local/lib/python3.10/site-packages/  
total 8  
drwxrwxr-x 3 ccc ccc 4096 Jul 27 11:00 OpenSSL  
drwxrwxr-x 2 ccc ccc 4096 Jul 27 11:00 pyOpenSSL-23.2.0.dist-info

(cchq) ccc@myserver:~/commcare-cloud$ ls -l /home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/  
total 1740  
drwxrwxr-x 13 ccc ccc 4096 Jul 11 19:16 Crypto  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 Deprecated-1.2.13.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 GitPython-3.1.30.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 Jinja2-3.0.2.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 MarkupSafe-2.0.1.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 26 14:36 OpenSSL  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 PyGithub-1.55.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 PyJWT-2.4.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 PyNaCl-1.4.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:05 PyYAML-6.0.1.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 Pygments-2.13.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 27 11:30 **pycache**  
-rwxrwxr-x 1 ccc ccc 983760 Jul 26 14:36 \_cffi\_backend.cpython-310-x86\_64-linux-gnu.so  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:12 \_distutils\_hack  
drwxrwxr-x 3 ccc ccc 4096 Jul 26 14:05 \_yaml  
drwxrwxr-x 20 ccc ccc 4096 Jul 11 19:16 ansible  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 ansible-4.10.0.dist-info  
drwxrwxr-x 44 ccc ccc 4096 Jul 11 19:16 ansible\_collections  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 ansible\_core-2.11.12.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 ansible\_inventory  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 ansible\_inventory-0.6.4.dist-info  
drwxrwxr-x 6 ccc ccc 4096 Jul 11 19:16 ansible\_test  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 ansible\_vault  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 ansible\_vault-2.1.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 27 11:30 argparse-1.4.0.dist-info  
-rw-rw-r-- 1 ccc ccc 89214 Jul 27 11:30 argparse.py  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 args-0.1.0.dist-info  
-rw-rw-r-- 1 ccc ccc 9316 Jul 11 19:16 args.py  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 async\_timeout  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 async\_timeout-4.0.2.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 attr  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 attrs-21.2.0.dist-info  
drwxrwxr-x 10 ccc ccc 4096 Jul 11 19:16 boto3  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 boto3-1.18.57.dist-info  
drwxrwxr-x 8 ccc ccc 4096 Jul 11 19:16 botocore  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 botocore-1.21.57.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:12 build  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 build-0.10.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 certifi  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 certifi-2022.12.7.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 26 14:36 cffi  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 cffi-1.14.6.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:36 cffi-1.15.1.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 charset\_normalizer  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 charset\_normalizer-2.0.6.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:12 click  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 click-8.1.4.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 clint  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 clint-0.5.1.dist-info  
-rw-rw-r-- 1 ccc ccc 32 Jul 27 11:30 commcare-cloud.egg-link  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 couchdb\_cluster\_admin  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 couchdb\_cluster\_admin-0.7.2.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 26 14:36 cryptography  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:36 cryptography-41.0.2.dist-info  
drwxrwxr-x 8 ccc ccc 4096 Jul 11 19:16 datadog  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 datadog-0.42.0.dist-info  
drwxrwxr-x 6 ccc ccc 4096 Jul 11 19:16 dateutil  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 deprecated  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 dimagi\_memoized-1.1.3.dist-info  
-rw-rw-r-- 1 ccc ccc 152 Jul 11 19:12 distutils-precedence.pth  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 dns  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 dnspython-2.1.0.dist-info  
-rw-rw-r-- 1 ccc ccc 29 Jul 27 11:30 easy-install.pth  
drwxrwxr-x 9 ccc ccc 4096 Jul 11 19:16 gevent  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 gevent-21.8.0.dist-info  
drwxrwxr-x 7 ccc ccc 4096 Jul 11 19:16 git  
drwxrwxr-x 6 ccc ccc 4096 Jul 11 19:16 gitdb  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 gitdb-4.0.10.dist-info  
drwxrwxr-x 3 ccc ccc 12288 Jul 11 19:16 github  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 greenlet  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 greenlet-1.1.2.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 idna  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 idna-2.6.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 importlib\_metadata  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 importlib\_metadata-3.1.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 jinja2  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 jinja2\_cli-0.7.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 jinja2cli  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 jmespath  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 jmespath-0.10.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 jsonobject  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 jsonobject-2.0.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 jwt  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 markupsafe  
-rw-rw-r-- 1 ccc ccc 4954 Jul 11 19:16 memoized.py  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 nacl  
drwxrwxr-x 7 ccc ccc 4096 Jul 11 19:16 netaddr  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 netaddr-0.8.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 packaging  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 packaging-21.3.dist-info  
drwxrwxr-x 9 ccc ccc 4096 Jul 11 19:16 passlib  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 passlib-1.7.4.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 26 14:05 pip  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:05 pip-23.2.1.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:05 pip\_tools-7.1.0.dist-info  
drwxrwxr-x 6 ccc ccc 4096 Jul 26 14:05 piptools  
drwxrwxr-x 6 ccc ccc 4096 Jul 11 19:12 pkg\_resources  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:36 pyOpenSSL-23.2.0.dist-info  
drwxrwxr-x 4 ccc ccc 4096 Jul 26 14:36 pycparser  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 pycparser-2.20.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:36 pycparser-2.21.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 pycryptodome-3.10.4.dist-info  
drwxrwxr-x 7 ccc ccc 4096 Jul 11 19:16 pygments  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 pyparsing  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 pyparsing-3.0.9.dist-info  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:12 pyproject\_hooks  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 pyproject\_hooks-1.0.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 python\_dateutil-2.8.2.dist-info  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 pytz  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 pytz-2022.1.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:16 redis  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 redis-4.4.4.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 26 14:05 requests  
drwxrwxr-x 2 ccc ccc 4096 Jul 26 14:05 requests-2.31.0.dist-info  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 resolvelib  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 resolvelib-0.5.4.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 s3transfer  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 s3transfer-0.5.0.dist-info  
drwxrwxr-x 7 ccc ccc 4096 Jul 11 19:12 setuptools  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 setuptools-59.6.0.dist-info  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 simplejson  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 simplejson-3.17.5.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 six-1.16.0.dist-info  
-rw-rw-r-- 1 ccc ccc 34549 Jul 11 19:16 six.py  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 smmap  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 smmap-5.0.0.dist-info  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 tabulate-0.8.9.dist-info  
-rw-rw-r-- 1 ccc ccc 62917 Jul 11 19:16 tabulate.py  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:12 tomli  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 tomli-2.0.1.dist-info  
drwxrwxr-x 6 ccc ccc 4096 Jul 11 19:16 urllib3  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 urllib3-1.26.7.dist-info  
drwxrwxr-x 5 ccc ccc 4096 Jul 11 19:12 wheel  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:12 wheel-0.40.0.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 11 19:16 wrapt  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 wrapt-1.13.1.dist-info  
drwxrwxr-x 3 ccc ccc 4096 Jul 26 14:05 yaml  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 zipp-3.6.0.dist-info  
-rw-rw-r-- 1 ccc ccc 8425 Jul 11 19:16 zipp.py  
drwxrwxr-x 4 ccc ccc 4096 Jul 11 19:16 zope  
-rw-rw-r-- 1 ccc ccc 529 Jul 11 19:16 zope.event-4.5.0-py3.6-nspkg.pth  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 zope.event-4.5.0.dist-info  
-rw-rw-r-- 1 ccc ccc 529 Jul 11 19:16 zope.interface-5.4.0-nspkg.pth  
drwxrwxr-x 2 ccc ccc 4096 Jul 11 19:16 zope.interface-5.4.0.dist-info

---

<div class="post-metadata">

**Author:** ![zandre\_eng](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/z/a698b9/32.png) [@zandre\_eng](https://forum.dimagi.com/u/zandre_eng)\
**Post date:** [July 31, 2023, 3:10pm UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/7 "2023-07-31T15:10:35Z")

</div>

Hi Ed,

Another step that can be tried is reverting to an older version of the `cryptography` package on your virtual environment. Specifically, this will be `v38.0.4` of the package. The steps would be as follows:

- `pip uninstall cryptography`
- `pip install cryptography==38.0.4`

Please let me know if the issue still persists after trying the above.

---

<div class="post-metadata">

**Author:** ![erobinson](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/erobinson/32/2652_2.png) [@erobinson](https://forum.dimagi.com/u/erobinson)\
**Post date:** [August 1, 2023, 10:27am UTC](https://forum.dimagi.com/t/issue-with-fresh-monolith-deployment/9982/8 "2023-08-01T10:27:26Z")

</div>

Hi Zandre, I get this:

```auto
(cchq) ccc@myserver:~/commcare-cloud$ commcare-cloud monolith deploy-stack --first-time -e 'CCHQ_IS_FRESH_INSTALL=1'
Traceback (most recent call last):
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 573, in _build_master
    ws.require( __requires__ )
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 782, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (cryptography 38.0.4 (/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages), Requirement.parse('cryptography~=41.0'), {'commcare-cloud'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ccc/.virtualenvs/cchq/bin/commcare-cloud", line 33, in <module>
    sys.exit(load_entry_point('commcare-cloud', 'console_scripts', 'commcare-cloud')())
  File "/home/ccc/.virtualenvs/cchq/bin/commcare-cloud", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/ __init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/ __init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ccc/commcare-cloud/src/commcare_cloud/commcare_cloud.py", line 19, in <module>
    from commcare_cloud.commands.deploy.command import Deploy
  File "/home/ccc/commcare-cloud/src/commcare_cloud/commands/deploy/command.py", line 14, in <module>
    from commcare_cloud.commands.deploy.commcare import deploy_commcare
  File "/home/ccc/commcare-cloud/src/commcare_cloud/commands/deploy/commcare.py", line 15, in <module>
    from commcare_cloud.commands.ansible.ansible_playbook import run_ansible_playbook
  File "/home/ccc/commcare-cloud/src/commcare_cloud/commands/ansible/ansible_playbook.py", line 17, in <module>
    from commcare_cloud.user_utils import get_dev_username
  File "/home/ccc/commcare-cloud/src/commcare_cloud/user_utils.py", line 10, in <module>
    from commcare_cloud.environment.main import get_environment
  File "/home/ccc/commcare-cloud/src/commcare_cloud/environment/main.py", line 29, in <module>
    from commcare_cloud.environment.schemas.meta import MetaConfig
  File "/home/ccc/commcare-cloud/src/commcare_cloud/environment/schemas/meta.py", line 3, in <module>
    from commcare_cloud.environment.secrets.backends import all_secrets_backends_by_name
  File "/home/ccc/commcare-cloud/src/commcare_cloud/environment/secrets/backends/ __init__.py", line 2, in <module>
    from commcare_cloud.environment.secrets.backends.ansible_vault.main import AnsibleVaultSecretsBackend
  File "/home/ccc/commcare-cloud/src/commcare_cloud/environment/secrets/backends/ansible_vault/main.py", line 12, in <module>
    from ansible_vault import Vault
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/ansible_vault/ __init__.py", line 19, in <module>
    from .api import Vault # noqa
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/ansible_vault/api.py", line 22, in <module>
    from .parsing import AnsibleVaultLib
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/ansible_vault/parsing.py", line 20, in <module>
    from pkg_resources import parse_version
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 3267, in <module>
    def _initialize_master_working_set():
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 3241, in _call_aside
    f(*args, **kwargs)
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 3279, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 575, in _build_master
    return cls._build_from_requirements( __requires__ )
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 588, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/home/ccc/.virtualenvs/cchq/lib/python3.10/site-packages/pkg_resources/ __init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'cryptography~=41.0' distribution was not found and is required by commcare-cloud

```

If I try editing src/commcare\_cloud.egg-info/requires.txt and requirements.txt it says aborting - I have unstaged changes.
