Skip to content

Commit

Permalink
Fix pip requiring --break-system-packages to install/update non-syste…
Browse files Browse the repository at this point in the history
…m packages
  • Loading branch information
kizniche committed Oct 15, 2023
1 parent 02ab5ea commit cda72c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docker/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion mycodo/scripts/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions mycodo/scripts/upgrade_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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')
Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

1 comment on commit cda72c8

@kizniche
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/mycodo-installation-issues-could-not-connect-to-localhost/1637/14

Please sign in to comment.