6.8 KiB
6.8 KiB
Fix issue with a venv for python for a charm, such as telegraf. The following snippet removes the old .venv
and then recreates it from scratch based on the currently installed charm.
The following example does for the unit telegraf/144 and on the unit itself. It would be ideal to run these commands as the root
user.
cd /var/lib/juju/agents/unit-telegraf-144/charm
mv ../.venv ../.venv.bak
mv wheelhouse/.bootstrapped wheelhouse/.bootstrapped.bak
JUJU_CHARM_DIR=$PWD PYTHONPATH=$PWD/lib python3 -c 'import charms.layer.basic; charms.layer.basic.bootstrap_charm_deps()';
Below is the sample output of what it would look like
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
python3-setuptools is already the newest version (39.0.1-2).
python3-yaml is already the newest version (3.12-1build2).
python3-wheel is already the newest version (0.30.0-0.2).
python3-dev is already the newest version (3.6.7-1~18.04).
python3-pip is already the newest version (9.0.1-2.3~ubuntu1.18.04.5).
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-netifaces is already the newest version (0.10.4-0.1build4).
python3-yaml is already the newest version (3.12-1build2).
python3-psutil is already the newest version (5.4.2-1ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
virtualenv is already the newest version (15.1.0+ds-1.1).
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /var/lib/juju/agents/unit-telegraf-144/.venv/bin/python3
Also creating executable in /var/lib/juju/agents/unit-telegraf-144/.venv/bin/python
Please make sure you remove any previous custom paths from your /root/.pydistutils.cfg file.
Installing setuptools, pkg_resources, pip, wheel...done.
Collecting pip
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-18.1
Looking in links: wheelhouse
Collecting setuptools
Collecting setuptools-scm
Installing collected packages: setuptools, setuptools-scm
Found existing installation: setuptools 39.0.1
Uninstalling setuptools-39.0.1:
Successfully uninstalled setuptools-39.0.1
Successfully installed setuptools-41.6.0 setuptools-scm-1.17.0
Looking in links: wheelhouse
Processing ./wheelhouse/chardet-3.0.4.tar.gz
Processing ./wheelhouse/pyaml-19.12.0.tar.gz
Processing ./wheelhouse/PyYAML-5.3.tar.gz
Processing ./wheelhouse/urllib3-1.25.8.tar.gz
Processing ./wheelhouse/charms.reactive-1.3.0.tar.gz
Processing ./wheelhouse/certifi-2019.11.28.tar.gz
Processing ./wheelhouse/Jinja2-2.11.0.tar.gz
Processing ./wheelhouse/netaddr-0.7.19.tar.gz
Processing ./wheelhouse/setuptools_scm-1.17.0.tar.gz
Processing ./wheelhouse/requests-2.22.0.tar.gz
Processing ./wheelhouse/idna-2.8.tar.gz
Processing ./wheelhouse/six-1.14.0.tar.gz
Processing ./wheelhouse/pip-18.1.tar.gz
Installing build dependencies ... done
Processing ./wheelhouse/MarkupSafe-1.1.1.tar.gz
Processing ./wheelhouse/wheel-0.33.6.tar.gz
Processing ./wheelhouse/Tempita-0.5.2.tar.gz
Processing ./wheelhouse/setuptools-41.6.0.zip
Processing ./wheelhouse/charmhelpers-0.20.8.tar.gz
Collecting PyYAML (from pyaml==19.12.0)
Collecting charmhelpers>=0.5.0 (from charms.reactive==1.3.0)
Collecting MarkupSafe>=0.23 (from Jinja2==2.11.0)
Collecting idna<2.9,>=2.5 (from requests==2.22.0)
Building wheels for collected packages: chardet, pyaml, urllib3, charms.reactive, certifi, Jinja2, netaddr, setuptools-scm, requests, six, pip, wheel, Tempita, setuptools
Running setup.py bdist_wheel for chardet ... done
Stored in directory: /root/.cache/pip/wheels/27/5f/24/2e5bc688af87bffe0457fa16b8601c0d393ccbc9b068d6a396
Running setup.py bdist_wheel for pyaml ... done
Stored in directory: /root/.cache/pip/wheels/79/c5/be/f7eb7d0568d71e1086f493d8ec21e4359063afdfe861d21f69
Running setup.py bdist_wheel for urllib3 ... done
Stored in directory: /root/.cache/pip/wheels/23/94/93/4583b7ac7c053705ebd68f212acbd3269101fb83ca82921af4
Running setup.py bdist_wheel for charms.reactive ... done
Stored in directory: /root/.cache/pip/wheels/ec/2c/88/87d93ff0af94fe2fdb7d6fed373387fce01cf8fcf70b872edb
Running setup.py bdist_wheel for certifi ... done
Stored in directory: /root/.cache/pip/wheels/68/68/7c/e5c72a2ab27d6f47a37739f31266f4bbff18e914a1303a9f89
Running setup.py bdist_wheel for Jinja2 ... done
Stored in directory: /root/.cache/pip/wheels/52/03/30/d94e1a4322fad761a4c4f788f241076ef7bdad1d80eba607d1
Running setup.py bdist_wheel for netaddr ... done
Stored in directory: /root/.cache/pip/wheels/28/10/61/1d2b1f00d446322bfae4c76502775ac272f9207683d5ed7234
Running setup.py bdist_wheel for setuptools-scm ... done
Stored in directory: /root/.cache/pip/wheels/1a/ed/b2/64019918c81e2a2064d2239686495401fd9780461aff2a005f
Running setup.py bdist_wheel for requests ... done
Stored in directory: /root/.cache/pip/wheels/f4/a8/31/47d7cb71b5b5ccaa9a18a0a92f7e090027f68f46ff0f362c18
Running setup.py bdist_wheel for six ... done
Stored in directory: /root/.cache/pip/wheels/9e/fb/a8/9e8dba0d2311302df42fa26af88dd5b33c7e5875875219a4f1
Running setup.py bdist_wheel for pip ... done
Stored in directory: /root/.cache/pip/wheels/8d/88/eb/b66a604956f95523092e96cc5cf2d37943c3b64621b2e8d43e
Running setup.py bdist_wheel for wheel ... done
Stored in directory: /root/.cache/pip/wheels/a0/27/45/ccafd2fd5940f63eea98fcc6670f477243afa1c51247d5af6c
Running setup.py bdist_wheel for Tempita ... done
Stored in directory: /root/.cache/pip/wheels/fb/8a/b2/a3e73f6fa52fd1cf6db7c20380c8ef35e238bf8101addfd210
Running setup.py bdist_wheel for setuptools ... done
Stored in directory: /root/.cache/pip/wheels/f7/67/78/82b27b93488f9a401d5e86288924c5ab52bbd31fc9ad83c8d4
Successfully built chardet pyaml urllib3 charms.reactive certifi Jinja2 netaddr setuptools-scm requests six pip wheel Tempita setuptools
Installing collected packages: chardet, PyYAML, pyaml, urllib3, netaddr, Tempita, MarkupSafe, Jinja2, six, charmhelpers, charms.reactive, certifi, setuptools-scm, idna, requests, pip, wheel, setuptools
Successfully installed Jinja2-2.11.0 MarkupSafe-1.1.1 PyYAML-5.3 Tempita-0.5.2 certifi-2019.11.28 chardet-3.0.4 charmhelpers-0.20.8 charms.reactive-1.3.0 idna-2.8 netaddr-0.7.19 pip-18.1 pyaml-19.12.0 requests-2.22.0 setuptools-41.6.0 setuptools-scm-1.17.0 six-1.14.0 urllib3-1.25.8 wheel-0.33.6
Argument expected for the -c option
usage: /var/lib/juju/agents/unit-telegraf-144/.venv/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.