Refactor README to use Miniforge and conda-forge for env setup; remove unreliable shell script instructions
This commit is contained in:
42
README.md
42
README.md
@ -30,7 +30,7 @@ For **Windows** users, the following are required:
|
||||
|
||||
1. **Git Bash**: Install [Git Bash](https://git-scm.com/downloads) to run shell scripts (`.sh` files).
|
||||
|
||||
2. **Conda**: Install [Anaconda](https://www.anaconda.com/products/individual) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
2. **Miniforge**: Install [Miniforge](https://conda-forge.org/download/).
|
||||
|
||||
3. **PSI Network Access**
|
||||
|
||||
@ -44,9 +44,9 @@ For **Windows** users, the following are required:
|
||||
|
||||
### Download DIMA
|
||||
|
||||
Open a **Git Bash** terminal.
|
||||
Open a **Git Bash** terminal (or a terminal of your choice).
|
||||
|
||||
Navigate to your `Gitea` folder, clone the repository, and navigate to the `dima` folder as follows:
|
||||
Navigate to your `Gitea` folder, clone the repository, and move into the `dima` directory:
|
||||
|
||||
```bash
|
||||
cd path/to/Gitea
|
||||
@ -54,46 +54,42 @@ Navigate to your `Gitea` folder, clone the repository, and navigate to the `dima
|
||||
cd dima
|
||||
```
|
||||
|
||||
### Install Python Interpreter
|
||||
### Install Python Environment Using Miniforge and conda-forge
|
||||
|
||||
Open **Git Bash** terminal.
|
||||
We recommend using Miniforge to manage your conda environments. Miniforge ensures compatibility with packages from the conda-forge channel.
|
||||
|
||||
**Option 1**: Install a suitable conda environment `multiphase_chemistry_env` inside the repository `dima` as follows:
|
||||
1. Make sure you have installed **Miniforge**.
|
||||
|
||||
2. Create the Environment from `environment.yml`
|
||||
After installing Miniforge, open **Miniforge Prompt** or a terminal with access to conda and run:
|
||||
```bash
|
||||
cd path/to/GitLab/dima
|
||||
Bash setup_env.sh
|
||||
```
|
||||
|
||||
Open **Anaconda Prompt** or a terminal with access to conda.
|
||||
|
||||
**Option 2**: Install conda enviroment from YAML file as follows:
|
||||
```bash
|
||||
cd path/to/GitLab/dima
|
||||
cd path/to/Gitea/dima
|
||||
conda env create --file environment.yml
|
||||
```
|
||||
3. Activate the Environment
|
||||
```bash
|
||||
conda activate dima_env
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary> <b> Working with Jupyter Notebooks </b> </summary>
|
||||
|
||||
We now make the previously installed Python environment `multiphase_chemistry_env` selectable as a kernel in Jupyter's interface.
|
||||
### Working with Jupyter Notebooks
|
||||
We now make the previously installed Python environment `dima_env` selectable as a kernel in Jupyter's interface.
|
||||
|
||||
1. Open an Anaconda Prompt, check if the environment exists, and activate it:
|
||||
```
|
||||
conda env list
|
||||
conda activate multiphase_chemistry_env
|
||||
conda activate dima_env
|
||||
```
|
||||
2. Register the environment in Jupyter:
|
||||
```
|
||||
python -m ipykernel install --user --name multiphase_chemistry_env --display-name "Python (multiphase_chemistry_env)"
|
||||
python -m ipykernel install --user --name dima_env --display-name "Python (dima_env)"
|
||||
```
|
||||
3. Start a Jupyter Notebook by running the command:
|
||||
```
|
||||
jupyter notebook
|
||||
```
|
||||
and select the `multiphase_chemistry_env` environment from the kernel options.
|
||||
and select the `dima_env` environment from the kernel options.
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
## Repository Structure and Software arquitecture
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
name: pyenv5505
|
||||
#prefix: ./envs/pyenv5505 # Custom output folder
|
||||
name: dima_env
|
||||
channels:
|
||||
- conda-forge
|
||||
- defaults
|
||||
dependencies:
|
||||
- python=3.11
|
||||
- jupyter
|
||||
|
47
setup_env.sh
47
setup_env.sh
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the name of the environment
|
||||
ENV_NAME="multiphase_chemistry_env"
|
||||
|
||||
# Check if mamba is available and use it instead of conda for faster installation
|
||||
if command -v mamba &> /dev/null; then
|
||||
CONDA_COMMAND="mamba"
|
||||
else
|
||||
CONDA_COMMAND="conda"
|
||||
fi
|
||||
|
||||
# Create the conda environment with all dependencies, resolving from conda-forge and defaults
|
||||
$CONDA_COMMAND create -y -n "$ENV_NAME" -c conda-forge -c defaults python=3.11 \
|
||||
jupyter numpy h5py pandas matplotlib plotly=5.24 scipy pip
|
||||
|
||||
# Check if the environment was successfully created
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to create the environment '$ENV_NAME'. Please check the logs above for details."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Activate the new environment
|
||||
if source activate "$ENV_NAME" 2>/dev/null || conda activate "$ENV_NAME" 2>/dev/null; then
|
||||
echo "Environment '$ENV_NAME' activated successfully."
|
||||
else
|
||||
echo "Failed to activate the environment '$ENV_NAME'. Please check your conda setup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install additional pip packages only if the environment is activated
|
||||
echo "Installing additional pip packages..."
|
||||
pip install pybis==1.35 igor2 ipykernel sphinx
|
||||
|
||||
# Check if pip installations were successful
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to install pip packages. Please check the logs above for details."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional: Export the environment to a YAML file (commented out)
|
||||
# $CONDA_COMMAND env export -n "$ENV_NAME" > "$ENV_NAME-environment.yaml"
|
||||
|
||||
# Print success message
|
||||
echo "Environment '$ENV_NAME' created and configured successfully."
|
||||
# echo "Environment configuration saved to '$ENV_NAME-environment.yaml'."
|
||||
|
Reference in New Issue
Block a user