Cchq <env> deploy: stuck on preindex_everything

I’ve stuck on the following error

[172.19.3.41] sudo: /home/cchq/www/echis/releases/2019-10-21_21.25/python_env-3.6/bin/python /home/cchq/www/echis/releases/2019-10-21_21.25/manage.py preindex_everything --check
[172.19.3.41] out: /home/cchq/www/echis/releases/2019-10-21_21.25/python_env-3.6/local/lib/python2.7/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use “pip install psycopg2-binary” instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.
[172.19.3.41] out: “”")
[172.19.3.41] out: Traceback (most recent call last):
[172.19.3.41] out: File “/home/cchq/www/echis/releases/2019-10-21_21.25/manage.py”, line 195, in
[172.19.3.41] out: main()
[172.19.3.41] out: File “/home/cchq/www/echis/releases/2019-10-21_21.25/manage.py”, line 36, in main
[172.19.3.41] out: run_patches()
[172.19.3.41] out: File “/home/cchq/www/echis/releases/2019-10-21_21.25/manage.py”, line 112, in run_patches
[172.19.3.41] out: patch_assertItemsEqual()
[172.19.3.41] out: File “/home/cchq/www/echis/releases/2019-10-21_21.25/manage.py”, line 141, in patch_assertItemsEqual
[172.19.3.41] out: unittest.TestCase.assertItemsEqual = unittest.TestCase.assertCountEqual
[172.19.3.41] out: AttributeError: type object ‘TestCase’ has no attribute ‘assertCountEqual’
[172.19.3.41] out:

This looks suspicious to me:

/home/cchq/www/echis/releases/2019-10-21_21.25/python_env-3.6/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use “pip install psycopg2-binary” instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.

it says python_env-3.6, but the file path references python2.7. assertCountEqual is only available in Python 3, so it would make sense that if you’re running python 2, you would see this error.
Have you already upgraded from Python 2 to 3 as described in https://dimagi.github.io/commcare-cloud/changelog/0023-upgrade-to-python-3.html ?
CommCareHQ no longer supports Python 2.

Hi Ethan,

I’ve applied all the steps from change log. Including upgrade to python3

But commcare-cloud is still using python2.7. am confused after i see, python2.7 in the directory.
/home/cchq/www/echis/releases/2019-10-21_21.25/python_env-3.6/local/lib/python2.7/..

Hi Demisew,

Were you able to resolve this? I’m not certain what the issue is. I do see a newer message from you with python3.6 in the path, so I’m hoping you managed to get past the issue.

Hi Ethan,

we were using ubuntu 14.04. And i was trying to apply python upgrade changelog. that is Upgrade to Python 3

Result is it failed. it created python3.6 directory but still using python2.7 inside. That is what u saw on this:
python_env-3.6/local/lib/python2.7/...
I don’t think u tested the change log on ubuntu 14.04.

So i’ve upgarded Our servers to Ubuntu 18.04 and deploy-stack, it runs successfully.

Now am fixing some issue related to data restore and elasticsearch issue.

Right, I was referring to the paths in this forum thread: Internal Server error: on Local server setup

For example:

/home/cchq/www/echis/releases/2019-10-26_17.12/python_env-3.6/lib/python3.6/site-packages/psycopg2/__init__ .py

It looked like you had managed to complete the upgrade, sounds like by upgrading to Ubuntu 18.04 first. I wanted to check in here and confirm that this issue is resolved.

Hi Ethan,

During upgrade i was not able to install Letsencrypt CA, following the steps on How to Enable HTTPS with letsencrypt

So that i followed steps from digital ocean site. and it was successfull.

Now am getting some warning on check_services output: That is

/home/cchq/www/echis/releases/2019-10-26_17.12/python_env-3.6/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)

Why does this message appeared?

I’ve tested the CA:
using https://www.ssllabs.com/ssltest/analyze.html?d=www.echisethiopia.org
and it works fine

I’m not sure, that may not even be an issue with your SSL setup, but rather with the request being made. Could you make a new issue for that with a full traceback? Others may have more information, and a full traceback will let us see where the error is coming from.