Differences between revisions 9 and 17 (spanning 8 versions)
Revision 9 as of 2019-03-04 17:00:22
Size: 1825
Editor: AndrewHoopes
Comment:
Revision 17 as of 2021-05-03 08:01:05
Size: 1957
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from python
= FreeSurfer Python Development =
Line 4: Line 2:
To facilitate straightforward and reproducible python development in the lab, a custom python3 (anaconda) 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. = FreeSurfer and LCN Python Development =

To facilitate straightforward and reproducible python development in the lab, a local conda distribution for internal developers is installed at `/autofs/cluster/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 7: Line 7:
export PATH=/space/freesurfer/python/linux/bin:$PATH export PATH=/autofs/cluster/freesurfer/python/linux/bin:$PATH
Line 10: 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 before that in your PATH. Keep in mind there's also a `python3` link in `/usr/pubsw/bin`, so it's important that `/autofs/cluster/freesurfer/python/linux/bin` comes before that in your `PATH`. If you want a python package installed into this distribution, email Andrew.

'''NOTE:''' This "lab" conda install is meant for quick access to python utilities. If you're a frequent python developer who uses multiple package versions or environments, please install your own local [[https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html|conda distribution]]. It will give you full access and control of the installed packages.
Line 14: Line 16:
The freesurfer python library, 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 during development, you must point your `PYTHONPATH` at it: The freesurfer python library source, which contains general utilities and various submodules like `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 20: Line 22:
This allows you to import your working version of the freesurfer library in any script or python interpreter. You can test it by opening a python interpreter and 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 23: Line 25:
import freesurfer as fs
status = fs.run('echo hello!')
}}}

=== Tensorflow GPU ===

By default, the gpu-tensorflow package is installed, and to use it, you must point to the CUDA libraries via LD_LIBRARY_PATH:

{{{
export LD_LIBRARY_PATH=/usr/pubsw/packages/CUDA/lib64:$LD_LIBRARY_PATH
export PYTHONPATH=/autofs/cluster/freesurfer/python/fsmodule:$PYTHONPATH
Line 34: Line 27:

Keep in mind that '''/usr/pubsw/packages/CUDA/lib64''' contains the shared libraries for many CUDA versions, so you should refrain from including it in LD_LIBRARY_PATH until you're actually using cuda, since it will slow down program launches by searching that whole network directory.

FreeSurfer and LCN Python Development

To facilitate straightforward and reproducible python development in the lab, a local conda distribution for internal developers is installed at /autofs/cluster/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=/autofs/cluster/freesurfer/python/linux/bin:$PATH

Keep in mind there's also a python3 link in /usr/pubsw/bin, so it's important that /autofs/cluster/freesurfer/python/linux/bin comes before that in your PATH. If you want a python package installed into this distribution, email Andrew.

NOTE: This "lab" conda install is meant for quick access to python utilities. If you're a frequent python developer who uses multiple package versions or environments, please install your own local conda distribution. It will give you full access and control of the installed packages.

Developing and Using the FreeSurfer Python Library

The freesurfer python library source, which contains general utilities and various submodules like 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)