How to uninstall Python packages installed globally on Mac? - python

While writing Python code in PyCharm on Mac I installed some Python Packages not in the virtual Environment but globally. How can I check those installed Packages and delete them?

To check whether a package is installed, run
pip freeze
to get a list of all packages, then search for the package.
To uninstall a package, run
pip uninstall [package name]
Of course you have to run these commands globally (and not inside your virtual environment)
I wish you much luck 🍀

You can use pip freeze command to get all your globally installed packages and delete them

Related

pip installing package in weird location

I'm trying to install imgui with pip with anaconda3 All of my packages are in anaconda3\Lib\site-packages but when I install imgui, it installs it in another folder on C:\Python39
Which location should I keep imgui in?
If you are installing with pip, it seems like you are installing the package from the main python installation, instead of using the virtual environment. Be sure to have your virtual environment selected when launching the command. You could usually check that if at the beginning of the line in your terminal you have the name of the virtual environment between brackets, like (anaconda3) C:\Users\...

Pip won't install packages in virtualenv

After performing a system upgrade this morning, I'm not able to install or update packages in any of my old or fresh created virtual environments.
I create the virtual environments using virtualenvwrapper.
I've tried rebooting my PC, recreating all of my virtual environments, but nothing worked.
Strange enough, pip freeze does not output my installed packages, although they are found in sitepackages.
Im using python3.7 on manjaro linux with the newest kernel.
In my envs and on my system pip 19.2.3 is installed.
The error I'm seeing is the following:
pip install <package>
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
When trying to use the system pip without virtualenv, everything works just fine.
pip install cython
Requirement already satisfied: cython in /home/manuel/.local/lib/python3.7/site-packages (0.29.13
I expect pip to install the desired package to the sitepackages folder of my virtualenv without telling me to not use a '--user' install, which I'm not doing explicitly anyway
I was able to fix this myself.
I checked all the pip config files here https://pip.pypa.io/en/latest/user_guide/#configuration
Seems like in the pip configuration file /etc/pip.conf the user parameter was set to true.
Changing it to false resolved my issue.
I still don't know why/if the config file changed.

Python If I should use pip/pip3 to install/update packages when anaconda is my python organizer?

I was informed that if I have installed anaconda to organize python then I would better install using:
conda install mypackage
rather than
pip3 install mypackage
Is that true? if that is true, can anyone tell some reason for that? version inconsistent or hard to maintain?
You can install your packages with both conda and pip, all of them would work well. The only difference is that conda is Anaconda's package manager, while pip is Python package manager, so there could be some version incompabilities between the packages, installed from different packages into one virtual environment.
Actually there are some difference here:
conda install will install package in your venv environment when you are install under some environment.which may be some thing like: d:/.../venv
while
pip install will install package in some system folder, in my computer is like c:/users/.../
you can definitely change the order of the path in your sys.path to decide which version of package you can use, if you have more than one version installed(if you install numpy
using both conda install and pip install then you may get two versions in two different folders)
There may be some way to put the installed package from pip also in venv folder, I am trying to find it.

How to reset OS:X installation of Python packages installed using sudo?

Imagine that one did not realize how virtual environments work in Python and installed a lot of packages using sudo pip install for OS:X. Now they are facing problems managing package versions.
This would never happen if one understands virtual environments, but if one did this prior to being enlightened, how can that someone easily remove all my their non-virtual environment packages that were installed, without breaking any default installations?
Note this includes several programs (such as nosetests) and is not limited to exclusively libraries. It seems I can create a virtualenvironment with --no-site-packages and that gets around at least the packages (assuming I wipe my PYTHONPATH). But my actual PATH seems to let me see the executables I installed, too.
Nothing in my base installation of OS:X is installed with pip. This means you can uninstall everything from pip on your OSX without "worrying" - in terms of actual system performance. It is possible this will interfere with your day-to-day activities, if you are relying on global pip packages.
You can verify what packages you have installed by viewing the full list:
pip freeze
Everything this returns are user installations. This means you can "safely" pass this as arguments to pip uninstall:
pip freeze | xargs sudo pip uninstall -y
which will uninstall all items installed with pip on your machine.
You may accidentally be using these in some of your virtual environments, particularly if your PYTHONPATH variable is set to any of your local install directories. Any of pip's installed packages that are executables will also be visible inside of a virtual environment, assuming that you are not overwriting your PATH variable as part of your virtual environment.
In my case, the only item I had to reinstall was the virutalenv wrapper:
pip install virtualenvwrapper

Virtual Environment not working on windows - Django

After installing Virtual Environment and activating it (Scripts\activate), I ran pip freeze to show global installed modules. When I try to install any of the packages, it says they are already installed.
I tried installing virtual environment using --no-site-packages, but it didn't help either. It still shows all globally installed packages.
I installed virtualenvwrapper, but it didn't help either.
If I remove C:\Python27\Lib\site-packages from PYTHONPATH and run pip freeze, it does not show any global packages, and it does not install any packages either. There is no response, it just freezes on "Downloading package".

Categories

Resources