|
1 | 1 | ## Installation tips |
2 | 2 |
|
3 | | -If you are not (yet) an expert in Python installations (conda vs pip, mananging environements, etc.), |
4 | | -here we propose a simple recipe to install `spikeinterface` and several sorters inside an anaconda |
5 | | -environment for windows/mac users. |
6 | | - |
7 | | -This environment will install: |
8 | | - * spikeinterface full option |
| 3 | +If you are not (yet) an expert in Python installations, the first major hurdle is choosing the installation procedure. |
| 4 | + |
| 5 | +Some key concepts you need to know before starting: |
| 6 | + * Python itself can be distributed and installed many, many ways. |
| 7 | + * Python itself does not contain many features for scientific computing, so you need to install "packages". For example |
| 8 | + numpy, scipy, matplotlib, spikeinterface, ... These are all examples of Python packages that aid in scientific computation. |
| 9 | + * All of these packages have their own dependencies which requires figuring out which versions of the dependencies work for |
| 10 | + the combination of packages you as the user want to use. |
| 11 | + * Packages can be distributed and installed in several ways (pip, conda, uv, mamba, ...) and luckily these methods of installation |
| 12 | + typically take care of solving the dependencies for you! |
| 13 | + * Installing many packages at once is challenging (because of their dependency graphs) so you need to do it in an "isolated environment" to not destroy any previous installation. You need to see an "environment" as a sub-installation in a dedicated folder. |
| 14 | + |
| 15 | +Choosing the installer + an environment manager + a package installer is a nightmare for beginners. |
| 16 | + |
| 17 | +The main options are: |
| 18 | + * use "uv", a new, fast and simple package manager. We recommend this for beginners on every operating system. |
| 19 | + * use "anaconda" (or its flavors-mamba, miniconda), which does everything. Used to be very popular but theses days it is becoming |
| 20 | + harder to use because it is slow by default and has relatively strict licensing on the default channel (not always free anymore). |
| 21 | + You need to play with "community channels" to make it free again, which is complicated for beginners. |
| 22 | + This way is better for users in organizations that have specific licensing agrees with anaconda already in place. |
| 23 | + * use Python from the system or Python.org + venv + pip: good and simple idea for Linux users, but does require familiarity with |
| 24 | + the Python ecosystem (so good for intermediate users). |
| 25 | + |
| 26 | +Here we propose a step by step recipe for beginners based on [**"uv"**](https://github.com/astral-sh/uv). |
| 27 | +We used to recommend installing with anaconda. It will be kept here for a while but we do not recommend it anymore. |
| 28 | + |
| 29 | + |
| 30 | +This recipe will install: |
| 31 | + * spikeinterface `full` option |
9 | 32 | * spikeinterface-gui |
10 | | - * phy |
11 | | - * tridesclous |
| 33 | + * kilosort4 |
12 | 34 |
|
13 | | -Kilosort, Ironclust and HDSort are MATLAB based and need to be installed from source. |
| 35 | +into our uv venv environment. |
14 | 36 |
|
15 | | -### Quick installation |
16 | 37 |
|
17 | | -Steps: |
| 38 | +### Quick installation using "uv" (recommended) |
18 | 39 |
|
19 | | -1. Download anaconda individual edition [here](https://www.anaconda.com/download) |
20 | | -2. Run the installer. Check the box “Add anaconda3 to my Path environment variable”. It makes life easier for beginners. |
21 | | -3. Download with right click + save the file corresponding to your OS, and put it in "Documents" folder |
22 | | - * [`full_spikeinterface_environment_windows.yml`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/full_spikeinterface_environment_windows.yml) |
23 | | - * [`full_spikeinterface_environment_mac.yml`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/full_spikeinterface_environment_mac.yml) |
24 | | -4. Then open the "Anaconda Command Prompt" (if Windows, search in your applications) or the Terminal (for Mac users) |
25 | | -5. If not in the "Documents" folder type `cd Documents` |
26 | | -6. Then run this depending on your OS: |
27 | | - * `conda env create --file full_spikeinterface_environment_windows.yml` |
28 | | - * `conda env create --file full_spikeinterface_environment_mac.yml` |
| 40 | +1. On macOS and Linux. Open a terminal and do |
| 41 | + `curl -LsSf https://astral.sh/uv/install.sh | sh` |
| 42 | +2. On Windows. Open an instance of the Powershell (Windows has many options this is the recommended one from uv) |
| 43 | + `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` |
| 44 | +3. Exit the session and log in again. |
| 45 | +4. Download with right click and save this file in your "Documents" folder: |
| 46 | + * [`beginner_requirements_stable.txt`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/beginner_requirements_stable.txt) for stable release |
| 47 | +5. Open terminal or powershell and run: |
| 48 | +6. `uv venv si_env --python 3.12` |
| 49 | +7. Activate your virtual environment by running: |
| 50 | + - For Mac/Linux: `source si_env/bin/activate` (you should see `(si_env)` in your terminal) |
| 51 | + - For Windows: `si_env\Scripts\activate` |
| 52 | +8. Run `uv pip install -r Documents/beginner_requirements_stable.txt` |
29 | 53 |
|
30 | 54 |
|
31 | | -Done! Before running a spikeinterface script you will need to "select" this "environment" with `conda activate si_env`. |
| 55 | +## Installing before release (from source) |
32 | 56 |
|
33 | | -Note for **linux** users : this conda recipe should work but we recommend strongly to use **pip + virtualenv**. |
| 57 | +Some tools in the spikeinteface ecosystem are getting regular bug fixes (spikeinterface, spikeinterface-gui, probeinterface, neo). |
| 58 | +We are making releases 2 to 4 times a year. In between releases if you want to install from source you can use the `beginner_requirements_rolling.txt` file to create the environment instead of the `beginner_requirements_stable.txt` file. This will install the packages of the ecosystem from source. |
| 59 | +This is a good way to test if a patch fixes your issue. |
34 | 60 |
|
35 | 61 |
|
36 | 62 | ### Check the installation |
37 | 63 |
|
38 | | - |
39 | 64 | If you want to test the spikeinterface install you can: |
40 | 65 |
|
41 | 66 | 1. Download with right click + save the file [`check_your_install.py`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/check_your_install.py) |
42 | 67 | and put it into the "Documents" folder |
43 | | - |
44 | | -2. Open the Anaconda Command Prompt (Windows) or Terminal (Mac) |
45 | | -3. If not in your "Documents" folder type `cd Documents` |
46 | | -4. Run this: |
47 | | - ``` |
48 | | - conda activate si_env |
49 | | - python check_your_install.py |
50 | | - ``` |
51 | | -5. If a windows user to clean-up you will also need to right click + save [`cleanup_for_windows.py`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/cleanup_for_windows.py) |
52 | | -Then transfer `cleanup_for_windows.py` into your "Documents" folder. Finally run : |
| 68 | +2. Open the CMD Prompt (Windows)[^1] or Terminal (Mac/Linux) |
| 69 | +3. Activate your si_env : `source si_env/bin/activate` (Max/Linux), `si_env\Scripts\activate` (Windows) |
| 70 | +4. Go to your "Documents" folder with `cd Documents` or the place where you downloaded the `check_your_install.py` |
| 71 | +5. Run `python check_your_install.py` |
| 72 | +6. If you are a Windows user, you should also right click + save [`cleanup_for_windows.py`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/cleanup_for_windows.py). Then transfer `cleanup_for_windows.py` into your "Documents" folder and finally run: |
53 | 73 | ``` |
54 | 74 | python cleanup_for_windows.py |
55 | 75 | ``` |
56 | 76 |
|
57 | | -This script tests the following: |
| 77 | +This script tests the following steps: |
58 | 78 | * importing spikeinterface |
59 | | - * running tridesclous |
60 | | - * running spyking-circus (not on mac) |
61 | | - * running herdingspikes (not on windows) |
| 79 | + * running tridesclous2 |
| 80 | + * running kilosort4 |
62 | 81 | * opening the spikeinterface-gui |
63 | | - * exporting to Phy |
64 | 82 |
|
65 | 83 |
|
66 | | -## Installing before release |
| 84 | +### Legacy installation using Anaconda (not recommended anymore) |
| 85 | + |
| 86 | +Steps: |
| 87 | + |
| 88 | +1. Download Anaconda individual edition [here](https://www.anaconda.com/download) |
| 89 | +2. Run the installer. Check the box “Add anaconda3 to my Path environment variable”. It makes life easier for beginners. |
| 90 | +3. Download with right click + save the environment YAML file ([`beginner_conda_env_stable.yml`](https://raw.githubusercontent.com/SpikeInterface/spikeinterface/main/installation_tips/beginner_conda_env_stable.yml)) and put it in "Documents" folder |
| 91 | +4. Then open the "Anaconda Command Prompt" (if Windows, search in your applications) or the Terminal (for Mac users) |
| 92 | +5. If not in the "Documents" folder type `cd Documents` |
| 93 | +6. Run this command to create the environment: |
| 94 | + ```bash |
| 95 | + conda env create --file beginner_conda_env_stable.yml |
| 96 | + ``` |
| 97 | + |
| 98 | +Done! Before running a spikeinterface script you will need to "select" this "environment" with `conda activate si_env`. |
| 99 | + |
| 100 | +Note for **Linux** users: this conda recipe should work but we recommend strongly to use **pip + virtualenv**. |
| 101 | + |
| 102 | + |
67 | 103 |
|
68 | | -Some tools in the spikeinteface ecosystem are getting regular bug fixes (spikeinterface, spikeinterface-gui, probeinterface, python-neo, sortingview). |
69 | | -We are making releases 2 to 4 times a year. In between releases if you want to install from source you can use the `full_spikeinterface_environment_rolling_updates.yml` file to create the environment. This will install the packages of the ecosystem from source. |
70 | | -This is a good way to test if patch fix your issue. |
| 104 | +[^1]: Although uv installation instructions are for the Powershell, our sorter scripts are for the CMD Prompt. After the initial installation with Powershell, any session that will have sorting requires the CMD Prompt. If you do not |
| 105 | +plan to spike sort in a session either shell could be used. |
0 commit comments