How to clean local python environment of conda installs

1.4k Views Asked by At

Using the latest miniconda2 I created a conda environment & then did all my conda package installs. Then when I finished I realized I had FORGOT TO ACTIVATE the environment (I'm dizzy) with the command

source activate myenv

so all my conda installs went into the local/system wide environment. I simply did

conda uninstall package-name

for all the packages but I'm certain not all the dependencies were removed. For example, conda install of matplotlib showed

The following NEW packages will be INSTALLED:

cycler:           0.10.0-py36_0    
dbus:             1.10.20-0        
expat:            2.1.0-0          
fontconfig:       2.12.1-3         
freetype:         2.5.5-2          
glib:             2.50.2-1         
gst-plugins-base: 1.8.0-0          
gstreamer:        1.8.0-0          
icu:              54.1-0           
jpeg:             9b-0             
libffi:           3.2.1-1          
libgcc:           5.2.0-0          
libiconv:         1.14-0           
libpng:           1.6.30-1         
libxcb:           1.12-1           
libxml2:          2.9.4-0          
matplotlib:       2.0.2-np113py36_0
pcre:             8.39-1           
pyparsing:        2.2.0-py36_0     
pyqt:             5.6.0-py36_2     
qt:               5.6.2-5          
sip:              4.18-py36_0

which conda shows

/home/cargo/miniconda2/bin/conda

First I created the environment

conda create -n myenv python=3

Then I did all the conda installs

conda install numpy
conda install pandas
.
.
conda install statsmodels

Then I realized I failed to activate the environment b/c the terminal prompt was

cargo@cargo-VirtualBox:~$  INSTEAD OF (myenv)cargo@cargo-VirtualBox:~$

The terminal prompt is what got my attention before I even tried to do anything else; I'm 110% certain I didn't activate the environment as I can't find the command in the bash history. Next I did uninstalls for all the conda packages as stated above. I guess it's good now that I no longer see the python3 packages in the local/root environment but I can't explain/understand why?

conda list
# packages in environment at /home/cargo/miniconda2:
#
asn1crypto                0.22.0                   py27_0  
beautifulsoup4            4.6.0                     <pip>
cairo                     1.14.8                        0  
cffi                      1.10.0                   py27_0  
.
.
wheel                     0.29.0                   py27_0  
yaml                      0.1.6                         0  
zlib                      1.2.8                         3  
cargo@cargo-VirtualBox:~$ 
0

There are 0 best solutions below