lorin / ansiblebook

Code samples from the book "Ansible: Up and Running"
http://ansiblebook.com
324 stars 460 forks source link

ch06: Installation of virtualenvwrapper fails #15

Open nmusatti opened 6 years ago

nmusatti commented 6 years ago

The mezzanine.yml palybook fails when executing the "install Python requirements globally via pip" task for virtualenvwrapper with the following error message:

failed: [web] (item=virtualenvwrapper) => {"changed": false, "cmd": "/usr/local/bin/pip2 install -U virtualenvwrapper", "item": "virtualenvwrapper", "msg": "stdout: Collecting virtualenvwrapper\n Downloading https://files.pythonhosted.org/packages/2b/8c/3192e10913ad945c0f0fcb17e9b2679434a28ad58ee31ce0104cba3b1154/virtualenvwrapper-4.8.2-py2.py3-none-any.whl\nCollecting virtualenv-clone (from virtualenvwrapper)\n Downloading https://files.pythonhosted.org/packages/6d/c2/dccb5ccf599e0c5d1eea6acbd058af7a71384f9740179db67a9182a24798/virtualenv_clone-0.3.0-py2.py3-none-any.whl\nCollecting stevedore (from virtualenvwrapper)\n Downloading https://files.pythonhosted.org/packages/17/6b/3b7d6d08b2ab3e5ef09e01c9f7b3b590ee135f289bb94553419e40922c25/stevedore-1.28.0-py2.py3-none-any.whl\nRequirement not upgraded as not directly required: virtualenv in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper) (15.2.0)\nCollecting six>=1.10.0 (from stevedore->virtualenvwrapper)\n Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl\nCollecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)\n Downloading https://files.pythonhosted.org/packages/e1/ba/f95e3ec83f93919b1437028e989cf3fa5ff4f5cae4a1f62255f71deddb5b/pbr-4.0.2-py2.py3-none-any.whl (98kB)\nInstalling collected packages: virtualenv-clone, six, pbr, stevedore, virtualenvwrapper\n Found existing installation: six 1.5.2\n\n:stderr: /usr/local/lib/python2.7/dist-packages/pip/vendor/urllib3/util/ssl.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n SNIMissingWarning\n/usr/local/lib/python2.7/dist-packages/pip/vendor/urllib3/util/ssl.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecurePlatformWarning\n/usr/local/lib/python2.7/dist-packages/pip/vendor/urllib3/util/ssl.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecurePlatformWarning\ncheetah 2.4.4 requires Markdown>=2.0.1, which is not installed.\nlaunchpadlib 1.10.2 requires testresources, which is not installed.\nCannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n"}

nmusatti commented 6 years ago

I opened this issue here because I couldn't find a way to open it in the ansiblebook/ansiblebook repository.

jethigh commented 6 years ago

Hi.

Try to install virtualenvwrapper with apt and comment in where it's installed with pip.

    - name: install apt packages
      apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
      become: True
      with_items:
        - git
        - libjpeg-dev
        - memcached
        - nginx
        - postgresql
        - python-dev
        - python-pip
        - python-psycopg2
        - python-setuptools
        - python-virtualenv
        - supervisor
        - virtualenvwrapper
   - name: install Python requirements globally via pip
      pip: name={{ item }} state=latest
      with_items:
        - pip
        - virtualenv
# Installed as system package
#        - virtualenvwrapper
nmusatti commented 6 years ago

Thank you. I actually managed to move forward by just commenting "pip" in the "install Python requirements" task. Now I have an error in the migration task which I haven't investigated yet.

nmusatti commented 6 years ago

The other error is fixed by the "reinstall bleach" pull request.

jethigh commented 6 years ago

I fixed migration error by changing Mezzanine==4.2.2 to Mezzanine==4.2.3 in requrements.txt. There is a bug in Mezzanine 4.2.2 that causes migration error when bleach 2.0 is installed. It was fixed in Mezzanine 4.2.3

jethigh commented 6 years ago

For someone who will encounter same error with migration in future I'v created public project of mezzanine-example which could be replaced instead of Lorin Hochstein github repo. https://github.com/jethigh/mezzanine_example.git

Here is also my complete requirements.txt created by pip freeze in working environment if some dependiences will fail in future.

beautifulsoup4==4.6.0
bleach==2.1.3
certifi==2018.4.16
chardet==3.0.4
Django==1.10.8
django-appconf==1.0.2
django-compressor==2.2
django-contrib-comments==1.8.0
filebrowser-safe==0.4.7
future==0.16.0
grappelli-safe==0.4.7
gunicorn==19.8.1
html5lib==1.0.1
idna==2.6
Mezzanine==4.2.3
oauthlib==2.0.7
Pillow==5.1.0
psycopg2==2.7.4
psycopg2-binary==2.7.4
python-memcached==1.59
pytz==2018.4
rcssmin==1.0.6
requests==2.18.4
requests-oauthlib==0.8.0
rjsmin==1.0.12
setproctitle==1.1.10
six==1.11.0
tzlocal==1.5.1
urllib3==1.22
webencodings==0.5.1
lorin commented 6 years ago

@nmusatti I just enabled issues on ansiblebook/ansiblebook, I didn't realize they were disabled there.