Skip to content

Commit cda72c8

Browse files
committed
Fix pip requiring --break-system-packages to install/update non-system packages
1 parent 02ab5ea commit cda72c8

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Bugfixes
44

55
- Fix missing netcat apt install candidate with package netcat-openbsd
6+
- Fix pip requiring --break-system-packages to install/update non-system packages
67

78
### Miscellaneous
89

docker/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ case "${1:-''}" in
1818
apt remove -y python3-cffi-backend
1919
apt clean
2020

21-
python3 -m pip install --upgrade pip
21+
python3 -m pip install --break-system-packages --upgrade pip
2222

2323
# Rasppberry pi requires rust be installed
2424
# curl https://sh.rustup.rs -sSf | sh
@@ -34,7 +34,7 @@ case "${1:-''}" in
3434
printf "\n#### All dependencies installed\n\n" 2>&1 | tee -a "${LOG_LOCATION}"
3535
;;
3636
"test")
37-
docker exec -ti mycodo_flask "${INSTALL_PATH}"/env/bin/python -m pip install --upgrade -r /home/mycodo/mycodo/install/requirements-testing.txt
37+
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
3838
docker exec -ti mycodo_flask "${INSTALL_PATH}"/env/bin/python -m pytest /home/mycodo/mycodo/tests/software_tests
3939
;;
4040
"clean-all")

mycodo/scripts/dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ case "${1}" in
2525
printf "\n## Error: Virtualenv doesn't exist. Creating...\n"
2626
/bin/bash "${INSTALL_DIRECTORY}"/mycodo/scripts/upgrade_commands.sh setup-virtualenv
2727
fi
28-
"${INSTALL_DIRECTORY}"/env/bin/python -m pip install --upgrade "${2}"
28+
"${INSTALL_DIRECTORY}"/env/bin/python -m pip install --break-system-packages --upgrade "${2}"
2929
;;
3030
'internal')
3131
case "${2}" in

mycodo/scripts/upgrade_commands.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ case "${1:-''}" in
221221
printf "\n#### Checking Python 3 virtual environment\n"
222222
if [[ ! -e ${MYCODO_PATH}/env/bin/python ]]; then
223223
printf "#### Creating virtualenv with ${PYTHON_BINARY_SYS_LOC} at "${MYCODO_PATH}"/env\n"
224-
python3 -m pip install virtualenv==${VIRTUALENV_VERSION}
224+
python3 -m pip install --break-system-packages virtualenv==${VIRTUALENV_VERSION}
225225
rm -rf "${MYCODO_PATH}"/env
226226
python3 -m virtualenv -p "${PYTHON_BINARY_SYS_LOC}" "${MYCODO_PATH}"/env
227227
fi
@@ -582,7 +582,7 @@ case "${1:-''}" in
582582
apt remove -y apache2
583583
apt install -y ${APT_PKGS}
584584
apt clean
585-
python3 -m pip install --upgrade pip
585+
python3 -m pip install --break-system-packages --upgrade pip
586586
;;
587587
'update-permissions')
588588
printf "\n#### Setting permissions\n"
@@ -602,7 +602,7 @@ case "${1:-''}" in
602602
if [[ ! -d ${MYCODO_PATH}/env ]]; then
603603
printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}"
604604
else
605-
"${MYCODO_PATH}"/env/bin/python -m pip install --upgrade pip
605+
"${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade pip
606606
fi
607607
;;
608608
'update-pip3-packages')
@@ -611,8 +611,8 @@ case "${1:-''}" in
611611
if [[ ! -d ${MYCODO_PATH}/env ]]; then
612612
printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}"
613613
else
614-
"${MYCODO_PATH}"/env/bin/python -m pip install --upgrade -r "${MYCODO_PATH}"/install/requirements.txt
615-
"${MYCODO_PATH}"/env/bin/python -m pip install --upgrade -r "${MYCODO_PATH}"/install/requirements-testing.txt
614+
"${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade -r "${MYCODO_PATH}"/install/requirements.txt
615+
"${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade -r "${MYCODO_PATH}"/install/requirements-testing.txt
616616
fi
617617
;;
618618
'pip-clear-cache')
@@ -752,7 +752,7 @@ case "${1:-''}" in
752752
if [[ ! -d ${MYCODO_PATH}/env ]]; then
753753
printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}"
754754
else
755-
"${MYCODO_PATH}"/env/bin/python -m pip install --upgrade pip
755+
"${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --upgrade pip
756756
fi
757757
;;
758758
'docker-update-pip-packages')
@@ -761,7 +761,7 @@ case "${1:-''}" in
761761
if [[ ! -d ${MYCODO_PATH}/env ]]; then
762762
printf "\n## Error: Virtualenv doesn't exist. Create with %s setup-virtualenv\n" "${0}"
763763
else
764-
"${MYCODO_PATH}"/env/bin/python -m pip install --no-cache-dir -r "${MYCODO_PATH}"/install/requirements.txt
764+
"${MYCODO_PATH}"/env/bin/python -m pip install --break-system-packages --no-cache-dir -r "${MYCODO_PATH}"/install/requirements.txt
765765
fi
766766
;;
767767
'install-docker')

release-checklist.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Notes to keep track of the steps involved in making a new release.
44

55
- [ ] 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.
66
- [ ] Ensure the virtualenv exists with ```sudo ~/Mycodo/mycodo/scripts/upgrade_commands.sh setup-virtualenv-full```
7-
- [ ] Update pip packages in virtualenv with ```~/Mycodo/env/bin/pip install -r ~/Mycodo/docs/requirements.txt```
7+
- [ ] Update pip packages in virtualenv with ```~/Mycodo/env/bin/pip install --break-system-packages -r ~/Mycodo/docs/requirements.txt```
88
- [ ] Activate the virtualenv with ```source ~/Mycodo/env/bin/activate```
99
- [ ] Run ```sudo /bin/bash ~/Mycodo/mycodo/scripts/generate_all.sh```
1010
- 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.
2121
- [ ] Commit changes and wait for TravisCI to finish running pytests and verify all were successful.
2222
- [ ] Install mkdocs dependencies:
2323
- ```sudo apt install libpango-1.0-0 libpangoft2-1.0-0 libopenjp2-7```
24-
- ```~/Mycodo/env/bin/python -m pip install -r ~/Mycodo/docs/requirements.txt```
25-
- [ ] 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```
24+
- ```~/Mycodo/env/bin/python -m pip install --break-system-packages -r ~/Mycodo/docs/requirements.txt```
25+
- [ ] 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```
2626
- [ ] 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)
2727
- [ ] 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).
2828
- [ ] Make GitHub Release

0 commit comments

Comments
 (0)