Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Ubuntu, don't discover unusable system venv module. #1455

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions R/virtualenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ virtualenv_create <- function(
if (is.null(python))
python <- virtualenv_starter(version)


check_can_be_virtualenv_starter(python, version)

module <- module %||% virtualenv_module(python)
Expand Down Expand Up @@ -409,8 +408,16 @@ virtualenv_module <- function(python) {

# if we have one of these modules available, return it
for (module in modules)
if (python_has_module(python, module))
if (python_has_module(python, module)) {
if(module == "venv" && is_ubuntu() && startsWith(python, "/usr/bin/python")) {
# `apt install python3` makes an importable venv module, but not one
# capable of actually creating a venv unless python3-venv is installed.
# if python3-venv is not installed, move on and maybe discover virtualenv.
if (!any(grepl("^python[0-9.]*-venv$", system("dpkg -l", intern = TRUE))))
next
}
return(module)
}

# virtualenv not available: instruct the user to install
commands <- stack(mode = "character")
Expand Down