# Virtual environments
Virtual environments create isolated and self-contained workspaces, allowing us to manage project-specific dependencies separately from system-wide installations. This isolation has several benefits:
- **Avoid dependency conflicts:** prevents interference between project-specific and system-wide dependencies, such as common errors related to version mismatches.
- **Transparency and Open Science:** Ensures that others can replicate your results and reproduce your analysis reliably.

![environments](../static/environment.jpg)

To create and activate your virtual environment, follow these steps:
1. Navigate to the directory where you want to create the environment using the `cd` command in the terminal.
2. Create the virtual environment:

```bash
python3 -m venv <your_environment_name>
```

3. Activate the virtual environment:

```bash
source /path/to/environment/bin/activate
```




```{admonition} Want to check more extra content?
:class: tip

Head back to the [main extra content page](../book/extra.md) to explore the others!

``` 


<!--
### Python Environment

MEG QC has compatiblity issues with older Python versions (prior to 3.9), therefore it's necessary to upgrade your Python version. Environments allows one to work with specific versions of Python itself without affecting other projects within the same network or the OS itself.


**[pyenv](https://github.com/pyenv/pyenv)** is a simple python version management. It let's you easily swtich between multiple versions of Python. In their github you can find the instruction to install pyenv, create your own environment with your desired Python version and activate it. 
-->
