Getting started
This page walks you from an empty environment to a first PCA plot of your own images.
1. Requirements
Section titled “1. Requirements”- Python 3.12 or newer.
- Hardware: any CPU works; an NVIDIA GPU is strongly recommended for speed. See Best practices - performance for sizing.
- OS: Linux, macOS, Windows.
2. Installation
Section titled “2. Installation”Pip installs the published package. Conda uses the pinned environment files in this repository.
-
Install the package
Terminal window pip install phenomePyTorch is included. An NVIDIA GPU is used when CUDA is available; the same install runs on CPU.
For very large GPU datasets, add the optional backends:
Terminal window pip install "phenome[full]" -
Verify the install
Terminal window python3 -c 'import torch, phenomeprint(f"PhenoMe {phenome.__version__} is ready!")print("GPU:", torch.cuda.is_available(),f"({torch.cuda.get_device_name(0)})" if torch.cuda.is_available() else "(CPU-only mode)")'
-
Clone the repository
Terminal window git clone https://github.com/AAitorG/PhenoMe.gitcd PhenoMe -
Create an environment for your hardware. These files pin the scientific stack and install this checkout.
Terminal window conda env create -f envs/environment-gpu.ymlconda activate phenome-gpuTerminal window conda env create -f envs/environment-cpu.ymlconda activate phenome-cpu -
Verify the install
Terminal window python3 -c 'import torch, phenomeprint(f"PhenoMe {phenome.__version__} is ready!")print("GPU:", torch.cuda.is_available(),f"({torch.cuda.get_device_name(0)})" if torch.cuda.is_available() else "(CPU-only mode)")'
Install troubleshooting (click to expand)
| Symptom | Suggestion |
|---|---|
torch not found or wrong CUDA |
Reinstall torch from PyTorch get started; match driver and wheel. |
opencv / h5py build errors |
Use conda-forge or the full conda env file. |
| Import works but GPU not used | import torch; print(torch.cuda.is_available()); ensure device is passed into PhenoMe(...). |
More in the FAQ - installation.
3. Run your first analysis
Section titled “3. Run your first analysis”The snippet below runs the full pipeline on a folder of images. You can run this in a Python script or a Jupyter Notebook cell.
-
Set up and start
Load an AI vision model (DINOv2 by default) and create the pipeline.
import torchfrom phenome import PhenoMe, load_dinov2_modeldevice = torch.device("cuda" if torch.cuda.is_available() else "cpu")wrapper = load_dinov2_model(model_name="dinov2_vitb14_reg", device=device)pheno = PhenoMe(device=device, seed=42) -
Find your images
A simple folder is fine. For grouped experiments (conditions, drugs, time points) add labels via folder patterns or spreadsheets.
pheno.find_files("path/to/your/images") -
Extract embeddings (AI descriptions) and properties
pheno.process_images(wrapper)pheno.compute_properties(property_preset="intensity") -
Visualize your results
pheno.plot_pca(color_by="condition")Replace
conditionwith any metadata column in your dataset. Usepheno.get_available_metadata_keys()to list them. If you have no labels yet, callpheno.plot_pca()with nocolor_by.
What’s next?
Section titled “What’s next?”Pick the card that matches your next goal. Each links to the most relevant guide, reference, or notebook - no duplicates of the quickstart above.
