Create conda python env with spivet for multiusers

  1. Export existing env:
conda env export -n py27_bak > py27_bak.yml
  1. Modify the first line (name) (and last line(path), does not work) of .yml file:
name: py27_piv
  1. Create the new env:
conda env create -f py27_bak.yml -p /data/shared/conda_env/py27_piv
an pip subprocess with arguments:
['/data/shared/conda_env/py27_piv/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/xbao/condaenv.c9qp2cks.requirements.txt']
Pip subprocess output:

Pip subprocess error:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at
ERROR: Could not find a version that satisfies the requirement spivet==1.0 (from -r /home/xbao/condaenv.c9qp2cks.requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for spivet==1.0 (from -r /home/xbao/condaenv.c9qp2cks.requirements.txt (line 1))

CondaEnvException: Pip failed

add this in ~/.condarc

  - /data/shared/conda_env/

so we can use

conda activate py27_piv 

instead of

conda activate /data/shared/conda_env/py27_piv 
  1. spivet and vtk5 cannot be done via pip, install them manually.
conda activate /data/shared/conda_env/py27_piv 

cd ~/vtk5/vtk-build
module load gcc/5.5.0
-DCMAKE_INSTALL_PREFIX=/data/shared/conda_env/py27_piv/ -Wno-dev \
-DPYTHON_INCLUDE_DIR=/data/shared/conda_env/py27_piv/include/python2.7 \
-DPYTHON_LIBRARY=/data/shared/conda_env/py27_piv/lib/ \
make -j 112
make install

Then copy the vtk ld_library_path settings to the new env:

cp /home/xbao/.conda/envs/py27_bak/etc/conda/activate.d/ /data/shared/conda_env/py27_piv/etc/conda/activate.d/
cp /home/xbao/.conda/envs/py27_bak/etc/conda/deactivate.d/ /data/shared/conda_env/py27_piv/etc/conda/deactivate.d/

And modify the path inside:
change the last line in activate.d/ to

export LD_LIBRARY_PATH=/data/shared/conda_env/py27_piv/lib/vtk-5.10/:${LD_LIBRARY_PATH}

Then re-enter the env.
In spivet root dir, change /home/xbao/.conda/envs/py27_bak in lib/spivet/pivlib/pivsimc.c to /data/shared/conda_env/py27_piv, then

python build
python install
cd tests
  1. Under user zsc:
    add the dir in .condarc, then,
conda create --clone py27_piv --p /home/zsc/.conda/envs/py27_piv_own

Don't forget to change pivsimc.c:

PyRun_SimpleString("import sys;sys.path.append('/home/zsc/.conda/envs/py27_piv_own/lib/python2.7/site-packages/spivet/pivlib')");

Delete unwanted kernel:

jupyter kernelspec uninstall kernelname