Skip to content

Commit

Permalink
condense python requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoopes committed May 5, 2021
1 parent 96dacda commit 6ed8901
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 40 deletions.
12 changes: 2 additions & 10 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@ install(PROGRAMS fspython DESTINATION bin)
# install any package requirements
if(INSTALL_PYTHON_DEPENDENCIES)

# packages not in requirements.txt (not needed for the FS module, but for other tools)
set(EXTRA_PACKAGES " \
tensorflow==2.4.1 \
h5py==2.10 \
git+git://github.com/adalca/pystrum.git@3befbd1166595476e8315fef99bea373bfdc302c \
git+git://github.com/adalca/neurite.git@ac74518f367113ddadca90b70acf12f6a8526839 \
git+git://github.com/voxelmorph/voxelmorph.git@80d0c489febfb4fa32b4a247629e79720fbb4c14"
)

if(NOT DISTRIBUTE_FSPYTHON)
set(PKG_TARGET "--target=${CMAKE_INSTALL_PREFIX}/python/packages")
endif()

install(CODE "
message(STATUS \"Installing freesurfer python package dependencies\")
execute_process(COMMAND bash -c \"${CMAKE_INSTALL_PREFIX}/python/bin/python3 -m pip install --upgrade --disable-pip-version-check ${EXTRA_PACKAGES} -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt ${PKG_TARGET}\" RESULT_VARIABLE retcode)
execute_process(COMMAND bash -c \"${CMAKE_INSTALL_PREFIX}/python/bin/python3 -m pip install --upgrade --disable-pip-version-check ${EXTRA_PACKAGES} -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements-extra.txt ${PKG_TARGET}\" RESULT_VARIABLE retcode)
if(NOT \${retcode} STREQUAL 0)
message(FATAL_ERROR \"Could not install freesurfer python dependencies\")
endif()
Expand Down
18 changes: 18 additions & 0 deletions python/requirements-extra.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# extra packages required for FS DL utilities
tensorflow==2.4.1
h5py==2.10

# these are also required for FS DL utilities, but we need some features
# that haven't quite made it into the stable releases yet - this should be
# updated once they do
git+git://github.com/adalca/pystrum.git@3befbd1166595476e8315fef99bea373bfdc302c
git+git://github.com/adalca/neurite.git@ac74518f367113ddadca90b70acf12f6a8526839
git+git://github.com/voxelmorph/voxelmorph.git@80d0c489febfb4fa32b4a247629e79720fbb4c14

# extra packages required for QA tools
numpy
scipy
pandas
matplotlib
transforms3d
scikit-image==0.16.2
20 changes: 2 additions & 18 deletions qatools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if(NOT INSTALL_PYTHON_DEPENDENCIES)
endif()

# run 'pip install' and direct package installs to freesufer/python/packages
# requirements are currently defined by python/requirements-extra.txt

install(CODE "
message(STATUS \"Installing QA tools\")
execute_process(COMMAND bash -c \"${PYTHON_EXECUTABLE} -m pip install ${CMAKE_CURRENT_SOURCE_DIR} --no-dependencies --upgrade --target=${CMAKE_INSTALL_PREFIX}/python/packages\" RESULT_VARIABLE retcode)
Expand All @@ -15,21 +17,3 @@ install(CODE "
)

install_pyscript(qatools.py)

# install any package requirements
if(INSTALL_PYTHON_DEPENDENCIES)
if(NOT DISTRIBUTE_FSPYTHON)
set(PKG_TARGET "--target=${CMAKE_INSTALL_PREFIX}/python/packages")
endif()
install(CODE "
message(STATUS \"Installing QA tools package dependencies\")
execute_process(COMMAND bash -c \"${CMAKE_INSTALL_PREFIX}/python/bin/python3 -m pip install -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt ${PKG_TARGET}\" RESULT_VARIABLE retcode)
if(NOT \${retcode} STREQUAL 0)
message(FATAL_ERROR \"Could not install QA tools dependencies\")
endif()
execute_process(COMMAND bash -c \"find ${CMAKE_INSTALL_PREFIX}/python/bin ! -name 'python3*' -type f -exec rm -f {} +\" RESULT_VARIABLE retcode)
if(NOT \${retcode} STREQUAL 0)
message(FATAL_ERROR \"Could not remove pip-installed scripts\")
endif()"
)
endif()
6 changes: 0 additions & 6 deletions qatools/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions qatools/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,4 @@
],
python_requires='>=3.5',
keywords='Freesurfer',
# This field lists other packages that your project depends on to run.
# Any package you put here will be installed by pip when your project is
# installed, so they must be valid existing projects.
# For an analysis of "install_requires" vs pip's requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['numpy','scipy','pandas','matplotlib','transforms3d','scikit-image==0.16.2']
)

0 comments on commit 6ed8901

Please sign in to comment.