Update tech_docs/linux/conda_install.md
This commit is contained in:
@@ -82,13 +82,78 @@ c.ServerApp.open_browser = False
|
||||
jupyter lab password
|
||||
```
|
||||
|
||||
## Step 10: Save the environment configuration
|
||||
Sure! Here's a refactored version of the section on saving and using the environment configuration:
|
||||
|
||||
```bash
|
||||
conda env export > environment.yml
|
||||
```
|
||||
## Step 10: Save and Use the Environment Configuration
|
||||
|
||||
This command saves the current environment's configuration, including the installed packages and their versions, to a file named `environment.yml`.
|
||||
### A. Export the Environment Configuration
|
||||
|
||||
1. Activate your Conda environment:
|
||||
```bash
|
||||
conda activate myenv
|
||||
```
|
||||
|
||||
2. Export the current environment's configuration to a file named `environment.yml`:
|
||||
```bash
|
||||
conda env export > environment.yml
|
||||
```
|
||||
|
||||
This command saves the list of packages and their versions to the `environment.yml` file in the current directory.
|
||||
|
||||
3. Verify that the `environment.yml` file was created:
|
||||
```bash
|
||||
ls
|
||||
cat environment.yml
|
||||
```
|
||||
|
||||
The `ls` command lists the files in the current directory, and `cat` displays the contents of the `environment.yml` file.
|
||||
|
||||
### B. Create a New Environment Using the `environment.yml` File
|
||||
|
||||
1. To create a new environment using the `environment.yml` file, use the following command:
|
||||
```bash
|
||||
conda env create -f environment.yml
|
||||
```
|
||||
|
||||
This command creates a new Conda environment with the same name as specified in the `environment.yml` file and installs all the packages listed in the file.
|
||||
|
||||
2. Activate the newly created environment:
|
||||
```bash
|
||||
conda activate myenv
|
||||
```
|
||||
|
||||
### C. Update an Existing Environment Using the `environment.yml` File
|
||||
|
||||
1. To update an existing environment to match the specifications in the `environment.yml` file, use the `--prune` option:
|
||||
```bash
|
||||
conda env update --file environment.yml --prune
|
||||
```
|
||||
|
||||
This command updates the existing environment, removing any packages that are not listed in the `environment.yml` file.
|
||||
|
||||
### D. Share and Version Control the `environment.yml` File
|
||||
|
||||
1. Store the `environment.yml` file in a GitHub repository along with your project files to version control your environment and make it easily accessible to others.
|
||||
|
||||
2. To recreate the environment on another machine or in a different location, navigate to the directory containing the `environment.yml` file and run the `conda env create` command as shown in Step B.
|
||||
|
||||
### E. Deactivate and Remove an Environment
|
||||
|
||||
1. To deactivate the current environment and return to the base environment, use the following command:
|
||||
```bash
|
||||
conda deactivate
|
||||
```
|
||||
|
||||
2. To remove an environment and all its packages, use the following command:
|
||||
```bash
|
||||
conda env remove --name myenv
|
||||
```
|
||||
|
||||
Replace `myenv` with the name of the environment you want to remove.
|
||||
|
||||
By following these steps, you can easily export, create, update, share, and remove Conda environments using the `environment.yml` file. This file serves as a blueprint for your environment, ensuring reproducibility and portability across different machines and users.
|
||||
|
||||
Remember to replace `myenv` with the actual name of your environment throughout the process.
|
||||
|
||||
## Step 11: Start JupyterLab
|
||||
|
||||
|
||||
Reference in New Issue
Block a user