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

Install ONE requirements file with all requirements. #2955

Merged
merged 4 commits into from
Jul 4, 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
3 changes: 2 additions & 1 deletion ci/win_install_deps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ C:\Python39\python.exe -m pip install numpy==1.19.3 "cython < 3" || goto :error
C:\Python310\python.exe -m pip install numpy==1.21.3 "cython < 3" || goto :error
C:\Python311\python.exe -m pip install numpy==1.23.5 "cython < 3" || goto :error
C:\Python312\python.exe -m pip install numpy==1.26.3 "cython < 3" || goto :error
C:\Python312\python.exe -m pip install setuptools || goto :error
:: setuptools 70.2 leads to an error
C:\Python312\python.exe -m pip install setuptools==70.1.1 || goto :error
matz-e marked this conversation as resolved.
Show resolved Hide resolved

:: install nsis
nsis-3.05-setup.exe /S || goto :error
Expand Down
6 changes: 6 additions & 0 deletions packaging/python/build_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
cython<3
packaging
numpy==1.17.5;python_version=='3.8'
numpy==1.19.3;python_version=='3.9' and platform_machine=='x86_64'
numpy==1.21.3;python_version=='3.9' and platform_machine=='arm64'
numpy==1.21.3;python_version=='3.10'
numpy==1.23.5;python_version=='3.11'
numpy==1.26.0;python_version=='3.12'
58 changes: 21 additions & 37 deletions packaging/python/build_wheels.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ fi

py_ver=""

clone_install_nmodl_requirements() {
clone_nmodl_and_add_requirements() {
git config --global --add safe.directory /root/nrn
git submodule update --init --recursive --force --depth 1 -- external/nmodl
pip install -r external/nmodl/requirements.txt
# We only want the _build_ dependencies
sed -e '/^# runtime dependencies/,$ d' external/nmodl/requirements.txt >> my_requirements.txt
}


Expand All @@ -52,29 +53,6 @@ setup_venv() {
}


pip_numpy_install() {
# numpy is special as we want the minimum wheel version
numpy_ver="numpy"
case "$py_ver" in
36) numpy_ver="numpy==1.12.1" ;;
37) numpy_ver="numpy==1.14.6" ;;
38) numpy_ver="numpy==1.17.5" ;;
39) numpy_ver="numpy==1.19.3" ;;
310) numpy_ver="numpy==1.21.3" ;;
311) numpy_ver="numpy==1.23.5" ;;
312) numpy_ver="numpy==1.26.0" ;;
*) echo "Error: numpy version not specified for this python!" && exit 1;;
esac

# older version for apple m1 as building from source fails
if [[ `uname -m` == 'arm64' && "$py_ver" == "39" ]]; then
numpy_ver="numpy==1.21.3"
fi

echo " - pip install $numpy_ver"
pip install $numpy_ver
}

build_wheel_linux() {
echo "[BUILD WHEEL] Building with interpreter $1"
local skip=
Expand All @@ -83,11 +61,7 @@ build_wheel_linux() {

echo " - Installing build requirements"
pip install auditwheel
pip install -r packaging/python/build_requirements.txt
pip_numpy_install

echo " - Building..."
rm -rf dist build
cp packaging/python/build_requirements.txt my_requirements.txt

CMAKE_DEFS="NRN_MPI_DYNAMIC=$3"
if [ "$USE_STATIC_READLINE" == "1" ]; then
Expand All @@ -96,10 +70,17 @@ build_wheel_linux() {

if [ "$2" == "coreneuron" ]; then
setup_args="--enable-coreneuron"
clone_install_nmodl_requirements
clone_nmodl_and_add_requirements
CMAKE_DEFS="${CMAKE_DEFS},LINK_AGAINST_PYTHON=OFF"
fi

cat my_requirements.txt
pip install -r my_requirements.txt
pip check

echo " - Building..."
rm -rf dist build

# Workaround for https://github.com/pypa/manylinux/issues/1309
git config --global --add safe.directory "*"

Expand Down Expand Up @@ -135,15 +116,11 @@ build_wheel_osx() {
(( $skip )) && return 0

echo " - Installing build requirements"
pip install -U delocate -r packaging/python/build_requirements.txt
pip_numpy_install

echo " - Building..."
rm -rf dist build
cp packaging/python/build_requirements.txt my_requirements.txt

if [ "$2" == "coreneuron" ]; then
setup_args="--enable-coreneuron"
clone_install_nmodl_requirements
clone_nmodl_and_add_requirements
CMAKE_DEFS="${CMAKE_DEFS},LINK_AGAINST_PYTHON=OFF"
fi

Expand All @@ -152,6 +129,13 @@ build_wheel_osx() {
CMAKE_DEFS="$CMAKE_DEFS,NRN_BINARY_DIST_BUILD=ON,NRN_WHEEL_STATIC_READLINE=ON"
fi

cat my_requirements.txt
pip install -U delocate -r my_requirements.txt
pip check

echo " - Building..."
rm -rf dist build

# We need to "fix" the platform tag if the Python installer is universal2
# See:
# * https://github.com/pypa/setuptools/issues/2520
Expand Down
Loading