leginon-org / leginon-redmine-archive

1 stars 0 forks source link

Using Miniconda to simplify deployment of Leginon/Appion #7949

Open leginonbot opened 7 months ago

leginonbot commented 7 months ago

Author Name: Scott Stagg (Scott Stagg) Original Redmine Issue: 7949, https://emg.nysbc.org/redmine/issues/7949 Original Date: 2019-08-20


This issue was created to log my attempts to find a single command Miniconda python installation that will setup python and all the pythonic dependencies without requiring root. Additionally, with the use of environment modules, Miniconda will allow users to easily switch between different python environments.

leginonbot commented 7 months ago

Original Redmine Comment Author Name: Scott Stagg (Scott Stagg) Original Date: 2019-08-20T15:08:50Z


In this example, I install python2 and python3 environments and run them from within the same shell.

#first we get the minicondas
wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

#then we install them. At the installation stage it is important to have a clean environment with no PYTHONPATHS set
bash Miniconda2-latest-Linux-x86_64.sh -b -p /gpfs/home/sstagg/miniconda2_test
bash Miniconda3-latest-Linux-x86_64.sh -b -p /gpfs/home/sstagg/miniconda3_test

#then we install dependencies
./miniconda2_test/bin/conda install scipy numpy matplotlib
./miniconda3_test/bin/conda install scipy numpy matplotlib

Now we have two different python environments in my home directory

In the following test scripts, I have each script call its own python by having them point to the right python in the #! line at the top of the script. test2.py

#!/gpfs/home/sstagg/miniconda2_test/bin/python

import numpy
import matplotlib
from matplotlib import pyplot

print "Using python2.7"
print "numpy version", numpy.__version__, numpy.__path__
print "matplotlib version", matplotlib.__version__, matplotlib.__path__
x=numpy.arange(1,100,1)
y=x*x
pyplot.plot(x,y)
pyplot.show()
</code>

test3.py

#!/gpfs/home/sstagg/miniconda2_test/bin/python

import numpy
import matplotlib
from matplotlib import pyplot

print ("Using python3.7.3")
print ("numpy version", numpy.__version__, numpy.__path__)
print ("matplotlib version", matplotlib.__version__, matplotlib.__path__)
x=numpy.arange(1,100,1)
y=x*x
pyplot.plot(x,y)
pyplot.show()
</code>