Installation

Obtaining the code

Download the code via the tagged releases posted on the github releases page or by cloning the source code with the following:

$ git clone https://github.com/pcdshub/pytmc.git

Installing in an environment

Create a python virtual environment using conda and install the pytmc in that environment.

Begin by creating an environment and replacing [env-name] with the name of your environment. If you’re installing pytmc in a preexisting environment, you may skip this step.

$ conda create --name [env-name]

Activate your environment.

$ source activate [env-name]

Install pip in the current environment if it is not already. If pip is not installed in your environment, the system will default to using pip in the root environment. When the root environment’s version of pip is used. Pip will attempt to install the package in the root envirnoment as well.

$ conda install pip

After cloning or unzipping the package, navigate to the base directory of pytmc. There you will find a file titled setup.py and another titles requirements.txt. Run the following commands from this directory. Make sure to install pip in this conda environment prior to installing tools with pip. Using pip in an environment lacking a pip installation will install pytmc in your root environment.

$ # Install pytmc's dependencies
$ pip install -r requirements.txt
$ # Install pytmc to your environment
$ pip install .

Note

The last line in the code snippet above has a ‘.’ at the end. It is very difficult to see with certain browsers.

Testing the installation

If you’ve followed the previous steps correctly, pytmc should be installed now. This can be tested by seeing if the following bash commands can be found.

$ pytmc --help

Alternatively, a python shell can be opened and you can attempt to import pytmc.

>>> import pytmc

Note

While all of these instructions should work with python environments managed by virtualenv and pipenv, only conda has been tested.

Installing for development

To develop pytmc it is best to use a development install. This allows changes to the code to be immediately reflected in the program’s functionality without needing to reinstall the code.This can be done by following the Installing in an environment section but with one change. The following code snippet should be removed:

$ # Don't use this step for a development install
$ pip install .

In place of the removed command, use the following to do a development install.

$ # Use this command instead
$ pip install -e .