docs

a slatepencil documentail site

View on GitHub

Anaconda

Miniconda Linux install

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh

Creating an environment

conda create --name <ENV_NAME> <PACKAGE>=<VERSION> conda create --name myenv python=3.11 beautifulsoup4 docutils jinja2=3.1.4 wheel

list python envs

conda info --envs
# Activating an environment
conda activate web
# Locking an environment
conda install conda-project
# If your project doesn’t contain an environment.yml file
conda-project init
conda-project lock

# Check Package Availability
conda search beartype
# Displays a list of packages installed in your active environment and their versions.
conda list

# Generate project-level requirement.txt file:
pipreqs /path/to/your/project/
# not the same as
conda list -e > requirements.txt

# Export the environment
conda env export > environment.yml

# Deactivating an environment
conda deactivate

# Installing a conda package
conda install package-name=2.3.4 --name some-environment
conda install /package-path/package-filename.tar.bz2
conda install /packages-path/packages-filename.tar

# Ensure that you are using the latest version of Conda
conda update -n base -c defaults conda
# Clear Conda Cache
conda clean --all

virtual env

python3 -m venv .venv
source .venv/bin/activate
which python
export PYTHONPATH=$(pwd)

python src/app.py

# Deactivate a virtual environment
deactivate

# install pip in .venv
python3 -m ensurepip --upgrade
# install package to .venv with a temperal mirror
python3 -m pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple requests==2.18.4

# start server
bash start_server.sh

GPU

pip

# Environment Management and Introspection
pip install
pip uninstall
pip inspect
python -m pip list
python -m pip show sphinx
python -m pip search "query"
pip check

python -m pip freeze > requirements.txt
python -m pip install -r requirements.txt

# Handling Distribution Files
pip download
pip wheel
pip hash

# Package Index information
pip search

# temporarily config pip to use mirror once
pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package
# config pip default to use mirror, 1: update pip, 2: set mirror
python -m pip install --upgrade pip
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
# config multiple mirrors
pip config set global.extra-index-url "<url1> <url2>..."

Mirrors

conda config --add channels conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
conda config --set show_channel_urls yes
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/