Reputation:
I am trying to uninstall package "pygame" using pip3 on linux, the commands I've tried so far:
pip3 uninstall pygame
python3 -m pip uninstall pygame
The output I am getting in both cases:
Found existing installation: pygame 1.9.6
Not uninstalling pygame at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pygame'. No files were found to uninstall.
The 2nd command was suggested here with the option --user but the output I am getting in this case is that there is "no such option: --user".
Upvotes: 0
Views: 5005
Reputation: 40833
It sounds like you installed pygame
with sudo pip install pygame
or some other variant involving sudo and pip. In general you should avoid doing this. This is because you are modifying the your OS' internal python installation. It might bring in versions of libraries that are incompatible with various internal python scripts that your OS uses. And if you uninstall something, you might unintentionally remove a library that is still needed by your OS.
If, and only if, you installed pygame in this manner then you can uninstall with:
sudo pip uninstall pygame
In future, it is better to create and use virtual environments to manage installing libraries for your own projects. Example:
# Use your distro's package manager to install venv, if it is not already installed.
# apt is aware of your OS' system requirements in a way that pip is not, and so will not
# break things in the way that pip might.
sudo apt install python3-venv
python3 -m venv venv --prompt myproject
. venv/bin/activate
# in this shell, pip and python will now refer to the versions installed in your
# virtual environment (complete with any additional python packages you
# have installed -- only pip initially)
# setuptools and wheel are not installed by default, and may be needed to install
# some python packages
pip install --upgrade pip setuptools wheel
Upvotes: 1
Reputation: 387
Uninstall python-pygame
sudo apt-get remove python-pygame
Uninstall python-pygame and it's dependent packages
sudo apt-get autoremove python-pygame
Purging python-pygame
sudo apt-get purge python-pygame
To delete configuration and/or data files of python-pygame and it's dependencies from Ubuntu Xenial then execute:
sudo apt-get autoremove --purge python-pygame
for more details check this link
Upvotes: 1