Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Explicitly install pip with python
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
  • Loading branch information
jjerphan committed Apr 3, 2026
commit d393ec1b38b75bde89545592974340ed4487dddb
28 changes: 27 additions & 1 deletion libmamba/src/api/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// The full license is in the file LICENSE, distributed with this software.

#include <algorithm>
#include <cctype>
#include <stdexcept>

#include <fmt/format.h>
Expand Down Expand Up @@ -377,6 +376,33 @@ namespace mamba
{
using Request = solver::Request;

// When the user explicitly asks for ``python`` in the requested specs, also inject a
// plain ``pip`` request unless it is already present. This complements
// ``add_pip_as_python_dependency`` at the repo level and makes sure that the Request
// is in phase with the root packages including both ``python`` and ``pip`` when requested.
bool wants_python = false;
bool wants_pip = false;
for (const auto& s : specs)
{
const auto maybe_name = specs::MatchSpec::extract_name(s);
if (!maybe_name.has_value())
{
continue;
}
if (maybe_name.value() == "python")
{
wants_python = true;
}
else if (maybe_name.value() == "pip")
{
wants_pip = true;
}
}
if (wants_python && !wants_pip)
{
specs.emplace_back("pip");
}

const auto& prefix_pkgs = prefix_data.records();

auto request = Request();
Expand Down