Wednesday Exercise 1.8: Python Installation¶
In this exercise, you will write a wrapper script that installs Python and then use it to run jobs. This exercise should take about 10 minutes.
In the previous exercise, we used a method that pre-built Python and then used that pre-built package to run Python scripts. In this exercise, we will use an alternative method for running Python jobs, by writing a wrapper script that installs Python with every job. This exercise should be done in the same directory as the previous exercise - you will need the same Python source code and
Our wrapper script will need to install Python from the source code and then run our
- Based on the previous exercise, what are the steps we need to install Python? What file can we use for reference?
- We put our installation steps from the previous exercise into a file called
python_install.txt. Based on this, put the installation steps into a script called
run_py.sh2. Check your script against the file below \
#!/bin/bash export PATH mkdir python tar xzf Python-3.6.1.tgz cd Python-3.6.1 ./configure --prefix=$(pwd)/../python make make install cd ..
- We also need to run our
fib.pyscript. We can do so by adding our installation location to the
PATH, or by referencing the installation directly:
python3 fib.py 5\ or\
python/bin/python3 fib.py 5\ Choose whichever method you prefer, and add it to your
- Make your
The submit file for this exercise can be very similar to the last one from Exercise 1.7.
- Make a copy of the submit file from the last exercise. What lines need to change? Make changes as appropriate.
- You need to change the transferred tarball (the Python source, instead of our
prebuilt_python.tar.gz) and the job's executable. Once you've made these changes, submit the job using
- Check for the results in the