I messed up my global environment today.
Today I'm creating a virtual environment called chatgpt-retrieval
in a folder called GitOpenSourceApps
The old directory structure is: ~/GitOpenSourceApps/chatgpt-retrieval
(1)
But then I want to move the virtual environment folder inside another folder called chatgpt-custom-data
manually using mv
(bad mistake!)
The new directory structure is: ~/GitOpenSourceApps/chatgpt-custom-data/chatgpt-retrieval
(2)
Now I didn't know that the pip
files inside virtual environment chatgpt-retrieval
is correspond to the old directory structure (1).
If the current directory structure, which is (2), is different from when it's initialized, which is (1), by running pip install <packages>
, pip
will automatically without warning, install directly into global environment. This global environment is python3 -m site --user-site
or ~/.local/lib/pythonX.Y/site-packages
.
Now my global environment is messed up with newly installed packages. How do I remove all of the installed packages and their dependencies safely? Simply running pip uninstall
won't remove the dependencies!
Since I have installed some 3rd party apps like Vosk, Howdy, ... that are also used Python and they are the only apps that I allowed their packages to be installed inside global environment and I don't want to remove something mistakenly.
I've tried to use pipdeptree
to analyze but the entanglement is too much. I've searched if there is a way to know which program use which packages but no use.