From cda72c87e19369e70a01c78a07a4ef48753c8ce9 Mon Sep 17 00:00:00 2001 From: Kyle Gabriel Date: Sun, 15 Oct 2023 17:50:12 -0400 Subject: [PATCH] Fix pip requiring --break-system-packages to install/update non-system packages --- CHANGELOG.md | 1 + docker/setup.sh | 4 ++-- mycodo/scripts/dependencies.sh | 2 +- mycodo/scripts/upgrade_commands.sh | 14 +++++++------- release-checklist.md | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ea1da67..8f9a79fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Bugfixes - Fix missing netcat apt install candidate with package netcat-openbsd + - Fix pip requiring --break-system-packages to install/update non-system packages ### Miscellaneous diff --git a/docker/setup.sh b/docker/setup.sh index b59533ce9..eb42b6a18 100755 --- a/docker/setup.sh +++ b/docker/setup.sh @@ -18,7 +18,7 @@ case "${1:-''}" in apt remove -y python3-cffi-backend apt clean - python3 -m pip install --upgrade pip + python3 -m pip install --break-system-packages --upgrade pip # Rasppberry pi requires rust be installed # curl https://sh.rustup.rs -sSf | sh @@ -34,7 +34,7 @@ case "${1:-''}" in printf "\n#### All dependencies installed\n\n" 2>&1 | tee -a "${LOG_LOCATION}" ;; "test") - docker exec -ti mycodo_flask "${INSTALL_PATH}"/env/bin/python -m pip install --upgrade -r /home/mycodo/mycodo/install/requirements-testing.txt + docker exec -ti mycodo_flask "${INSTALL_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade -r /home/mycodo/mycodo/install/requirements-testing.txt docker exec -ti mycodo_flask "${INSTALL_PATH}"/env/bin/python -m pytest /home/mycodo/mycodo/tests/software_tests ;; "clean-all") diff --git a/mycodo/scripts/dependencies.sh b/mycodo/scripts/dependencies.sh index 132f5b543..0b1a37282 100755 --- a/mycodo/scripts/dependencies.sh +++ b/mycodo/scripts/dependencies.sh @@ -25,7 +25,7 @@ case "${1}" in printf "\n## Error: Virtualenv doesn't exist. Creating...\n" /bin/bash "${INSTALL_DIRECTORY}"/mycodo/scripts/upgrade_commands.sh setup-virtualenv fi - "${INSTALL_DIRECTORY}"/env/bin/python -m pip install --upgrade "${2}" + "${INSTALL_DIRECTORY}"/env/bin/python -m pip install --break-system-packages --upgrade "${2}" ;; 'internal') case "${2}" in diff --git a/mycodo/scripts/upgrade_commands.sh b/mycodo/scripts/upgrade_commands.sh index 5a7573084..9595f7f06 100755 --- a/mycodo/scripts/upgrade_commands.sh +++ b/mycodo/scripts/upgrade_commands.sh @@ -221,7 +221,7 @@ case "${1:-''}" in printf "\n#### Checking Python 3 virtual environment\n" if [[ ! -e ${MYCODO_PATH}/env/bin/python ]]; then printf "#### Creating virtualenv with ${PYTHON_BINARY_SYS_LOC} at "${MYCODO_PATH}"/env\n" - python3 -m pip install virtualenv==${VIRTUALENV_VERSION} + python3 -m pip install --break-system-packages virtualenv==${VIRTUALENV_VERSION} rm -rf "${MYCODO_PATH}"/env python3 -m virtualenv -p "${PYTHON_BINARY_SYS_LOC}" "${MYCODO_PATH}"/env fi @@ -582,7 +582,7 @@ case "${1:-''}" in apt remove -y apache2 apt install -y ${APT_PKGS} apt clean - python3 -m pip install --upgrade pip + python3 -m pip install --break-system-packages --upgrade pip ;; 'update-permissions') printf "\n#### Setting permissions\n" @@ -602,7 +602,7 @@ case "${1:-''}" in if [[ ! -d ${MYCODO_PATH}/env ]]; then printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}" else - "${MYCODO_PATH}"/env/bin/python -m pip install --upgrade pip + "${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade pip fi ;; 'update-pip3-packages') @@ -611,8 +611,8 @@ case "${1:-''}" in if [[ ! -d ${MYCODO_PATH}/env ]]; then printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}" else - "${MYCODO_PATH}"/env/bin/python -m pip install --upgrade -r "${MYCODO_PATH}"/install/requirements.txt - "${MYCODO_PATH}"/env/bin/python -m pip install --upgrade -r "${MYCODO_PATH}"/install/requirements-testing.txt + "${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade -r "${MYCODO_PATH}"/install/requirements.txt + "${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade -r "${MYCODO_PATH}"/install/requirements-testing.txt fi ;; 'pip-clear-cache') @@ -752,7 +752,7 @@ case "${1:-''}" in if [[ ! -d ${MYCODO_PATH}/env ]]; then printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}" else - "${MYCODO_PATH}"/env/bin/python -m pip install --upgrade pip + "${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade pip fi ;; 'docker-update-pip-packages') @@ -761,7 +761,7 @@ case "${1:-''}" in if [[ ! -d ${MYCODO_PATH}/env ]]; then printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}" else - "${MYCODO_PATH}"/env/bin/python -m pip install --no-cache-dir -r "${MYCODO_PATH}"/install/requirements.txt + "${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --no-cache-dir -r "${MYCODO_PATH}"/install/requirements.txt fi ;; 'install-docker') diff --git a/release-checklist.md b/release-checklist.md index 7e95c0e48..6d5e070c9 100644 --- a/release-checklist.md +++ b/release-checklist.md @@ -4,7 +4,7 @@ Notes to keep track of the steps involved in making a new release. - [ ] Check that the IP address in /mycodo/scripts/generate_manual_api.sh is accessible and is the latest yet-to-be released version of Mycodo. - [ ] Ensure the virtualenv exists with ```sudo ~/Mycodo/mycodo/scripts/upgrade_commands.sh setup-virtualenv-full``` -- [ ] Update pip packages in virtualenv with ```~/Mycodo/env/bin/pip install -r ~/Mycodo/docs/requirements.txt``` +- [ ] Update pip packages in virtualenv with ```~/Mycodo/env/bin/pip install --break-system-packages -r ~/Mycodo/docs/requirements.txt``` - [ ] Activate the virtualenv with ```source ~/Mycodo/env/bin/activate``` - [ ] Run ```sudo /bin/bash ~/Mycodo/mycodo/scripts/generate_all.sh``` - Generates Input/Output/Function/Widget/API manual pages in Mycodo/docs/, and translatable .po files in Mycodo/mycodo/mycodo_flask/translations, and translated docs. @@ -21,8 +21,8 @@ Notes to keep track of the steps involved in making a new release. - [ ] Commit changes and wait for TravisCI to finish running pytests and verify all were successful. - [ ] Install mkdocs dependencies: - ```sudo apt install libpango-1.0-0 libpangoft2-1.0-0 libopenjp2-7``` - - ```~/Mycodo/env/bin/python -m pip install -r ~/Mycodo/docs/requirements.txt``` -- [ ] Clone Mycodo fresh to a new directory and ensure mkdocs pip requirements are installed by running: ```cd Mycodo && sudo mycodo/scripts/upgrade_commands.sh setup-virtualenv && sudo env/bin/python -m pip install -r docs/requirements.txt``` + - ```~/Mycodo/env/bin/python -m pip install --break-system-packages -r ~/Mycodo/docs/requirements.txt``` +- [ ] Clone Mycodo fresh to a new directory and ensure mkdocs pip requirements are installed by running: ```cd Mycodo && sudo mycodo/scripts/upgrade_commands.sh setup-virtualenv && sudo env/bin/python -m pip install --break-system-packages -r docs/requirements.txt``` - [ ] Run ```cd Mycodo && env/bin/python -m mkdocs gh-deploy``` to generate and push docs to gh-pages branch (for https://kizniche.github.io/Mycodo) - [ ] Optionally, a naive Mycodo system with code prior to the yet-to-be released version can be upgraded to master to test its ability to upgrade (useful if experimental database schema changes are being performed during the upgrade). - [ ] Make GitHub Release