Skip to content

Commit 1502491

Browse files
authored
New setup (#358)
* updated installation for cuda 12.6 * new setup.py pyproject.toml installation * cleanup * fix tests and deprecations * most deps are added now by the pip package * cleanup deps more * better handling of CUDA builds * correct building and installation * reorganize CI * install nnpops later * fix nnpops installation on correct OSs * nnpops is installing pytorch-cpu from conda which is messing with the torch used to compile from pip * pytorch doesn't generate pip packages anymore for old osx machines * be a bit more flexible with specific builds * fix docs building * fix python version * delayed import of NNPops to fix issues in docs generation * fixed paths to scripts module * undo commenting out
1 parent d616c8a commit 1502491

17 files changed

+123
-143
lines changed

.github/workflows/CI.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os:
21-
[
20+
os: [
2221
"ubuntu-latest",
2322
"ubuntu-22.04-arm",
2423
"macos-latest",
25-
"macos-13",
24+
# "macos-13",
2625
"windows-2022",
2726
]
2827
python-version: ["3.10"]
@@ -50,41 +49,47 @@ jobs:
5049
conda-remove-defaults: "true"
5150
if: matrix.os == 'macos-13'
5251

53-
- name: Install OS-specific conda dependencies
52+
- name: Install OS-specific compilers
5453
run: |
5554
if [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then
56-
conda install --file conda_deps_linux_aarch64.txt --channel conda-forge --override-channels
55+
conda install gxx --channel conda-forge --override-channels
5756
elif [[ "${{ runner.os }}" == "Linux" ]]; then
58-
conda install --file conda_deps_linux.txt --channel conda-forge --override-channels
57+
conda install gxx --channel conda-forge --override-channels
5958
elif [[ "${{ runner.os }}" == "macOS" ]]; then
60-
conda install --file conda_deps_osx.txt --channel conda-forge --override-channels
59+
conda install clangxx llvm-openmp pybind11 --channel conda-forge --override-channels
6160
elif [[ "${{ runner.os }}" == "Windows" ]]; then
62-
conda install --file conda_deps_win.txt --channel conda-forge --override-channels
61+
conda install vc vc14_runtime vs2015_runtime --channel conda-forge --override-channels
6362
fi
6463
65-
- name: Install testing packages
66-
run: conda install -y -c conda-forge flake8 pytest psutil
67-
6864
- name: List the conda environment
6965
run: conda list
7066

67+
- name: Install testing packages
68+
run: conda install -y -c conda-forge flake8 pytest psutil python-build
69+
70+
- name: Lint with flake8
71+
run: |
72+
# stop the build if there are Python syntax errors or undefined names
73+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
74+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
75+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
76+
7177
- name: Build and install the package
7278
run: |
7379
if [[ "${{ runner.os }}" == "Windows" ]]; then
7480
export LIB="C:/Miniconda/envs/test/Library/lib"
75-
pip -vv install .
76-
else
77-
pip -vv install .
7881
fi
82+
python -m build
83+
pip install dist/*.whl
7984
env:
8085
WITH_CUDA: "0"
8186

82-
- name: Lint with flake8
83-
run: |
84-
# stop the build if there are Python syntax errors or undefined names
85-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
86-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
87-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
87+
# - name: Install nnpops
88+
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
89+
# run: conda install nnpops --channel conda-forge --override-channels
90+
91+
- name: List the conda environment
92+
run: conda list
8893

8994
- name: Run tests
9095
run: pytest -v -s --durations=10

.github/workflows/docs_build.yaml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@ on:
88
branches:
99
- "main"
1010

11-
1211
jobs:
1312
build-docs:
1413
runs-on: ubuntu-latest
1514

1615
steps:
17-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
17+
18+
- uses: conda-incubator/setup-miniconda@v3
19+
with:
20+
python-version: "3.10"
21+
channels: conda-forge
22+
conda-remove-defaults: "true"
23+
24+
- name: Install compiler
25+
run: conda install gxx --channel conda-forge --override-channels
1826

19-
- name: Set up Env
20-
uses: mamba-org/setup-micromamba@v1
21-
with:
22-
environment-file: environment.yml
23-
init-shell: bash
24-
generate-run-shell: true
27+
- name: Install docs dependencies
28+
run: |
29+
pip install -vv .
30+
pip install -r docs/requirements.txt
31+
shell: bash -el {0}
2532

26-
- name: Install docs dependencies
27-
run: |
28-
pip install -vv .
29-
pip install -r docs/requirements.txt
30-
shell: bash -el {0}
31-
32-
- name: Build Sphinx Documentation
33-
run: |
34-
cd docs
35-
make html
36-
shell: bash -el {0}
33+
- name: Build Sphinx Documentation
34+
run: |
35+
cd docs
36+
make html
37+
shell: bash -el {0}

conda_deps_linux.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

conda_deps_linux_aarch64.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

conda_deps_osx.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

conda_deps_win.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/source/installation.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ It is recommended to install the same version as the one used by torch.
5454

5555
.. code-block:: shell
5656
57-
conda install -c conda-forge cuda-nvcc cuda-libraries-dev cuda-version gxx pytorch=*=*cuda*
58-
57+
conda install -c conda-forge python=3.10 cuda-version=12.6 cuda-nvvm cuda-nvcc cuda-libraries-dev
5958
6059
6160
* CUDA<12

docs/source/models.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ To implement a new architecture, you need to follow these steps:
342342
**shared_args,
343343
)
344344
345-
4. Add any new parameters required to initialize your module to scripts.train.get_args:
345+
4. Add any new parameters required to initialize your module to torchmdnet.scripts.train.get_args:
346346
347347
.. code-block:: python
348348

docs/source/torchmd-train.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Command line interface
8989
~~~~~~~~~~~~~~~~~~~~~~
9090

9191

92-
.. autoprogram:: scripts.train:get_argparse()
92+
.. autoprogram:: torchmdnet.scripts.train:get_argparse()
9393
:prog: torchmd-train
9494

9595

pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[project]
2+
name = "torchmd-net"
3+
description = "TorchMD-NET provides state-of-the-art neural networks potentials for biomolecular systems"
4+
authors = [{ name = "Acellera", email = "[email protected]" }]
5+
readme = "README.md"
6+
requires-python = ">=3.8"
7+
dynamic = ["version"]
8+
classifiers = [
9+
"Programming Language :: Python :: 3",
10+
"Operating System :: POSIX :: Linux",
11+
]
12+
dependencies = [
13+
"h5py",
14+
# "nnpops",
15+
"torch==2.5.1.*",
16+
"torch_geometric",
17+
"lightning",
18+
"tqdm",
19+
"pandas",
20+
]
21+
22+
[project.urls]
23+
"Homepage" = "https://github.com/torchmd/torchmd-net"
24+
"Bug Tracker" = "https://github.com/torchmd/torchmd-net/issues"
25+
26+
[project.scripts]
27+
torchmd-train = "torchmdnet.scripts.train:main"
28+
29+
[tool.setuptools_scm]
30+
31+
[tool.setuptools.packages.find]
32+
where = [""]
33+
include = ["torchmdnet*"]
34+
namespaces = false
35+
36+
[build-system]
37+
requires = ["setuptools>=64", "setuptools-scm>=8", "torch==2.5.1.*"]
38+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)