diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 27ca7787df7..0183c50114b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -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() diff --git a/python/requirements-extra.txt b/python/requirements-extra.txt new file mode 100644 index 00000000000..aa9d76e3858 --- /dev/null +++ b/python/requirements-extra.txt @@ -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 diff --git a/qatools/CMakeLists.txt b/qatools/CMakeLists.txt index 3e5a3979d9d..aa350449e3a 100644 --- a/qatools/CMakeLists.txt +++ b/qatools/CMakeLists.txt @@ -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) @@ -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() diff --git a/qatools/requirements.txt b/qatools/requirements.txt deleted file mode 100644 index 99395693c02..00000000000 --- a/qatools/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -numpy -scipy -pandas -matplotlib -transforms3d -scikit-image \ No newline at end of file diff --git a/qatools/setup.py b/qatools/setup.py index bbd2df1b293..db935cd9c81 100644 --- a/qatools/setup.py +++ b/qatools/setup.py @@ -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'] )