void (@NotNull RepoPackage repoPackage, @Nullable String version, boolean forceUpgrade, @Nullable String extraOptions, @NotNull Listener listener, boolean installToUser) { final String packageName = repoPackage.getName(); final String repository = PyPIPackageUtil.isPyPIRepository(repoPackage.getRepoUrl()) ? null : repoPackage.getRepoUrl(); final List<String> extraArgs = new ArrayList<>(); if (installToUser) { extraArgs.add(PyPackageManager.USE_USER_SITE); } if (extraOptions != null) { // TODO: Respect arguments quotation Collections.addAll(extraArgs, extraOptions.split(" +")); } if (!StringUtil.isEmptyOrSpaces(repository)) { extraArgs.add("--index-url"); extraArgs.add(repository); } if (forceUpgrade) { extraArgs.add("-U"); } final PyRequirement req = version == null ? PyRequirementsKt.pyRequirement(packageName) : PyRequirementsKt.pyRequirement(packageName, PyRequirementRelation.EQ, version); final PyPackageManagerUI ui = new PyPackageManagerUI(myProject, mySdk, new PyPackageManagerUI.Listener() { @Override public void started() { listener.operationStarted(packageName); } @Override public void finished(@Nullable List<ExecutionException> exceptions) { listener.operationFinished(packageName, toErrorDescription(exceptions, mySdk, repoPackage.getName())); } }); ui.install(Collections.singletonList(req), extraArgs); }