private static void initEnvironment(@NotNull Project project,
                                      @NotNull PythonExecution commandLine,
                                      @NotNull PythonRunParams runParams,
                                      @Nullable PyRemotePathMapper pathMapper,
                                      boolean isDebug,
                                      @NotNull HelpersAwareTargetEnvironmentRequest helpersAwareTargetRequest,
                                      @Nullable Sdk sdk) {
    Map<String, String> env = Maps.newHashMap();
    var envParameters = configureEnvsFromFiles(runParams, true);
    env.putAll(envParameters);
    if (runParams.getEnvs() != null) {
      env.putAll(runParams.getEnvs());
    }
    boolean addPyCharmHosted = true;
    if (sdk != null && !CondaPythonExecKt.getUsePythonForLocalConda()) {
      addPyCharmHosted = PySdkExtKt.getOrCreateAdditionalData(sdk).getFlavor().providePyCharmHosted();
    }
    addCommonEnvironmentVariables(getInterpreterPath(project, runParams), env, addPyCharmHosted);

    setupVirtualEnvVariables(runParams, env, runParams.getSdkHome());

    // Carefully patch environment variables
    Map<String, Function<TargetEnvironment, String>> map =
      ContainerUtil.map2Map(env.entrySet(), e -> Pair.create(e.getKey(), TargetEnvironmentFunctions.constant(e.getValue())));
    TargetEnvironmentRequest targetEnvironmentRequest = helpersAwareTargetRequest.getTargetEnvironmentRequest();
    PythonScripts.extendEnvs(commandLine, map, targetEnvironmentRequest.getTargetPlatform());

    setupEncodingEnvs(commandLine, commandLine.getCharset());

    buildPythonPath(project, commandLine, runParams, pathMapper, isDebug, targetEnvironmentRequest);

    for (PythonCommandLineTargetEnvironmentProvider envProvider : PythonCommandLineTargetEnvironmentProvider.EP_NAME.getExtensionList()) {
      envProvider.extendTargetEnvironment(project, helpersAwareTargetRequest, commandLine, runParams);
    }
  }
private static void initEnvironment(@NotNull Project project,
                                      @NotNull PythonExecution commandLine,
                                      @NotNull PythonRunParams runParams,
                                      @Nullable PyRemotePathMapper pathMapper,
                                      boolean isDebug,
                                      @NotNull HelpersAwareTargetEnvironmentRequest helpersAwareTargetRequest,
                                      @Nullable Sdk sdk)