Skip to content

Commit bf6178c

Browse files
committed
remove pythonpath explanation, add hints to pip install, -e
1 parent 064ef74 commit bf6178c

File tree

1 file changed

+25
-94
lines changed

1 file changed

+25
-94
lines changed

README.md

Lines changed: 25 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,41 @@ Graph-based models for molecular property prediction and ontology classification
77

88
## Installation
99

10-
Some dependencies, especially `torch-` libraries, may not install automatically. In case you are experiencing problems, please install them manually **with versions compatible with your installed PyTorch version**.
10+
To install this repository, download it and run
11+
12+
```bash
13+
pip install .
14+
```
15+
16+
The dependencies `torch`, `torch_geometric` and `torch-sparse` cannot be installed automatically.
1117

1218
Use the following command:
1319

1420
```bash
15-
pip install torch_scatter torch_geometric torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
21+
pip install torch torch_scatter torch_geometric -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
1622
```
1723

1824
Replace:
1925
- `${TORCH}` with your installed PyTorch version (e.g., `2.6.0`)
20-
- `${CUDA}` with: `cpu`, `cu118`, or `cu121` depending on your system and CUDA version
26+
- `${CUDA}` with e.g. `cpu`, `cu118`, or `cu121` depending on your system and CUDA version
2127

