How to install python or check if you have a current installation is different depending on your operating system.
Python ships preinstalled with all MacOS versions, but you should make sure to have an updated version. Until recently, the verison of python pre-installed on macs was 2.7. The version that I currently recommend (11/17/2020) for our lab is Python 3.7 or 3.8, since compatability with 3.9 is not complete with all tools that we use.
To check your version of python, open the terminal app and enter the command
python3
If you have python version 3 installed on your system, you should see something like this:
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
To exit:
>>> quit()
If you instead saw an error message along the lines of command not found
or if your python version was less than 3.7, you need to install python.
If using FAPROTAX is the only resaon you plan on using python, then you should install the base version of python from here. Install version 3.7 or 3.8, not 3.9. Follow the prompts after downloading the file, and you should be mostly set.
pip is a useful tool for downloading and installing packages (libraries for R
people) to your python installation. It should come preinstalled with python. To check, type pip
into your terminal. You should see something like:
pip
##
## Usage:
## pip <command> [options]
##
## Commands:
## install Install packages.
## download Download packages.
## uninstall Uninstall packages.
## freeze Output installed packages in requirements format.
## list List installed packages.
## show Show information about installed packages.
## check Verify installed packages have compatible dependencies.
## config Manage local and global configuration.
## search Search PyPI for packages.
## wheel Build wheels from your requirements.
## hash Compute hashes of package archives.
## completion A helper command used for command completion.
## help Show help for commands.
##
## General Options:
## -h, --help Show help.
## --isolated Run pip in an isolated mode, ignoring
## environment variables and user configuration.
## -v, --verbose Give more output. Option is additive, and can be
## used up to 3 times.
## -V, --version Show version and exit.
## -q, --quiet Give less output. Option is additive, and can be
## used up to 3 times (corresponding to WARNING,
## ERROR, and CRITICAL logging levels).
## --log <path> Path to a verbose appending log.
## --proxy <proxy> Specify a proxy in the form
## [user:passwd@]proxy.server:port.
## --retries <retries> Maximum number of retries each connection should
## attempt (default 5 times).
## --timeout <sec> Set the socket timeout (default 15 seconds).
## --exists-action <action> Default action when a path already exists:
## (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
## --trusted-host <hostname> Mark this host as trusted, even though it does
## not have valid or any HTTPS.
## --cert <path> Path to alternate CA bundle.
## --client-cert <path> Path to SSL client certificate, a single file
## containing the private key and the certificate
## in PEM format.
## --cache-dir <dir> Store the cache data in <dir>.
## --no-cache-dir Disable the cache.
## --disable-pip-version-check
## Don't periodically check PyPI to determine
## whether a new version of pip is available for
## download. Implied with --no-index.
## --no-color Suppress colored output
If not, download pip here.
numpy is the only required package for running FAPROTAX. If it is not installed on your system, you can install it like this:
pip install numpy
Checking for python works much the same, only you will type commands into the Command Prompt rather than the terminal.
To check your version of python, open the terminal app and enter the command
python3
If you have python version 3 installed on your system, you should see something like this:
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
Type "help", "copyright", "credits" or "license" for more information.
>>>
If you instead saw an error message along the lines of command not found
or if your python version was less than 3.7, you need to install python.
If using FAPROTAX is the only resaon you plan on using python, then you should install the base version of python from here. Install version 3.7 or 3.8, not 3.9. Follow the prompts after downloading the file, and you should be mostly set.
pip is a useful tool for downloading and installing packages (libraries for R
people) to your python installation. It should come preinstalled with python. To check:
python3 pip
If nothing happens or if you recieve an error, pip may be installed but not on your environmental path. Follow instructions here to make sure that both python3 and pip are accessible form your path. You do not usually need to do this. One possible problem that I’ve seen is where Windows 10 prioiritizes a broken installation of python before the newer one. You can examine the order of environmental variables in your path to check.
If needed, download pip here.
numpy is the only required package for running FAPROTAX. If it is not installed on your system, you can install it like this:
pip install numpy
If you think you’d like to spend more time with python, you could check out installing python using Anaconda. It will come with pip and nump already installed, along with many other packages useful for scientific programming.
This installation has many many bells and whistles, and comes with a nice code editing interface. It’s a good way to get started with jupyter notebooks, which can be very convenient.
Personally, I prefer to write my code using TextMate.
If you’re new to programming in python but are interested in its applications and usefulness to studying biology, I definitely recommend exploring Rosalind.