The `conda` or `conda-like` package and environment manager usage and practical

简介: conda

The conda or conda-like package and environment manager usage and practical

1. Version Differences : what are the differences between conda 、 anaconda 、 bioconda 、 miniconda ?

conda : can download and install packages and all of its dependencies. The information on where to download and what the dependencies are for each packages are stored in a database called a "channel"

bioconda : a conda channel which contains names, locations, and dependencies of many bioinformatics tools.

miniconda : slimmed-down distribution version of Anaconda. It has all the components of the Anaconda distribution, except the 200+ pre-installed data science applications.

anaconda : open-source python distribution. It is purpose-built for such applications as machine learning, data science, and large-scale data processing. This distribution includes the core python language, along with more than 200 packages, and a package management tool.

2. install miniconda

2.1 download and install packages Miniconda3-py38_4.10.3-Linux-x86_64.sh
$ bash Miniconda3-py38_4.10.3-Linux-x86_64.sh

to make the installation take effect, you should close the current terminal and re-open it.

(base) [biocodee@localhost ~]$ conda --version 
conda 4.10.3

the conda has been installed correctly.

3. find packages

use command conda search

(base) [biocodee@localhost ~]$ conda search numpy
Loading channels: done
# Name                       Version           Build  Channel             
numpy                          1.9.3 py27_nomklhbee5d10_3  pkgs/main           
numpy                          1.9.3  py27h1b885b7_7  pkgs/main           
numpy                          1.9.3  py27h28100ab_5  pkgs/main           
...
(base) [biocodee@localhost ~]$ conda config --show channels
channels:
  - conda-forge
  - bioconda
  - defaults
(base) [biocodee@localhost ~]$ conda search samtools
Loading channels: done
# Name                       Version           Build  Channel             
samtools                      0.1.12               0  bioconda            
samtools                      0.1.12               1  bioconda            
samtools                      0.1.12               2  bioconda            
samtools                      0.1.13               0  bioconda           ... 
#    
(base) [biocodee@localhost ~]$ conda search samtools | tail -n1
samtools                        1.14      hb421002_0  bioconda    

4. conda environments :

  • A (mostly) self-contained directory with a set of compatible packages
  • Uses links to reduce disk space when possible
  • Linking is relative to packages!
  • No more conflicting dependencies between versions!
Conda environments – common commands
  • lists available environments
(base) [biocodee@localhost ~]$ conda info --envs
# conda environments:
#
base                  *  /home/biocodee/miniconda3

(base) [biocodee@localhost ~]$ conda env list
# conda environments:
#
base                  *  /home/biocodee/miniconda3
  • create/remove environments : can specify packages versions and mix/max versions
##############################################################################
###new env default path 
(base) [biocodee@localhost ~]$ conda create --name=myenv python=3.8 numpy 'pysam>=0.16'
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##

  environment location: /home/biocodee/miniconda3/envs/myenv

  added / updated specs:
    - numpy
    - pysam[version='>=0.16']
    - python=3.8


The following packages will be downloaded:
...
Proceed ([y]/n)? n


CondaSystemExit: Exiting.

(base) [biocodee@localhost ~]$ conda env list
# conda environments:
#
base                  *  /home/biocodee/miniconda3


#can remove envs using cmd following : 
$ conda env remove --name=myenv

###############################################################################
### module `venv`, specifying new env path
#Specifying a location for an environment
  • activates / deactivates an environment
$ command -v samtools
$ conda activate samtools
$ command -v samtools
/home/gcb2020/conda/envs/samtools/bin/samtools
$ conda deactivate
$ command -v samtools
#disable the automatic base activation
$ conda config --set auto_activate_base false
#check conda version
[biocodee@localhost ~]$ conda --version 
conda 4.10.3
#activate conda
[biocodee@localhost ~]$ conda activate
#deactive conda
(base) [biocodee@localhost ~]$ conda deactivate
[biocodee@localhost ~]$ conda --version
conda 4.10.3
  • conda install / conda remove
  • conda list

Tip

  • Keep your base env clean! (only the package manager + its deps)
  • Generously create/remove environments for different tools/workflows!

