Skip to content

Commit 0bd5cdf

Browse files
committed
Clear environment before running pip install
1 parent 1202c6f commit 0bd5cdf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/venv-cli/venv.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ venv::install() {
167167
if venv::_check_if_help_requested "$1"; then
168168
echo "venv install [<requirements file>] [--skip-lock] [<install args>]"
169169
echo
170-
echo "Install requirements from <requirements file>, like 'requirements.txt'"
171-
echo "or 'requirements.lock'."
170+
echo "Clear the environment, then install requirements from <requirements file>,"
171+
echo "like 'requirements.txt' or 'requirements.lock'."
172172
echo "Installed packages are then locked into the corresponding .lock-file,"
173173
echo "e.g. 'venv install requirements.txt' will lock packages into 'requirements.lock'."
174174
echo "This step is skipped if '--skip-lock' is specified, or when installing"
@@ -211,6 +211,10 @@ venv::install() {
211211
shift
212212
fi
213213

214+
# Clear the environment before running pip install to avoid orphaned packages
215+
# https://github.com/SallingGroup-AI-and-ML/venv-cli/issues/9
216+
venv::clear
217+
214218
venv::color_echo "${_green}" "Installing requirements from ${requirements_file}"
215219
if ! pip install --require-virtualenv --use-pep517 -r "${requirements_file}" "$@"; then
216220
return "${_fail}"

0 commit comments

Comments
 (0)