Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Python min and max versions #79

Merged
merged 9 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/build-neuron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ jobs:
env:
SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path)
OS_FLAVOUR: ${{matrix.os.flavour}}
# version of Python we will build NEURON with on MacOS
MACOSX_PY_VERSION: 3.12
# min minor supported version of Python
MIN_MINOR_PYTHON_VERSION: '9'
# max minor supported version of Python
MAX_MINOR_PYTHON_VERSION: '12'
UNPRIVILEGED_USER: runner # User created+used inside Docker containers
# Extra software collections to be installed and enabled on CentOS7
SOFTWARE_COLLECTIONS_centos_7: devtoolset-9 rh-git218 rh-python38

strategy:
matrix:
Expand All @@ -92,7 +92,7 @@ jobs:
- { vm: ubuntu-latest, container: "fedora:40", flavour: redhat }
# Ubuntu 20.04 Docker image
- { vm: ubuntu-latest, container: "ubuntu:20.04", flavour: debian }
# Ubuntu Latest (22.04, at time of writing) Docker image
# Ubuntu Latest (24.04, at time of writing) Docker image
- { vm: ubuntu-latest, container: "ubuntu:latest", flavour: debian }
# Debian Bullseye (11) Docker image
- { vm: ubuntu-latest, container: "debian:bullseye", flavour: debian }
Expand Down Expand Up @@ -128,11 +128,12 @@ jobs:
env:
FLAVOUR_SCRIPT: scripts/install_${{matrix.os.flavour}}.sh

- if: ${{matrix.os.flavour}} == 'macOS'
name: Set up Python@${{ env.MACOSX_PY_VERSION }}
# MacOS has 3.13 as default, so we instead install the max supported one
- if: startsWith(matrix.os.flavour, 'macOS')
name: Set up Python@3.${{ env.MAX_MINOR_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MACOSX_PY_VERSION }}
python-version: "3.${{ env.MAX_MINOR_PYTHON_VERSION }}"

# Checkout the repository; do this before the privilege step so that we
# can chown the result there
Expand Down
5 changes: 3 additions & 2 deletions scripts/environment_macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export SKIP_EMBEDED_PYTHON_TEST=true
# Do not enable OpenMP on macOS
export CORENRN_ENABLE_OPENMP=OFF
# Use Bison from homebrew
export PATH=/usr/local/opt/bison/bin:${PATH}
PATH="$(brew --prefix)/opt/bison/bin:${PATH}"
# Use Flex from homebrew
export PATH=/usr/local/opt/flex/bin:${PATH}
PATH="$(brew --prefix)/opt/flex/bin:${PATH}"
export PATH
27 changes: 24 additions & 3 deletions scripts/install_debian.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eu
# ---
# --- Begin GitHub-Actions-specific code ---
# ---
Expand All @@ -10,11 +11,31 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y bison cmake flex git libncurses-dev libmpich-dev libssl-dev \
libx11-dev libxcomposite-dev ninja-build mpich libreadline-dev sudo wget unzip
if [[ "${DO_NOT_INSTALL_BOOST}" != "true" ]]; then
if [[ "${DO_NOT_INSTALL_BOOST:-false}" != "true" ]]; then
apt-get install -y libboost-all-dev
fi
if [[ -z "${NRN_PYTHON}" ]]; then
if [[ -z "${NRN_PYTHON:-}" ]]; then
apt-get install -y python3-dev python3-venv
export NRN_PYTHON=$(command -v python3)

python_minor_version="$(python3 -c 'import sys;print(sys.version_info.minor)')"
if [[ "${python_minor_version}" -lt "${MIN_MINOR_PYTHON_VERSION}" ]]
then
# install min supported Python version from external repo
apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt-get install -y "python3.${MIN_MINOR_PYTHON_VERSION}-dev" "python3.${MIN_MINOR_PYTHON_VERSION}-venv"
NRN_PYTHON="$(command -v "python3.${MIN_MINOR_PYTHON_VERSION}")"
export NRN_PYTHON
elif [[ "${python_minor_version}" -gt "${MAX_MINOR_PYTHON_VERSION}" ]]
then
# we do not want to downgrade the default version (this is _very_ unlikely to happen on Ubuntu/Debian though)
JCGoran marked this conversation as resolved.
Show resolved Hide resolved
printf "Distribution %s comes with a version of Python that is too new (%s) for NEURON\n" "$(cat /etc/lsb-release)" "3.${python_minor_version}"
printf "Please downgrade it to at most Python %s\n" "3.${MAX_MINOR_PYTHON_VERSION}"
exit 1
else
NRN_PYTHON="$(command -v python3)"
export NRN_PYTHON
fi
# export to github env
echo "NRN_PYTHON=${NRN_PYTHON}" >> $GITHUB_ENV
fi
1 change: 1 addition & 0 deletions scripts/install_redhat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eu
# Use DNF if available (not CentOS7), otherwise YUM
CMD=$(command -v dnf || command -v yum)

Expand Down
6 changes: 4 additions & 2 deletions scripts/install_redhat_almalinux_8_10.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -eu
# Enable the (official) PowerTools repository. This provides Ninja.
dnf install -y dnf-plugins-core python38-devel gcc-toolset-9-gcc gcc-toolset-9-gcc-c++
export NRN_PYTHON=$(command -v python3.8)
dnf install -y dnf-plugins-core "python3${MIN_MINOR_PYTHON_VERSION}-devel" gcc-toolset-9-gcc gcc-toolset-9-gcc-c++
NRN_PYTHON="$(command -v "python3.${MIN_MINOR_PYTHON_VERSION}")"
export NRN_PYTHON
echo "NRN_PYTHON=${NRN_PYTHON}" >> $GITHUB_ENV
dnf config-manager --set-enabled powertools
1 change: 1 addition & 0 deletions scripts/install_redhat_centos_stream9.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eu
# Enable the (official) CRB repository. This provides Ninja.
dnf install -y dnf-plugins-core
dnf config-manager --set-enabled crb
Loading