The features of each will be given to another page.
There is a bio software package called Qiime, and it is difficult to install it by yourself. I have to install various bio commands,
/ usr / local /
If you can say that, you don't want to touch it. Furthermore, I want to add a new one to the server,
qiime-deloy
is trauma. Does it work now?It feels like
With bio tools, there are tons of small commands and scripts thrown in.
Even if I try to introduce it, I will wear down my nerves in various ways.
Whether there is a command name conflict, how to manage the list installed this time, how to uninstall it, etc.
Furthermore, each of them instructed me to set detailed environment variables, and in a blink of an eye, . * Shrc
was messed up.
As a matter of course, I want an easy environment switching tool (including environment variables).
You can switch commands with the typical virtualenv
and pyenv-virtualenv
, but it is difficult to switch environment variables. On the contrary, direnv
does not touch the management part of the command.
pyenv
(ʻanyenv`)pyenv shell
to skip environment variables on the shell. So that it will be cut off when the work is finishedpython
(?)direnv
.Based on the simple concept of ʻanyenv
direnv`, we decided to install and build the environment.
Below, we will use it as an example assuming that an isolated environment of Qiime-1.8.0 will be created.
CentOS 6.6 (some mac)
anyenv
pyenv
, plenv
, jenv
For now, I don't need any other * env
in practice
python
$ mv .bashrc .bashrc~
$ mv .local .local.bak
.bashrc
is dirty$ PYTHONPATH
goes to read and traverses towards ~ / .local
.If there is something in the common library path such as .local
in the remnants of the past, it should be tidied up
python
$ export PERL5OPT= #<=Only we need
$ git clone https://github.com/riywo/anyenv ~/.anyenv
$ export PATH=${HOME}/.anyenv/bin:$PATH
$ eval "$(anyenv init -)"
python
$ anyenv install pyenv
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.anyenv/envs/pyenv/plugins/pyenv-virtualenv
$ eval "$(anyenv init -)" # exec $SHELL -l
$ pyenv install 2.7.3 # @mac: $ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 2.7.3
$ pyenv install 3.3.6
$ pyenv rehash
pip
used for various installationsOn mac, when installing python
python
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 2.7.3
If you don't, it won't work
pyenv-virtualenv
Create a quarantine environment to use with
You can create multiple environments with the same version of python
python
$ pyenv virtualenv 2.7.3 qiime
$ pyenv rehash
python
module etc. required for Qiime-1.8.0 in $ {HOME} /. Anyenv / envs / pyenv / versions / qiime
.plenv
$ anyenv install plenv
$ plenv install 5.20.1
$ plenv shell 5.20.1
$ plenv install-cpanm
cpanm
is installed separately
jenv
$ anyenv install jenv
$ alternatives --config java
There are 3 programs'java'To provide.
Select command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
* 3 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
$ jenv add /usr/lib/jvm/jre-1.5.0-gcj
$ jenv add /usr/lib/jvm/jre-1.6.0-openjdk.x86_64
$ jenv add /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
If you're a'mac','gnu screen', and a'zsh' user wants to use ʻanyenv` regularly
python
% cd /etc
% sudo mv zshenv zshenv.bak
#% sudo mv zshenv zprofile
I have to do
If you're using'gnu screen'on'CentOS' and you're using'zsh' and want to use ʻanyenv` regularly
python
% cd /etc
% sudo mv zshrc zshrc.bak
Maybe I have to do it (unverified).
direnv
Without
python
$ wget -q https://storage.googleapis.com/golang/go1.4.linux-386.tar.gz
$ tar zxf go1.4.linux-amd64.tar.gz
$ mv go ../bin #Wherever you like
$ cd ../bin/go
$ export GOROOT=$PWD
$ cd go/bin
$ export PATH=$PWD:$PATH
direnv
compile-time error if GOROOT
is not set
python
$ git clone https://github.com/zimbatm/direnv
$ cd direnv
$ make install DESTDIR=/PATH/TO/DIR #Wherever you like
$ eval "$(direnv hook bash)"
python
$ cat /PATH/TO/.envrc
export FOOBAR=foobar
$ cd /PATH/TO
direnv: loading .envrc
direnv: export + FOOBAR
Change the prompt with zsh as well
.envrc
export PROMPT='Qiime-1.8.0 $'
I want to do something, but it doesn't interpret the variables in the prompt, and it's miserable when I move to /
. Is it just my environment?
I don't want to put .envrc
in/
,
Describe the following in .bashrc
.bashrc
export PATH=${HOME}/.anyenv/bin:$PATH
eval "$(anyenv init -)"
eval "$(direnv hook bash)"
Needless to say, the path to ʻanyenv,
direnv` is assumed to pass.
Explicitly enable and install only in that shell, such as with pyenv shell
The individual commands are
python
$ ./configure --prefix=${HOME}/.anyenv/envs/pyenv/versions/qiime
Aim for isolation by
By pyenv rehash
for pyenv
, individual commands (such as the installed ghc
, which will be mentioned separately) will also be synchronized to $ {HOME} /. Anyenv / envs / pyenv / shims
.
python
$ cat ${PYENV_ROOT}/pyenv/shims/ghc
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
program="${0##*/}"
if [ "$program" = "python" ]; then
for arg; do
case "$arg" in
-c* | -- ) break ;;
*/* )
if [ -f "$arg" ]; then
export PYENV_DIR="${arg%/*}"
break
fi
;;
esac
done
fi
export PYENV_ROOT="/PATH/TO/.anyenv/envs/pyenv"
exec "/PATH/TO/.anyenv/envs/pyenv/libexec/pyenv" exec "$program" "$@"
$ which ghc
~/.anyenv/envs/pyenv/shims/ghc
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.3
$ pyenv shell 3.3.6
$ ghc --version
pyenv: ghc: command not found
The `ghc' command exists in these Python versions:
qiime
The same was true for plenv
. Whether you use it or not
Using the function of direnv
For example, only the directories where you want to use Qiime-1.8.0
python
$ cat /PATH/TO/DIR/.envrc
export PYENV_VERSION=qiime
export JENV_VERSION=1.6.0.33
$ direnv allow
If you do
python
$ pyenv versions
* system (set by PYENV_VERSION environment variable)
2.7.3
3.3.6
qiime
$ jenv versions
* system (set by JENV_VERSION environment variable)
1.5
1.5.0
1.6
1.6.0.33
1.7
1.7.0.71
(Omitted)
But
python
$ cd /PATH/TO/DIR
direnv: loading .envrc
direnv: export ~JENV_VERSION ~PYENV_VERSION
$ pyenv versions
system
2.7.3
3.3.6
* qiime (set by PYENV_VERSION environment variable)
$ jenv versions
system
1.5
1.5.0
1.6
* 1.6.0.33 (set by JENV_VERSION environment variable)
1.7
1.7.0.71
(Omitted)
Switch to
Of course, it remains valid in the offspring directory
External commands are also switched properly. ex) blastall
python
$ which blastall
/home/XXXX/.anyenv/envs/pyenv/shims/blastall
$ blastall | head -2 | tail -1
blastall 2.2.26 arguments: # /usr/local/Version in bin
$ cd /PATH/TO/DIR
direnv: loading .envrc
direnv: export ~JENV_VERSION ~PYENV_VERSION
$ which blastall
/home/XXXX/.anyenv/envs/pyenv/shims/blastall
$ blastall | head -2 | tail -1
blastall 2.2.22 arguments: #Desired version
$ cd ../
$ direnv: unloading
$ blastall | head -2 | tail -1
blastall 2.2.26 arguments:
That's fine for personal use, but there are cases where other people on the server want to use it.
So, even if someone else copies the above .bashrc
as it is, ʻanyenv does not work (
direnv works normally as a single unit). If that "other person" is at a level where he can personally install and use ʻanyenv
or direnv
, well, he'll do whatever he wants, but if not.
.bashrc
eval "$(anyenv init -)"
, Instead of embedding it as it is, save the result of ʻeval "$ (anyenv init-)" separately and
sourcein the target person's
.bashrc`.
That way, it behaves as expected.
Recommended Posts