Skip to content
Snippets Groups Projects
Commit 71377cf5 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

Merge branch 'doc/convert_README_from_rst_to_MD' into 'master'

doc[README][RTD]: Refactor README from RST to MarkDown and add jupyter usage installation instructions.

See merge request !1048
parents 1525a582 72fe0589
No related branches found
No related tags found
1 merge request!1048doc[README][RTD]: Refactor README from RST to MarkDown and add jupyter usage installation instructions.
This diff is collapsed.
...@@ -11,48 +11,75 @@ to do this. ...@@ -11,48 +11,75 @@ to do this.
## Installation using python virtual environment - recommended ## Installation using python virtual environment - recommended
`pycalibration` uses the same version of Python as Karabo, which in June 2021 `pycalibration` uses Python 3.11. Currently the default python installation on Maxwell
updated to use Python 3.11. Currently the default python installation on Maxwell
is still Python 3.9, so Python 3.11 needs to be loaded from a different is still Python 3.9, so Python 3.11 needs to be loaded from a different
location. location.
Therefore `pyenv` is used, we provide a pyenv installation at We use `pyenv` to manage different Python versions. A pyenv installation is provided at
`/gpfs/exfel/sw/calsoft/.pyenv` which we use to manage different versions of `/gpfs/exfel/sw/calsoft/.pyenv`.
python. This can be activated with ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate``
A quick setup would be: To install pycalibration, follow these steps:
1. `source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate`
2. `git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git && cd pycalibration` -
clone the offline calibration package from EuXFEL GitLab
3. `pyenv shell 3.11.9` - load required version of python
4. `python3 -m venv .venv` - create the virtual environment
5. `source .venv/bin/activate` - activate the virtual environment
6. `python3 -m pip install --upgrade pip` - upgrade version of pip
7. `python3 -m pip install .` - install the pycalibration package (add
`-e` flag for editable development installation)
Copy/paste script:
```bash ```bash
# Activate pyenv
source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate
# Clone the repository
git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git
cd pycalibration cd pycalibration
# Set up Python environment
pyenv shell 3.11.9 pyenv shell 3.11.9
python3 -m venv .venv python3 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
# Install pycalibration
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
python3 -m pip install . # `-e` flag for editable install, e.g. `pip install -e .` # Use 'pip install -e .' for editable install
python3 -m pip install .
``` ```
## Working with Jupyter Notebooks
If you plan to work with Jupyter notebooks interactively, you have two main options:
### Option 1: Install Jupyter Notebook locally
if you prefer to run Jupyter notebooks on your local machine or on Maxwell, you can install the `notebook` package in your virtual environment:
```bash
python3 -m pip install notebook==6.2.0
```
After installation, you can start a Jupyter notebook server by running:
```bash
jupyter notebook
```
### Option 2: Use max-jhub (Recommended)
Alternatively, we recommend using max-jhub, a JupyterHub instance available at DESY.
This option provides a convenient web-based environment for running Jupyter notebooks without needing to set up everything locally.
For detailed instructions on how to use max-jhub, please refer to these documentations:
- [Max-jhub DESY Documentation](https://confluence.desy.de/display/MXW/JupyterHub+on+Maxwell)
- [Max-jhub EuXFEL User Documentation](https://rtd.xfel.eu/docs/data-analysis-user-documentation/en/latest/jhub/#via-max-jhub-recommended)
To use max-jhub effectively with pycalibration, make sure you've created an ipython kernel as
described in the [Creating an ipython kernel for virtual environments](#creating-an-ipython-kernel-for-virtual-environments) section below.
## Creating an ipython kernel for virtual environments ## Creating an ipython kernel for virtual environments
To create an ipython kernel with pycalibration available you should (if To create an ipython kernel with pycalibration available you should (if
using a venv) activate the virtual environment first, and then run: using a venv) activate the virtual environment first, and then run:
```bash ```bash
python3 -m pip install ipykernel # If not using a venv add `--user` flag # If not using a venv add `--user` flag
python3 -m ipykernel install --user --name pycalibration --display-name "pycalibration" # If not using a venv pick different name python3 -m pip install ipykernel
# If not using a venv pick different name
python3 -m ipykernel install --user --name pycalibration --display-name "pycalibration"
``` ```
This can be useful for Jupyter notebook tools as [max-jhub documentation](https://rtd.xfel.eu/docs/data-analysis-user-documentation/en/latest/jhub/)([max-jhub](https://max-jhub.desy.de/hub/login)) This can be useful for Jupyter notebook tools as [max-jhub documentation](https://rtd.xfel.eu/docs/data-analysis-user-documentation/en/latest/jhub/)([max-jhub](https://max-jhub.desy.de/hub/login))
...@@ -65,17 +92,12 @@ GitLab. ...@@ -65,17 +92,12 @@ GitLab.
To set up the keys: To set up the keys:
1. Connect to Maxwell 1. Connect to Maxwell
2. Generate a new keypair with `ssh-keygen -o -a 100 -t ed25519`, you 2. Generate a new keypair with `ssh-keygen -o -a 100 -t ed25519`, you can either leave this in the default location (`~/.ssh/id_ed25519`) or place it into a separate directory to make management of keys easier if you already have multiple ones.
can either leave this in the default location (`~/.ssh/id_ed25519`) If you are using a password for your keys please check this page to learn how to manage them: <https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent>
or place it into a separate directory to make management of keys 3. Add the public key (`id_ed25519.pub`) to your account on GitLab:
easier if you already have multiple ones. If you are using a
password for your keys please check this page to learn how to manage
them:
<https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent>
3. Add the public key (`id_ed25519.pub`) to your account on GitLab:
<https://git.xfel.eu/gitlab/profile/keys> <https://git.xfel.eu/gitlab/profile/keys>
4. Add the following to your `~/.ssh/config` file 4. Add the following to your `~/.ssh/config` file
```bash ```bash
# Special flags for gitlab over SSH # Special flags for gitlab over SSH
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment