-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconda
174 lines (121 loc) · 5.33 KB
/
conda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Once per Linux user:
cp -p .bashrc .bashrc-before-conda
cd ~
bash /home/dojo/conda/repo.continuum.io/miniconda/Miniconda-latest-Linux-x86.sh
(follow defaults)
Edit .bashrc to append conda's directory instead of prepending it. E.g.:
dojo@pan:~$ diff .bashrc-before-miniconda .bashrc
134a135,140
>
> #!!!# added by Miniconda 3.10.1 installer
> #!!!export PATH="/home/dojo/miniconda/bin:$PATH"
>
> # modified by dojo to _append_ instead of prepend
> export PATH="$PATH:/home/dojo/miniconda/bin"
dojo@pan:~$
Close terminal window and open new terminal window to use above changes.
conda --version
conda update conda
conda --version
Install anaconda-client tool.
You will need it eventually. Might as well get it done now.
conda install anaconda-client
once per project: create new environment
# Must specify at least package for environment.
# Can not create empty environment.
# Try to install all packages at once to avoid version skew problems.
# Specifying particular version of python satisfies conda.
conda create --name myproject python==3.5.2
# Specify package I don't care about, configobj, to satisfy conda.
conda create --name myproject configobj
# Create environment with newest version of Python 3.
conda create --name snakes python=3
to begin using an environment:
newer versions of conda:
conda activate myproject
older versions of conda:
source activate myproject
to quit using an environment:
newer versions of conda:
conda deactivate
older versions of conda:
source deactivate
miscellaneous
--name specifies environment to mess with
# to get help
conda whatevercommand -h
# lists all environment names and paths. '*' indicates active environment
conda-env list
# lists all environment names and paths. '*' indicates active environment
conda info --envs
# list versions of packages currently available in an environment
# environment default to current environment?
# package arguments are regular expressions
# list all packages and versions in current environment
conda list
# list all packages and versions in "bunnies" environment
# ("bunnies" environment does not have to be active)
conda list --name "bunnies"
# list packages and versions with "python" anywhere in package name
# in current environment
conda list python
# list package and version of python in current environment
conda list ^python$
# list package and version of configobj in current environment
conda list ^configobj$
# list package and version of python in bunnies environment
# ("bunnies" environment does not have to be active)
conda list --name bunnies ^python$
# list package and version of configobj in bunnies environment
# ("bunnies" environment does not have to be active)
conda list --name bunnies ^configobj$
anaconda search -t conda pytest-xdist
# Create environment with newest version of Python 3.
conda create --name snakes python=3
# show python and package versions installed in current environment
conda list
# check web for packages and versions with
# "beautiful-soup" anywhere in package name
conda search beautiful-soup
# check web for packages and versions with
# "python" anywhere in package name
conda search python
# check web for packages and versions for python package name
conda search ^python$
# install package in an environment (does not have to be active)
# installs beautiful-soup in bunnies environment
conda install --name bunnies beautiful-soup
# without asking for confirmation, install package in active environment
# installs beautiful-soup in active environment
conda install --yes beautiful-soup
# install packages listed in a file
# into an environment (does not have to be active)
conda install --name bunnies --file requirements.txt
# update a package
conda update --name bunnies beautiful-soup
# remove package from an environment (does not have to be active)
conda remove --name bunnies beautiful-soup
# remove an environment
conda remove --name bunnies --all
# for packages that conda can not install,
# use pip within a conda environment
source activate bunnies
pip install pytest-xdist
source activate bunnies
pip uninstall pytest-xdist
# See also cheatsheet
http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf
# uninstall miniconda
# rm -rf ~/miniconda
# some packages, such as pytest-xdist, are not available by conda itself,
# but can be installed by pip within the conda environment.
# If the only package one wants is one not available with conda,
# create a conda environment with a sacrificial package that conda does
# have, then use pip within the conda environment, then use conda to remove
# the sacrificial package.
conda create --name foo configobj
source activate foo
pip install pytest-xdist
conda remove configobj
# environments/projects are subdirectories of /home/dojo/miniconda/envs
# One can go directly from one environment to another.