Skip to content

Detailed Installation Guide

If it's the first time you will use python, or there's a long time since you used it last, you can review some key concepts by reading some key concepts about python projects

Note

Due to legal reason, we can't use Conda at Infopro Digital, our activities are commercials.

Following some change in their policies during the past years, Conda is now free only for companies with less than 200 peoples, students, individuals.

As per recommended python development environments at Infopro Digital, this project use pyenv and poetry.

pyenv allows you to manage multiple versions of Python on a single machine.
poetry is a dependency management and packaging tool for Python.

Note

If you are on Windows, make sure you have WSL/2 installed and ready to run with an Ubuntu / Debian distribution.

Environment requirements

Step 1: System packages

With Python, you'll often use packages or libraries that need C/C++ build system to compile from sources.

As exemple, when installing a specific version of python with pyenv, some librairies are compliled for your system.

To ensure all of your compilation needs are covered, you'll install this apt packages :

apt install -y build-essential zlib1g-dev libssl-dev libffi-dev software-properties-common libbz2-dev libncurses-dev \
    libncursesw5-dev libgdbm-dev liblzma-dev libsqlite3-dev libgdbm-compat-dev libreadline-dev python3-pip

Beaware that python3-pip will install (if not already installed) the latest version of python natively supported by your distribution (3.10 for Ubuntu 22.04). You can either use python 3.10 or use the recommended version (see file .python-version).

Step 2: Install pyenv

To install pyenv, run the following commands in your terminal:

curl https://pyenv.run | bash
Add the following lines to your ~/.bashrc (or ~/.zshrc if you are using zsh) to configure pyenv:

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Reload your shell:

source ~/.bashrc  # or source ~/.zshrc

Step 3: Install a Python Version

Use pyenv to install the version of Python you want to use. For example, to install the latest Python 3.12:

pyenv install 3.12

Set this version as the global default version:

pyenv global 3.12

Step 4: Installing Poetry

To prevent any conflicts and ensure that your system or own application won't break your poetry install, we will install poetry with pipx. For alternatives/manual installs, see documentation : https://python-poetry.org/docs/

  1. If you need to install pipx, see https://pipx.pypa.io/stable/installation/
  2. pipx install poetry

Poetry has the ability to create/use multiple virtual environment for your project. By default poetry will create your project virtual environment in $HOME/.cache/pypoetry/virtualenvs. This is not the recommended way to do it at Infopro Digital. If you don't have specific needs, we strongly suggest that you host your virtualenv(s) in your project inside a .venv directory, your IDE will have an easier time managing it for auto completion / code insight.

To host your virtual env,

poetry config virtualenvs.in-project true

Setup RAG Core using Poetry

Step 1: Clone the project

git clone https://gitlab.com/ipd4/ipd/applications/poc/ai/rag-core.git
Move to the project directory
cd rag-core

Step 2: Install dependancies

Navigate to the directory where you cloned the project and run the following command:

poetry install

🎉 Congrats

You're all set and ready to code ! 🧑‍💻


Setup your own project repository

Step 1: Create your repository

Create a new project:

  • Click on the "+" button in the top bar and select "New project".
  • Choose "Create blank project".
  • Enter a Project name and optional Project description.
  • Choose the Visibility level (Public, Internal, or Private).
  • Click "Create project".

Step 2: Push the cloned project to your new GitLab Repository

  1. Navigate to the cloned project directory
    cd <your_path>/rag-core
    
  2. Remove the existing remote (origin) associated with the cloned repository:
    git remote remove origin
    
  3. Add your new GitLab repository as the remote origin:
    git remote add origin https://gitlab.com/ipd4/ipd/applications/<subgroups>/<your_project>/<your-new-repository>.git
    
    Replace https://gitlab.com/yourusername/your-new-repository.git with the URL of your new GitLab repository.
  4. Push the cloned project to your new GitLab repository:
    git push -u origin main
    
    If your default branch is not main, replace main with your default branch name.

Windows, with WSL2

Ensure you have WSL2 installed with a Debian/Ubuntu distribution.

curl https://pyenv.run | bash