A memo when creating a python environment with miniconda

  1. miniconda --miniconda is the minimum configuration version of anaconda. Since the environment is virtualized, the main environment is not polluted. Easy version control. I haven't used it much yet, so I don't know the details yet.

2. Install miniconda (Mac OSX: Homebrew)

2.1 Environment

2.2 Install --Enter homebrew-cask. If you already have it, go to install miniconda.

terminal


$ brew cask

--Install miniconda

terminal


$ brew cask install miniconda

3. Create and execute a virtual environment

3.1 Create a virtual environment

terminal


$ conda create python=3.6 -name test_environment
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /usr/local/Caskroom/miniconda/base/envs/test_environment

  added / updated specs:
    - python=3.6


The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2019.10.16-0
  certifi            pkgs/main/osx-64::certifi-2019.9.11-py36_0
  libcxx             pkgs/main/osx-64::libcxx-4.0.1-hcfea43d_1
  libcxxabi          pkgs/main/osx-64::libcxxabi-4.0.1-hcfea43d_1
  libedit            pkgs/main/osx-64::libedit-3.1.20181209-hb402a30_0
  libffi             pkgs/main/osx-64::libffi-3.2.1-h475c297_4
  ncurses            pkgs/main/osx-64::ncurses-6.1-h0a44026_1
  openssl            pkgs/main/osx-64::openssl-1.1.1d-h1de35cc_3
  pip                pkgs/main/osx-64::pip-19.3.1-py36_0
  python             pkgs/main/osx-64::python-3.6.9-h359304d_0
  readline           pkgs/main/osx-64::readline-7.0-h1de35cc_5
  setuptools         pkgs/main/osx-64::setuptools-42.0.1-py36_0
  sqlite             pkgs/main/osx-64::sqlite-3.30.1-ha441bb4_0
  tk                 pkgs/main/osx-64::tk-8.6.8-ha441bb4_0
  wheel              pkgs/main/osx-64::wheel-0.33.6-py36_0
  xz                 pkgs/main/osx-64::xz-5.2.4-h1de35cc_4
  zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate test_environment
#
# To deactivate an active environment, use
#
#     $ conda deactivate

3.2 Move to the created environment

terminal


$ conda activate test_environmente

Depending on the version, it seems that it may be `source activate hogehoge```, but in conda version: 4.7.12``` it seems to be ``` conda activate hogehoge```. Differences between versions have not been investigated. This activation will not succeed the first time. Since it is said that "initialization is required in the shell you are using",

terminal


$ conda init zsh

Please put the shell you are using in ** zsh **. When you execute it, the following will be described in .zshrc etc.

~/.zshrc


# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
        . "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh"
    else
        export PATH="/usr/local/Caskroom/miniconda/base/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

After doing this, you should be able to use the rest, so reopen the terminal or reload the .zshrc.

termianl


$ source .zshrc

3.3 Re-execute

――To check the current environment and other environments

terminal


$ conda env list
# conda environments:
#
base                  *  /usr/local/Caskroom/miniconda/base
dlmugenknock             /usr/local/Caskroom/miniconda/base/envs/dlmugenknock
test_environment         /usr/local/Caskroom/miniconda/base/envs/test_environment

--Move and confirm the move

terminal


$ conda activate test_environment                                                                                                                     

$ conda env list
# conda environments:
#
base                     /usr/local/Caskroom/miniconda/base
dlmugenknock             /usr/local/Caskroom/miniconda/base/envs/dlmugenknock
test_environment      *  /usr/local/Caskroom/miniconda/base/envs/test_environment

――How to get out of the environment

terminal


$ conda deactivate

5. Supplement

--The rest is OK if you do `` `pip install hogehoge``` on the modules required for each environment. ――When you change the environment, the environment name appears next to it as shown in the picture. スクリーンショット 2019-11-29 16.00.28.png

Reference article

Deep learning ∞ I made this knock Note on how to use Conda Use Miniconda

Recommended Posts

A memo when creating a python environment with miniconda
Note when creating an environment with python
Commands for creating a python3 environment with virtualenv
A memo for creating a python environment by a beginner
Problems when creating a csv-json conversion tool with python
Create a virtual environment with Python!
Building a virtual environment with Python 3
[Python] Creating a scraping tool Memo
Precautions when creating a Python generator
A memo when face is detected with Python + OpenCV quickly
A memo when creating a directed graph using Graphviz in Python
[Pyenv] Building a python environment with ubuntu 16.04
Creating a simple PowerPoint file with Python
Building a Python3 environment with Amazon Linux2
A memo with Python2.7 and Python3 on CentOS
Building a Python 3.6 environment with Windows + PowerShell
Creating a python virtual environment on Windows
Build a python virtual environment with pyenv
A memo packed with RADEX environment construction
Build a modern Python environment with Neovim
A memo for when pip3 is installed with python2.7 for some reason
Error when installing a module with Python pip
My python environment memo
Things to watch out for when creating a Python environment on a Mac
Recommended environment and usage when developing with Python
Ubuntu18.04.05 Creating a python virtual environment in LTS
Building a python environment with virtualenv and direnv
Build a python environment with ansible on centos6
Building a Python environment with WLS2 + Anaconda + PyCharm
I was addicted to creating a Python venv environment with VS Code
A memo that allows you to change Pineapple's Python environment with pyenv
Procedure for creating a LineBot made with Python
Create a virtual environment with conda in Python
[Python] Build a Django development environment with Docker
[Python memo] Be careful when creating a two-dimensional array (list of lists)
[Memo] Build a virtual environment with Pyenv + anaconda
Python environment with docker-compose
Work in a virtual environment with Python virtualenv.
Flow of creating a virtual environment with Anaconda
Procedure for creating a Python quarantine environment (venv environment)
[Detailed version] Creating a comfortable Python environment with Google Compute Engine (Ubuntu 16.04)
Build a Python environment with OSX El capitan
Create a Python environment
Quickly build a Python Django environment with IntelliJ
Virtual environment with Python 3.6
Build a Python machine learning environment with a container
Build a python execution environment with VS Code
Get a quick Python development environment with Poetry
A memo when creating an environment that can be debugged with Lambda @ Edge for the time being
[Grasshopper] When creating a data tree on Python script
A memo connected to HiveServer2 of EMR with python
Building a Python environment for pyenv, pyenv-virtualenv, Anaconda (Miniconda)
Recommendation of building a portable Python environment with conda
Build a python virtual environment with virtualenv and virtualenvwrapper
Notes on creating a python development environment on macOS Catalina
Create a python development environment with vagrant + ansible + fabric
I made a Python3 environment on Ubuntu with direnv.
Build a machine learning application development environment with Python
Build a python virtual environment with virtualenv and virtualenvwrapper
[Python] A memo to write CSV vertically with Pandas
A memo that I touched the Datastore with python