FAQs: Quarchpy Python API installation
The quarchpy Python package allows you to easily automate our tools. The current release of quarchpy requires Python 3.x but we maintain an older download for legacy 2.x users.
Quarchpy can be quickly installed from the command line using pip:
> pip install quarchpy
You can upgrade to the latest version with
> pip install quarchpy –upgrade
The weblink for download is here
Linux: Python Default Install Locations
Most Linux OSs have Python 2 and Python 3 preinstalled on them. Each python versions also have 2 default locations for python packages in the root directory and user directory. This makes running the correct version of a package a pain if changing from running with SUDO vs non-SUDO.
I the worst case scenario you could end up with 4 different versions. Below I’ve populated a table with example versions of QuarchPy, the install command used to install it in that location, and the command to run a script utilizing the QuarchPy version at each location.
|
Python2 |
Python3 |
Root |
QuarchPy v1.1 sudo pip install quarchpy==1.1 sudo python -m … |
QuarchPy v1.2 sudo pip3 install quarchpy==1.2 sudo python3 -m … |
User |
QuarchPy v1.3 pip install quarchpy==1.3 python -m … |
QuarchPy 1.4 pip3 install quarchpy==1.3 python3 -m … |
Root installs can be picked up by all users, (This is similar to “install for all users” options on windows machines), but user level installs cannot be picked up by root. Python 2 was deprecated in 2020. For these two reasons we recommend installing QuarchPy in one location root, python3 so python3 test script run by any user and root can all use the same version. “sudo pip3 install QuarchPy”
If you find yourself with multiple installs on the same machine in different locations. Just follow these instructions to uninstall any other QuarchPy installs and install the latest QuarchPy in one location only.
Please make sure you have no python scripts running that may be using QuarchPy as this will prevent it from being uninstalled. Also kill any QIS or QPS processes you may have running. They can be run heedlessly so use ps aux
to find and then kill the process. Repeat the process for qis
and qps
.
ps aux | grep qis
sudo kill -9 [PID]
Please run the following commands in order to uninstall all QuarchPy installs on the machine.
pip uninstall quarchpy
sudo pip uninstall quarchpy
pip3 uninstall quarchpy
sudo pip3 uninstall quarchpy
Then run the same 4 commands again.
You should see “WARNING: Skipping quarchpy as it is not installed
” as a response from each of the 4 commands.
If you see the 4 warnings you don’t have QuarchPy installed in any of the default locations and you can install QuarchPy again:
sudo pip3 install quarchpy
After a new install of QuarchPy you can run:
python3 -m quarchpy.run qis -terminal
Local QuarchPy
If you have moved QuarchPy to a folder and the script you are running is at the same level as the QuarchPy package that version will be used. This can be confusing if you don’t realize it is there, but it can also be useful for comparing QuarchPy versions.
In the example below running MyTestScript.py will pick up the version of QuarchPy withing the folder. So be sure that this is done intentionally.
ComparingQuarchpy
├───TestQuarchpy2.2.1
│ │ MyTestScript.py
│ │
│ └───quarchpy
└───TestQuarchpy2.3.1
│ MyTestScript.py
│
└───quarchpy
Virtual Environments
Virtual environment can be used to create different python setups.
If you are using a virtual environment your packages will be stored in there and the default locations will not be used. Make sure you install the correct QuarchPy version inside your virtual environments and be aware that if you run the script outside of your IDE you may need to install packages in your default python location for it to run correctly