Virtual Environment Notes:
Poetry is used to manage dependencies. The expectation is that people will create a Python virtual environment with pyenv and then run some poetry commands to install packages into the virtual environment. For instance, if things are set up correctly, developers can run pyenv exec poetry shell
and then poetry install
in their terminal and all project dependencies will be installed.
Bayard Venv Steps Taken for Install:
- Install the correct python version in pyenv.
pyenv install 3.9.13
- Create Python virtual Environment
pyenv virtualenv 3.9.13 model_planner
Note: The venv is named model_planner. Your terminal will return a path where the folder is. Save this path.
Mine is in: /Users/charlescarlson/.pyenv/versions/3.9.13/envs/model_planner
If you don't have the path save or are confused. Run:
pyenv versions
This will return the versions of python you have installed and return the path of your active pyenv.
- Activite the correct python env: I ran:
source /Users/charlescarlson/.pyenv/versions/3.9.13/envs/model_planner/bin/activate
You need the path to your own pyenv. source is a linux/mac command. I think that in Windows you need to adjust your path variables. This step specifically just to set the python version in terminal, which any OS can do.
- Poetry automatically uses the local pyenv.
poetry install
Gets all current dependecies.
- If that's not working, or if you just want to use the venv more generally, start a shell from it with one of the following commands.
pyenv exec <command>
often the command is
poetry shell