canonical / charm-duplicity

A charm that provides functionality for both manual and automatic backups for a deployed application
0 stars 3 forks source link

Fails to install on xenial due to pip/venv issues #9

Closed jneo8 closed 11 months ago

jneo8 commented 11 months ago

When installing fabric on xenial I'm getting this fault:

021-01-20 09:56:36 DEBUG install Installing collected packages: invoke, pycparser, cffi, six, bcrypt, cryptography, pynacl, paramiko, pathlib2, fabric 2021-01-20 09:56:36 DEBUG install Running setup.py install for bcrypt: started 2021-01-20 09:56:37 DEBUG install Running setup.py install for bcrypt: finished with status 'done' 2021-01-20 09:56:37 DEBUG install Running setup.py install for cryptography: started 2021-01-20 09:56:37 DEBUG install Running setup.py install for cryptography: finished with status 'error' ... 2021-01-20 09:56:38 WARNING install Command "/opt/juju_venvs/duplicity/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-v_5aoqc1/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-o24fcpuk-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/juju_venvs/duplicity/include/site/python3.5/cryptography" failed with error code 1 in /tmp/pip-build-v_5aoqc1/cryptography/ 2021-01-20 09:56:38 WARNING install You are using pip version 8.1.1, however version 20.3.3 is available. 2021-01-20 09:56:38 WARNING install You should consider upgrading via the 'pip install --upgrade pip' command. 2021-01-20 09:56:38 ERROR juju-log Hook error: Traceback (most recent call last): File "/var/lib/juju/agents/unit-duplicity-0/.venv/lib/python3.5/site-packages/charms/reactive/init.py", line 74, in main bus.dispatch(restricted=restricted_mode) File "/var/lib/juju/agents/unit-duplicity-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 390, in dispatch _invoke(other_handlers) File "/var/lib/juju/agents/unit-duplicity-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 359, in _invoke handler.invoke() File "/var/lib/juju/agents/unit-duplicity-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 181, in invoke self._action(args) File "/var/lib/juju/agents/unit-duplicity-0/charm/reactive/venv.py", line 48, in add_pip_to_venv pip_install(package) File "lib/charms/layer/venv.py", line 42, in pip_install call_from_env(cmd) File "/var/lib/juju/agents/unit-duplicity-0/.venv/lib/python3.5/site-packages/charms/reactive/decorators.py", line 219, in _wrapped return func(args, **kwargs) File "lib/charms/layer/venv.py", line 29, in call_from_env check_call(". {}/activate; {}".format(ENV_BIN, cmd), shell=True) File "/usr/lib/python3.5/subprocess.py", line 581, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '. /opt/juju_venvs/duplicity/bin/activate; https_proxy= pip install fabric' returned non-zero exit status 1

I believe this issue comes up because pip version 8.1.1 doesn't detect the pre-built cryptography packages and therefore tries to build them. This fails, as the container doesn't have gcc nor dev headers etc.

Upgrading pip in the venv would fix this, but layer-venv doesn't provide a way to do so.

I've filed an RFE against layer-venv https://github.com/omnivector-solutions/layer-venv/issues/6

Alternatively we could setup our venv without the help of layer-venv and upgrade pip ourselves.


Imported from Launchpad using lp2gh.