Last active
February 14, 2025 20:05
-
-
Save samcofer/7163a92ab93f643e2394ce63b267e453 to your computer and use it in GitHub Desktop.
Update local renv and python cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Placeholder to change the name of the gist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Activate the existing venv | |
source .venv/bin/activate | |
# Make note of all installed packages | |
python -m pip freeze > requirements-freeze.txt | |
# Deactivate the venv and delete | |
deactivate | |
rm -rf .venv/ | |
# Create a new virtual environment | |
python -m venv .venv | |
source .venv/bin/activate | |
python -m pip install --upgrade pip wheel setuptools | |
python -m pip install -r requirements-freeze.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snapshot renv.lock to bring it in sync with the library | |
renv::snapshot() | |
# Delete the existing libraries | |
unlink("renv/library", recursive=TRUE) | |
# Restart R session | |
.rs.restartR() | |
# Re-install libraries | |
renv::restore(rebuild = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment