Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update/uninstall with Pip packages installed with apt (and vice versa)

There are a number of resources that compare and contrast the advantages and disadvantages of using apt-get and pip to install, update, and uninstall python packages.

What I cannot find is a resource that indicates what happens if something that is installed by one package manager is updated or uninstalled by the other.

When I run pip list, it lists a lot of packages that are installed, most of which on my system were installed by apt-get and not pip.

So, are these two package managers able to manage packages installed by the other? Or, is pip able to manage a package installed by apt-get, but then apt-get is messed up afterwards. Is apt-get able to manage a package installed by pip?

like image 511
user1748155 Avatar asked May 14 '15 06:05

user1748155


People also ask

How do I uninstall a package with pip?

To use pip to uninstall a package locally in a virtual environment: Open a command or terminal window (depending on the operating system) cd into the project directory. pip uninstall <packagename>

How do I uninstall pip update?

Open a terminal window. To uninstall, or remove, a package use the command '$PIP uninstall <package-name>'.

How do I update pip packages?

Update a package: pip install --upgrade To update installed packages to the latest version, run pip install with the --upgrade or -U option.

What does pip uninstall do?

Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: Pure distutils packages installed with python setup.py install , which leave behind no metadata to determine what files were installed.


1 Answers

I would recommend to try and avoid using two (or more) package managers at the same time. It's not very likely that they will cooperate correctly and smoothly.

If possible, pick one of them and use it. Combine them only if you really need to. Usually you don't.

There are ways of avoiding conflicts such as

  • pip install --user <package> which installs the package into the user's directory only
  • virtualenv which allows you to have packages installed per application/project - this is a very good idea since various projects might need different versions of the same package and it's easy to move such project do a different computer etc.
  • venv - Python 3 has a built-in support for virtual environments
like image 132
geckon Avatar answered Oct 16 '22 06:10

geckon