Skip to content
GitLab
  • Explore
  • Sign in
  • EDA Guides
  • eda-servers-guide
  • Wiki
  • virtualenv

virtualenv · Changes

Page history
Update virtualenv authored May 07, 2021 by Daniele Jahier Pagliari's avatar Daniele Jahier Pagliari
Show whitespace changes
Inline Side-by-side
virtualenv.md
View page @ e23e746f
......@@ -2,23 +2,33 @@
Python Virtual Environments (or virtualenvs) are a mechanism to install Python packages not available system-wide, in user directories. They also allow you to have a different Python environment for each project, which is useful for example when you need different versions of the same package for different projects.
A complete guide on virtualenvs can be found [here](https://docs.python.org/3/tutorial/venv.html). Next, we report only some basic commands.
A complete guide on virtualenvs can be found [here](https://docs.python.org/3/tutorial/venv.html). Next, we report only some basic commands, with default options.
#### Creating a Virtualenv
Create a Python3 virtualenv in the folder `./pyenv` (done once per project):
To create a Python3 virtualenv in the folder `./pyenv` type the following command:
```
python3 -m venv --system-site-packages ./pyenv
```
This must be done just once per project.
Activate the virtualenv (done for each new shell from where you want to execute code belonging to the project):
#### Activating a Virtualenv
To ativate the virtualenv created above, type the following command:
```
source ./pyenv/bin/activate
```
This must be done for each new shell from where you want to execute code belonging to the project.
#### Deactivating a Virtualenv
Deactivate the virtualenv (the `deactivate` command is created when you activate your environment):
To deactivate the virtualenv, type the following command:
```
deactivate
```
Note that the `deactivate` command is created when you activate the virtualenv.
#### Installing Packages within a Virtualenv
After activating a virtualenv, you can install new packages without special permissions using `pip` (guide [here](https://packaging.python.org/tutorials/installing-packages/#installing-from-pypi)). Those packages will be only available within that virtualenv.
After activating a virtualenv, you can install new packages without special permissions using `pip`. You can find a guide on pip [here](https://packaging.python.org/tutorials/installing-packages/#installing-from-pypi). All packages installed within a virtualenv will be only available as long as it is active.
Clone repository
Home

Servers Information
Accounts
Connecting to the Servers
Storage Management and Quotas
Monitoring Resources
Software, Libraries and Data
  • Using Custom Software
  • Software Modules on Philae
  • Remote Code Deployment
  • Python Virtual Environments
  • EDA Technology Libraries
  • Shared Datasets
Miscellaneous Settings
  • Setting CUDA Drivers
  • Choosing which GPU to Use
  • Limiting the GPU Memory
Gitlab

Sidebar