reference :
[1] GCB 2020 Tutorial. site

[2] Conda, bioconda, anaconda, are they different? site

[3] Conda site

[4] Conda channels.site

[5] The Definitive Guide to Conda Environments.site

目录
相关文章
|
iOS开发
SwiftUI极简教程13:NavigationView导航栏使用
SwiftUI极简教程13:NavigationView导航栏使用
2881 2
SwiftUI极简教程13:NavigationView导航栏使用
|
C++
如何使用MACS进行peak calling
MACS2是peak calling最常用的工具。 callpeak用法 这是MACS2的主要功能,因为MACS2的目的就是找peak,其他功能都是可有可无,唯独callpeak不可取代。
5343 0
|
12月前
|
JavaScript 数据可视化 测试技术
Node.js 性能诊断利器 Clinic.js:原理剖析与实战指南
Clinic.js 是由 NearForm 开发的 Node.js 性能诊断工具集,通过可视化、低开销的方式帮助开发者快速定位 CPU 高占用、事件循环延迟、内存泄漏等性能瓶颈。它包含三大核心工具:`doctor` 初筛异常,`flame` 分析 CPU 热点,`bubbleprof` 追踪异步 I/O 延迟。基于 `perf_hooks`、`async_hooks` 等技术,实现多维度数据关联与智能建议,适用于预发环境压测与性能优化,显著提升调试效率。
965 14
|
12月前
|
SQL 自然语言处理 算法
Text2SQL 破局技术解析之二:MQL 实现与复杂性
本文深入解析润乾NLQ架构中MQL的设计逻辑与实现机制。作为规范文本的确定性编译目标,MQL通过四类查询范式,构建精确语义基准,消除自然语言歧义。结合DQL的维度关联与SPL的复杂计算,形成层次清晰、协同高效的Text2SQL解决方案,平衡表达力与规范性,支撑企业级BI分析。(238字)
|
11月前
|
JSON 缓存 API
【剪映小助手】向现有草稿中添加视频特效
向现有草稿中添加视频特效。该接口用于在指定的时间段内添加特效素材到剪映草稿中,支持多种特效类型如边框特效、滤镜特效、动态特效等。特效可以用于增强视频的视觉效果。
|
人工智能 自然语言处理 API
魔搭社区模型速递(5.18-5.24)
魔搭ModelScope本期社区进展:📟3790个模型,📁307个数据集,🎨90个创新应用,📄 7 篇内容
1110 14
|
存储 Java 数据库
Base64解码遇到java.lang.IllegalArgumentException: Illegal base64 character d
Base64解码遇到java.lang.IllegalArgumentException: Illegal base64 character d
Base64解码遇到java.lang.IllegalArgumentException: Illegal base64 character d
|
机器学习/深度学习 运维 自然语言处理
深度学习+实时监控:运维不再靠“拍脑袋”!
深度学习+实时监控:运维不再靠“拍脑袋”!
699 3
|
机器学习/深度学习 设计模式 Rust
Rust机器学习之tch-rs
整体上tch-rs的使用思路和PyTorch是一致的,因为本身tch-rs就是PyTorch的C++库`libtorch`的绑定。如果你熟练使用PyTorch,那么用tch-rs上手会非常快。关键是用tch-rs能够带给你更快的速度,这在大规模项目中是一个巨大的优势。
2275 0
Rust机器学习之tch-rs
|
人工智能 自然语言处理 网络安全
基于阿里云 Milvus + DeepSeek + PAI LangStudio 的低成本高精度 RAG 实战
阿里云向量检索服务Milvus版是一款全托管向量检索引擎,并确保与开源Milvus的完全兼容性,支持无缝迁移。它在开源版本的基础上增强了可扩展性,能提供大规模AI向量数据的相似性检索服务。凭借其开箱即用的特性、灵活的扩展能力和全链路监控告警,Milvus云服务成为多样化AI应用场景的理想选择,包括多模态搜索、检索增强生成(RAG)、搜索推荐、内容风险识别等。您还可以利用开源的Attu工具进行可视化操作,进一步促进应用的快速开发和部署。
1507 1