22-
See also [PyTorch Geometric Documentation](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html)
28+
For a full list of currently available PyTorch versions and CUDA compatibility, please refer to libraries' official documentation:
29+
- [torch](https://pytorch.org/get-started/locally/)
30+
- [torch_geometric](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html#installation)
31+
- [torch-scatter](https://github.com/rusty1s/pytorch_scatter)
32+
33+
_Note for developers_: If you want to install the package in editable mode, use the following command instead:
34+
35+
```bash
36+
pip install -e .
37+
```
2338

2439
## Recommended Folder Structure
2540

2641
ChEB-AI Graph is not a standalone library. Instead, it provides additional models and datasets for [`python-chebai`](https://github.com/ChEB-AI/python-chebai).
42+
The training relies on config files that are located either in `python-chebai` or in this repository.
2743

28-
Therefore, for training we recommend to clone both repositories into a common parent directory. For instance, your project can look like this:
44+
Therefore, for training, we recommend to clone both repositories into a common parent directory. For instance, your project can look like this:
2945

3046
```
3147
my_projects/
@@ -41,99 +57,14 @@ my_projects/
4157

4258
## Training & Pretraining
4359

44-
### ⚠️ Important Setup Instructions
45-
46-
Before running any training scripts, ensure your environment is correctly configured:
47-
48-
* **Either**:
49-
50-
Install the `python-chebai` and `python-chebai-graph` repositories as packages in your environment. To do this, navigate to the root directory of each repository and run:
51-
```bash
52-
pip install .
53-
```
54-
55-
* **OR**
56-
57-
Manually set the `PYTHONPATH` environment variable if working across multiple directories (`python-chebai` or `python-chebai-graph`):
58-
59-
If your **current working directory** is `python-chebai`, set:
60+
### Ontology Prediction
6061

61-
```bash
62-
export PYTHONPATH=path/to/python-chebai-graph
63-
```
64-
65-
or **vice versa**.
6662

67-
> 🔎 See the [PYTHONPATH Explained](#-pythonpath-explained) section below for more details.
68-
69-
70-
### 🧠 Pretraining (Atom/Bond Masking on PubChem)
71-
72-
```bash
73-
python -m chebai fit --model=../python-chebai-graph/configs/model/gnn_resgated_pretrain.yml --data=../python-chebai-graph/configs/data/pubchem_graph.yml --trainer=configs/training/pretraining_trainer.yml
74-
```
75-
76-
77-
### 📊 Ontology Prediction (ChEBI50, v231, 200 epochs)
78-
79-
This command trains a Residual Gated Graph Convolutional Network on the ChEBI50 dataset (see [wiki](https://github.com/ChEB-AI/python-chebai/wiki/Data-Management)).
63+
This example command trains a Residual Gated Graph Convolutional Network on the ChEBI50 dataset (see [wiki](https://github.com/ChEB-AI/python-chebai/wiki/Data-Management)).
8064
The dataset has a customizable list of properties for atoms, bonds and molecules that are added to the graph.
81-
The list can be found in the `configs/data/chebi50_graph_properties.yml` file.
65+
The list can be found in the `configs/data/chebi50_graph_properties.yml` file.
8266

8367
```bash
84-
python -m chebai fit --trainer=configs/training/default_trainer.yml --trainer.callbacks=configs/training/default_callbacks.yml --model=../python-chebai-graph/configs/model/gnn_res_gated.yml --model.train_metrics=configs/metrics/micro-macro-f1.yml --model.val_metrics=configs/metrics/micro-macro-f1.yml --model.test_metrics=configs/metrics/micro-macro-f1.yml --data=../python-chebai-graph/configs/data/chebi50_graph_properties.yml --model.criterion=configs/loss/bce.yml --data.init_args.batch_size=40 --data.init_args.num_workers=12 --data.init_args.chebi_version=231 --trainer.logger.init_args.name=chebi50_bce_unweighted_resgatedgraph --trainer.min_epochs=200 --trainer.max_epochs=200 --model.pass_loss_kwargs=false
85-
```
86-
87-
88-
89-
## 🧭 PYTHONPATH Explained
90-
91-
### What is `PYTHONPATH`?
92-
93-
`PYTHONPATH` is an environment variable that tells Python where to search for modules that aren't installed via `pip` or not in your current working directory.
94-
95-
### Why You Need It
96-
97-
If your config refers to a custom module like:
98-
99-
```yaml
100-
class_path: chebai_graph.preprocessing.datasets.chebi.ChEBI50GraphData
101-
```
102-
103-
...and you're running the code from `python-chebai`, Python won't know where to find `chebai_graph` (from another repo like `python-chebai-graph/`) unless you add it to `PYTHONPATH`.
104-
105-
106-
### How Python Finds Modules
107-
108-
Python looks for imports in this order:
109-
110-
1. Current directory
111-
2. Standard library
112-
3. Paths in `PYTHONPATH`
113-
4. Installed packages (`site-packages`)
114-
115-
You can inspect the full search paths:
116-
117-
```bash
118-
python -c "import sys; print(sys.path)"
119-
```
120-
121-
122-
123-
### ✅ Setting `PYTHONPATH`
124-
125-
#### 🐧 Linux / macOS
126-
127-
```bash
128-
export PYTHONPATH=/path/to/python-chebai-graph
129-
echo $PYTHONPATH
130-
```
131-
132-
#### 🪟 Windows CMD
133-
134-
```cmd
135-
set PYTHONPATH=C:\path\to\python-chebai-graph
136-
echo %PYTHONPATH%
68+
python -m chebai fit --trainer=configs/training/default_trainer.yml --trainer.logger=configs/training/csv_logger.yml --model=../python-chebai-graph/configs/model/gnn_res_gated.yml --model.train_metrics=configs/metrics/micro-macro-f1.yml --model.test_metrics=configs/metrics/micro-macro-f1.yml --model.val_metrics=configs/metrics/micro-macro-f1.yml --data=../python-chebai-graph/configs/data/chebi50_graph_properties.yml --data.init_args.batch_size=128 --trainer.accumulate_grad_batches=4 --data.init_args.num_workers=10 --model.pass_loss_kwargs=false --data.init_args.chebi_version=241 --trainer.min_epochs=200 --trainer.max_epochs=200 --model.criterion=configs/loss/bce.yml
13769
```
13870

139-
> 💡 **Note: This is temporary for your terminal session. To make it permanent, add it to your system environment variables.**

0 commit comments

Comments
 (0)