From d3de463e1553a44b009d1d73d4560fffd4af17e8 Mon Sep 17 00:00:00 2001 From: Rockwood Frank <43915594+rockwoodfrank@users.noreply.github.com> Date: Fri, 6 Jun 2025 14:10:06 -0700 Subject: [PATCH] Dependency troubleshooting guide I found the information on how to work with virtual environments for another project I was working on. I wanted to put a guide in here so we don't have to worry about path variables anymore. --- README.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ef73d1..92fd9b7 100644 --- a/README.md +++ b/README.md @@ -35,20 +35,42 @@ source lab_python_env/bin/Activate.ps1 ``` **Install the dependencies** ``` -pip install -r dependencies.txt +lab_python_env/bin/pip install -r dependencies.txt ``` **Update Dependencies file** Warning, running this command will overwrite the current dependencies file with EVERY python package found in the current running python enviornment. Make sure the correct virtual enviornment is setup before updating. ``` -pip freeeze > dependencies.txt +lab_python_env/bin/pip freeeze > dependencies.txt ``` - - - Python 3.8+ - Visa Backend - NI - VISA - PyVisa-Py - USB → GPIB Driver - Keysight Connection Expert + +**If python modules can't be found when running** +Instead of messing with which path to use, run a virtual environment: +1. Make sure a virtual environment exists in the directory(should be called "lab_python_env" or something similar) + - See "Activate the Virtual Environment" above. +2. Make sure VS Code knows which interpreter to use: + - Open the command pallete(ctrl+shift+P) + - Type "Python: Select Interpreter" and choose that option + - At the bottom should be the venv for this environment. Choose that. +3. Activate the environment in the command line(optional) + - On the command line, type in the command +``` +source lab_python_env/bin/activate +``` + - Prompts on the command should now start with `(lab_python_env)` +4. Commands need to be run from the "virtual" python. + - To run python commands, run +``` +lab_python_env\bin\python +``` + - To install modules with pip, run +``` +lab_python_env\bin\pip +```