question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not silently uninstall and install distinct versions of the same package

See original GitHub issue

What’s the problem this feature will solve? I am working on a tool that needs to automatically scan specific directories for a requirements file and install the specified dependencies in it. The problem is that if the requirements file is outdated, e.g. specifies an older version for an already installed package, the newer version will either be uninstalled and replaced by the older version or just overwritten by the older version if --ignore-installed is used.

Describe the solution you’d like I would like a solution where the whole process is aborted with an error message or at least the installation process for the affected packet is skipped, ideally with a single command. Otherwise this may break the python environment without a warning.

In my case I run the command to install dependencies via a requirements file via pythons subprocess.Popen class. Hence, for maximum automation, it would be ideal to be able to get the required behavior with a single command that either succeeds or fails.

Alternative Solutions A solution that would probably satisfy the biggest part of the use-cases would be to explicitly ask the user whether they want to uninstall and reinstall the dependency with specified version. It would also be nice to have the behaviour in both ways, i.e. neither silently replace newer nor older versions.

Additional context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Mar 29, 2021

Yes, indeed both would be useful. The OP is actually kind of vague on what exactly is expected, so I have a feeling even --upgrade-strategy=never or any possible solution in pip may not solve their problem (a per-package prompt is a no-go, unroftunately).

0reactions
bersbersberscommented, Mar 29, 2021

I think the implication of what OP wants is any conflicts should abort entirely without installing anything. Which I think can be achieved simply by not replacing ==?

I agree that this interpretation (==) is compatible with the title (“Do not silently uninstall and install distinct versions of the same package”). But the OP then points out the specific problem with older packages (which could be fixed using >=). Finally, they ask for an optional extension to also prevent newer packages, which would be == again. I can see both use cases (and solutions) as being useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uninstall-Package (PackageManagement) - PowerShell
The Uninstall-Package cmdlet uninstalls one or more software packages from the local computer. To find installed packages, use the Get-Package cmdlet.
Read more >
Powershell Uninstall Script for a company with many different ...
Hey ya'll, I've been tasked with uninstalling and installing new ... of systems have different versions of software from the same vendor.
Read more >
How to uninstall a package installed with pip install --user
To uninstall the package system-wide using pip , first uninstall it locally, then run the same uninstall command again, with root privileges.
Read more >
How to Uninstall Python Packages - ActiveState
Packages can be uninstalled from a virtual environment using pip or pipenv. To use pip to uninstall a package locally in a virtual...
Read more >
Uninstall - Chocolatey Software Docs
This means that a package may not need an explicit chocolateyUninstall.ps1 to reverse the installation done in the install script.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found