Minimum Python Version Maximum Python Version Tested Supported Python Versions

This project has been tested and is compatible with Python versions 3.9, 3.10, 3.11, and 3.12. While it might work on other versions, these are the officially supported and tested ones.

Getting Started#

Before you can run this project, you need to have python installed on your system

Option 1: Setting up a Python Virtual Enviroment (venv)#

This is the standard way to create an isolated Python enviroment.

Steps:

  1. Install pip (if you don’t have it):

 python -m ensurepip --default-pip

or on some systems:

 sudo apt update
 sudo apt install python3-pip
  1. Create a virtual enviroment:

   python -m venv venv

This command creatas a new directory named venv (you can choose a different name if you prefer) containing a copy of the Python interpreter and necessary supporting files.

  1. Activate the virtual enviroment:

  • On macOS and Linux:

  source venv/bin/activate
  • On Windows (command promt):

  venv\Scripts\activate
  • On Windows (PowerShell):

  .\venv\Scripts\Activate.ps1

Once the activated, you’ll see (venv) at the beginning of your terminal promt.

  1. Install project dependencies: Once the virtual enviroment is activated, you can install the required packages listed in the requirements.txt file:

pip install  .
  1. macOS Users: Install OpenMP for XGBoost (Required)

    On macOS, XGBoost requires the OpenMP library. Install it using Homebrew:

    brew install libomp
    

    If you don’t have Homebrew installed, visit https://brew.sh/ for installation instructions.

    After installing OpenMP, you may need to reinstall XGBoost:

    pip install --force-reinstall xgboost
    
  2. Deactivate the virtual enviroment (when you are done):

     deactivate
    

    This will return you to your base Python enviroment.

Option 2: Setting up a Conda Enviroment#

  1. Create the environment from the requirements.txt file. This can be done using anaconda, miniconda, miniforge, or any other environment manager.

conda create -n qbc python==3.12

  • Note: if you receive the error bash: conda: command not found..., you need to install some form of anaconda to your development environment.

  1. Activate the new environment:

conda activate qbc
pip install .
  1. macOS Users: Install OpenMP for XGBoost (Required)

    On macOS, XGBoost requires the OpenMP library. Install it using Homebrew:

    brew install libomp
    

    If you don’t have Homebrew installed, visit https://brew.sh/ for installation instructions.

    After installing OpenMP, you may need to reinstall XGBoost:

    pip install --force-reinstall xgboost
    
  2. Verify that the new environment and packages were installed correctly:

conda env list
pip list

Option 3: Using Galaxy (Cloud-Based, No Local Installation)#

If you prefer not to install QBioCode on your local or personal machine, you can use Galaxy, a free, web-based platform for data-intensive biomedical research.

Why Galaxy?

  • No installation required: Run everything in your browser

  • Free computational resources: Access to cloud computing

  • Jupyter notebook support: Run QBioCode tutorials directly

  • Persistent workspace: Your work is saved in the cloud

Step 1: Register for a Galaxy Account#

  1. Go to https://usegalaxy.org/

  2. Click “Login or Register” in the top menu

  3. Select “Register” and fill in:

    • Email address

    • Password

    • Public name (username)

  4. Click “Create” to complete registration

  5. Verify your email address (check your inbox for confirmation link)

Step 3: Using QBioCode (Pre-installed Version)#

Once your Qiskit Jupyter notebook server is running:

  1. Verify QBioCode is available:

    Open a new notebook or terminal and run:

    import qbiocode as qbc
    print(f"QBioCode version: {qbc.__version__}")
    
  2. Access the tutorials:

    The tutorials should be available in the file browser. Navigate to the QBioCode tutorial directory and open any notebook:

    • Artificial_data_generation/example_data_generation.ipynb

    • QProfiler/example_qprofiler.ipynb

    • QSage/qsage.ipynb

    • Quantum_Projection_Learning/QPL_example.ipynb

Step 3b: Install Latest Version (Optional)#

If you need the latest version of QBioCode with the most recent features and bug fixes:

  1. Open a new terminal in Jupyter:

    • Click “File” → “New” → “Terminal” (in JupyterLab)

    • Or use the “New” → “Terminal” button (in classic Jupyter)

  2. Install the latest QBioCode from GitHub:

    # Clone the repository
    git clone https://github.com/IBM/QBioCode.git
    cd QBioCode
    
    # Install QBioCode (this will upgrade the pre-installed version)
    pip install --upgrade .
    
  3. Verify the updated installation:

    python -c "import qbiocode; print(f'QBioCode version: {qbiocode.__version__}')"
    

Note

After upgrading, you may need to restart your Jupyter kernel for changes to take effect: Kernel → Restart Kernel

Step 4: Run QBioCode Tutorials#

  1. Open a tutorial notebook:

    • In the Jupyter file browser, navigate to QBioCode/tutorial/

    • Click on any tutorial notebook to open it:

      • Artificial_data_generation/example_data_generation.ipynb

      • QProfiler/example_qprofiler.ipynb

      • QSage/qsage.ipynb

      • Quantum_Projection_Learning/QPL_example.ipynb

  2. Run the tutorial:

    • Execute cells sequentially using Shift+Enter

    • Follow the instructions in each notebook

Tips for Using Galaxy#

Tip

Best Practices:

  • Save your work frequently: Use File → Save to preserve your progress

  • Download important results: Export notebooks and data files to your local machine

  • Monitor resource usage: Galaxy sessions have time limits; plan accordingly

  • Use version control: Consider connecting to GitHub for better workflow management

Warning

Important Limitations:

  • Galaxy sessions may timeout after inactivity (typically 1-2 hours)

  • Computational resources are shared; quantum simulations may be slower

  • Large datasets may require local installation for better performance

  • IBM Quantum hardware access requires separate IBM Quantum account setup

Troubleshooting Galaxy Installation#

Issue: pip install fails

# Try upgrading pip first
pip install --upgrade pip
pip install .

Issue: Import errors

# Restart the kernel: Kernel → Restart Kernel
# Then re-import
import qbiocode

Issue: XGBoost errors on macOS

# Install OpenMP library
brew install libomp
pip install --force-reinstall xgboost

Issue: Session timeout

  • Save your work regularly

  • Download notebooks before closing

  • Restart the interactive tool if needed

Alternative: Google Colab#

Another cloud-based option is Google Colab:

# In a Colab notebook cell:
!git clone https://github.com/IBM/QBioCode.git
%cd QBioCode
!pip install .

Then upload tutorial notebooks from the tutorial/ directory.