Differences between revisions 6 and 18 (spanning 12 versions)
Revision 6 as of 2018-09-28 00:14:55
Size: 1697
Editor: AndrewHoopes
Comment:
Revision 18 as of 2021-08-26 13:24:17
Size: 1060
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from python
= FreeSurfer Python Development =
= FreeSurfer and LCN Python Development =
Line 4: Line 3:
To ensure consistency and control of python libraries in the lab, a custom python3 (anaconda) distribution for internal freesurfer developers is installed at `/space/freesurfer/python/linux`. 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 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 6:
export PATH=/space/freesurfer/python/linux/bin:$PATH export PATH=/autofs/cluster/freesurfer/python/linux/bin:$PATH
Line 10: Line 9:
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 it 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.
Line 12: Line 11:
=== Developing and Using the FreeSurfer Python Library ===

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:

{{{
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. You can test this by calling `python` then running:

{{{
import freesurfer as fs
status = 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
}}}
'''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.

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.

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