2016년 3월 30일 수요일

(가상환경) Anaconda commands

conda -V
conda info --envs
conda update conda
conda create -n yourenvname python=2.7 anaconda
source activate yourenvname #windows에서는 source 생략
deactivate
conda remove -n yourenvname --all

conda info -e
conda install -n yourenvname [package]

windows에서 새로운 가상환경을 생성 때는 가상환경 생성 후, 그 환경 내에서도 mingw, libpython 설치 필요.

For ubuntu,
source bin/activate ~/anaconda2/
conda info --envs
...
source bin/activate /home/user/anaconda2/envs/keras1.0.1

theano/keras 실행 시는
THEANO_FLAGS=floatX=float32,device=gpu python

bash shell prompt 축약
PS1='\u:\W\$ '


(Ref.)
1. http://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
2. http://antilibrary.org/m/post/766
3. http://askubuntu.com/questions/145618/how-can-i-shorten-my-command-line-bash-prompt

댓글 14개:

  1. anaconda 설치와 관련 명령

    답글삭제
    답글
    1. >pip freeze #설치된 packages들의 리스트 보여줌

      absl-py==0.2.2
      alabaster==0.7.10
      anaconda-client==1.6.14
      anaconda-project==0.8.2
      asn1crypto==0.24.0
      ....

      삭제
  2. [Tensorflow and more for Windows 10]
    conda update conda
    conda update anaconda
    conda update python
    conda update --all
    Make virtual env.
    conda install tensorflow-gpu
    pip install keras
    pip install opencv-python

    답글삭제
  3. [pytorch for windows 10 Anaconda]
    conda create --name py38 python=3.8
    activate py38
    conda install jupyter # conda로 설치함을 유의
    pip install -U scikit-learn
    conda install matplotlib
    pip install opencv-python

    답글삭제
    답글
    1. conda create --clone py38 --name py38-1

      삭제
    2. pip install pandas --user
      conda install tensorboard

      삭제
    3. yolov5 ultralytics 설치 시에는 requirements.txt를 참고하여 설치

      삭제
    4. conda install -c anaconda git

      삭제
  4. anaconda의 base환경에서 가상환경 py39 생성
    conda create -n py39 python=3.9
    conda install -c anaconda git
    conda update -n base -c defaults conda
    conda install jupyter

    conda install -c anaconda scikit-learn
    conda install matplotlib
    conda install -c conda-forge opencv
    conda install -c anaconda pandas
    conda install -c conda-forge tensorboard


    conda create --clone py38 --name py38-1

    .gateways.disk.delete:unlink_or_rename_to_trash(143): Could not remove or rename D:\Anaconda2022-08\pkgs\pytorch-1.12.1-py3.9_cuda11.3_cudnn8_0\Lib\site-packages\torch\lib\dnnl.lib. Please remove this file manually (you may need to reboot to free file handles)


    이런 메시지 뜨면,
    conda clean --all

    답글삭제
  5. [설치 오류] OpenSSL appears to be unavailable on this machine. OpenSSL is required to download and install packages:

    https://github.com/conda/conda/issues/11982

    This is due to .dll error

    go to location where you've install anaconda anaconda3>Library>bin. search and copy following dll files

    libcrypto-1_1-x64.dll
    libssl-1_1-x64.dll

    and paste to anaconda3>DLLs.

    then restart your pc.

    issue will get resolved.


    답글삭제
  6. [torch 설치] Solving environment: failed with initial frozen solve. Retrying with flexible solve

    1. 위 lib들을 conda로 먼저 설치 후, torch를 conda로 설치 시에 발생

    2. 이후에 conda로 설치하는 lib는 계속 이와 같은 오류 발생

    3. 해결책으로 먼저 torch를 설치하는데, pip명령으로 먼저 설치.

    pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116

    그 다음, conda로 git, jupyter, ...등을 차례로 설치함.



    답글삭제
  7. >python -m venv example
    >cd example
    >Scripts\activate.bat
    (example) >

    python -m pip install --upgrade pip
    pip install jupyter
    pip install pandas
    pip install openc-python
    pip install scikit-learn
    pip install matplotlib

    nvcc -V

    답글삭제