diff --git a/src/cli/exec.rs b/src/cli/exec.rs index 8c77c5645..57345ea31 100644 --- a/src/cli/exec.rs +++ b/src/cli/exec.rs @@ -9,7 +9,7 @@ use rattler::{ install::{IndicatifReporter, Installer}, package_cache::PackageCache, }; -use rattler_conda_types::{MatchSpec, PackageName}; +use rattler_conda_types::{MatchSpec, PackageName, Platform}; use reqwest_middleware::ClientWithMiddleware; use crate::{cli::global::common::solve_package_records, prefix::Prefix}; @@ -162,7 +162,8 @@ pub async fn create_exec_prefix( // Solve the environment let channels = args.channels.resolve_from_config(config); - let solved_records = solve_package_records(&gateway, channels, specs.clone()).await?; + let solved_records = + solve_package_records(&gateway, Platform::current(), channels, specs.clone()).await?; // Install the environment tracing::info!( diff --git a/src/cli/global/common.rs b/src/cli/global/common.rs index 7ecbc4ebf..ed19831f5 100644 --- a/src/cli/global/common.rs +++ b/src/cli/global/common.rs @@ -125,6 +125,7 @@ pub(super) fn channel_name_from_prefix( /// MatchSpec pub async fn solve_package_records( gateway: &Gateway, + platform: Platform, channels: ChannelIter, specs: Vec, ) -> miette::Result> @@ -135,11 +136,7 @@ where // Get the repodata for the specs let repodata = await_in_progress("fetching repodata for environment", |_| async { gateway - .query( - channels, - [Platform::current(), Platform::NoArch], - specs.clone(), - ) + .query(channels, [platform, Platform::NoArch], specs.clone()) .recursive(true) .execute() .await @@ -149,6 +146,7 @@ where .context("failed to get repodata")?; // Determine virtual packages of the current platform + // We cannot infer virtual_packages for another platform let virtual_packages = VirtualPackage::current() .into_diagnostic() .context("failed to determine virtual packages")? diff --git a/src/cli/global/install.rs b/src/cli/global/install.rs index 4cc347027..944b7c75a 100644 --- a/src/cli/global/install.rs +++ b/src/cli/global/install.rs @@ -301,8 +301,13 @@ pub async fn execute(args: Args) -> miette::Result<()> { // Install the package(s) let mut executables = vec![]; for (package_name, package_matchspec) in specs { - let records = - solve_package_records(&gateway, channels.clone(), vec![package_matchspec]).await?; + let records = solve_package_records( + &gateway, + args.platform, + channels.clone(), + vec![package_matchspec], + ) + .await?; let (prefix_package, scripts, _) = globally_install_package(&package_name, records, client.clone(), args.platform).await?;