Differences between revisions 2 and 14 (spanning 12 versions)
Revision 2 as of 2018-09-27 15:07:03
Size: 1740
Editor: AndrewHoopes
Comment:
Revision 14 as of 2021-01-02 21:50:00
Size: 1514
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from python
Line 3: Line 4:
To ensure consistency and universal access to python libraries, a custom python (anaconda) distribution for internal freesurfer developers is installed at `/space/freesurfer/python/linux`. This way, as a lab, we can have complete control over the tools available to us. To make sure calls to `python` or `python3` point to this version, add the following to your PATH. '''''Note:''' the examples on this page assume you're using bash as your shell.'' To facilitate straightforward and reproducible python development in the lab, a custom conda distribution for internal developers is installed at '''/space/freesurfer/python/linux'''. To use this version, make sure all calls to `python` or `python3` point to this install by adding the following to your PATH:
Line 9: Line 10:
Keep in mind there's also a `python3` link in `/usr/pubsw/bin`, so it's important that `/space/freesurfer/python/linux/bin` comes first in your PATH. Keep in mind there's also a `python3` link in `/usr/pubsw/bin`, so it's important that `/space/freesurfer/python/linux/bin` comes before that in your PATH.
Line 13: Line 14:
The freesurfer python library, which contains general fs utilities and various submodules like deepsurfer, gems, and samseg, is developed in the repository under `repo/python/freesurfer`. In order to utilize this library during development, you must point your `PYTHONPATH` at it: The freesurfer python library source, which contains general utilities and various submodules like deepsurfer, gems, and samseg, is developed in the repository under '''repo/python/freesurfer'''. In order to utilize this library for your own local development, you must point your `PYTHONPATH` at it:
Line 16: Line 17:
export PYTHONPATH=/path/to/freesurfer-repository/python:$PYTHONPATH export PYTHONPATH=/path/to/your/freesurfer-repository/python:$PYTHONPATH
Line 19: Line 20:
This allows you to import your working version of the freesurfer library in any script or python interpreter. You can test this by calling `python` then running: This allows you to import your working version of the freesurfer library in any script or python interpreter. Alternatively, there is a nightly build of the freesurfer module, enabling import of the package without cloning or installing the full freesurfer repository. To access this, add the following to your `PYTHONPATH`. Currently, we build for python `3.5-3.8`.
Line 22: Line 23:
import freesurfer as fs
fs.run('echo hello!')
}}}

=== Tensorflow GPU ===

By default, the cpu-tensorflow package is installed, but if you're on a machine with cuda installed, you can use the gpu-enabled tensorflow by adding to the following search paths:

{{{
export PYTHONPATH=/space/freesurfer/python/linux/tensorflow-gpu:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PYTHONPATH=/autofs/cluster/freesurfer/python/fsmodule:$PYTHONPATH
Line 34: Line 25:

= FsPython =

FreeSurfer Python Development

To facilitate straightforward and reproducible python development in the lab, a custom conda distribution for internal developers is installed at /space/freesurfer/python/linux. To use this version, make sure all calls to python or python3 point to this install by adding the following to your PATH:

export PATH=/space/freesurfer/python/linux/bin:$PATH

Keep in mind there's also a python3 link in /usr/pubsw/bin, so it's important that /space/freesurfer/python/linux/bin comes before that in your PATH.

Developing and Using the FreeSurfer Python Library

The freesurfer python library source, which contains general utilities and various submodules like deepsurfer, gems, and samseg, is developed in the repository under repo/python/freesurfer. In order to utilize this library for your own local development, you must point your PYTHONPATH at it:

export PYTHONPATH=/path/to/your/freesurfer-repository/python:$PYTHONPATH

This allows you to import your working version of the freesurfer library in any script or python interpreter. Alternatively, there is a nightly build of the freesurfer module, enabling import of the package without cloning or installing the full freesurfer repository. To access this, add the following to your PYTHONPATH. Currently, we build for python 3.5-3.8.

export PYTHONPATH=/autofs/cluster/freesurfer/python/fsmodule:$PYTHONPATH

Python (last edited 2023-07-14 12:14:32 by AvnishKumar)