Brainbox is not installing with One-api or ibl-neuropixels

Dear IBL Team,

I am trying to create another pipeline and I have incorperated the IBL pipeline into another environemetn for another sofatware pakcage I am planning on using. I just mention this in case there are conflicts I am not aware of. As far as I can tell everything has installed fine in the same conda env, if you are curious this is the tool I wan to use…Edeno-replay-classifier.

As the title says I am having trouble with some of the libraries that are called, I already posted about this topic but it as reoccurred. In the last post I used pip install ibl-neuropixels and it seemed to solve everything but this time it’s not. Curious if I’ve missed something, also I want to make my environments shareable so I need to be able to post instructions for others to follow of make a script that can set the environments up if it requires a bit more work than just pip installing one environment.

Anything from brainbox is not working. So I can’t for instance get this tutorial working which relies on SpikeSortLoader from brainbox.io.one

Here are the imports I’m running. I can attach or send my requirements.txt for the environment if that would help in anyway.

# libraries

#IBL SWR detector

import os

import subprocess

import numpy as np

import pandas as pd

from scipy import io, signal, stats

from scipy.signal import lfilter

#from fitter import Fitter, get_common_distributions, get_distributions

import scipy.ndimage

from scipy.ndimage import gaussian_filter

from scipy.ndimage import gaussian_filter1d

from scipy import interpolate

import matplotlib.pyplot as plt

# for ripple detection

import ripple_detection

from ripple_detection import filter_ripple_band

import ripple_detection.simulate as ripsim # for making our time vectors

from tqdm import tqdm

from iblatlas.atlas import AllenAtlas

from iblatlas.regions import BrainRegions

from one.api import ONE

import spikeglx

import brainbox.io.one

from brainbox.io.one import load_channel_locations

from brainbox.io.spikeglx import Streamer

from brainbox.io.one import SpikeSortingLoader

from neurodsp.voltage import destripe_lfp

#THIS CODE WORKS THIS CODE LOOPS THROUGH THE SESSIONS AND DOWNLOADS THE DATA, WE NEED TO ADD THE RIPPLE DETECTION CODE TO REMOVE THE DATA AFTER

from neurodsp.voltage import destripe_lfp

from ibllib.plots import Density

import time # for debugging

import traceback

import logging

import logging.handlers

import sys

from multiprocessing import Pool, Process, Queue, Manager, set_start_method

Hello,
I canno’t reproduce the issue on virtualenv nor conda for Python 3.10 on Linux.

There are several possiblities here:

  • your python version is too old, and not compatible with newer ibllib

  • there is a package named brainbox in your current Path

Could you please send your environment info python --version, pip list, which python and your OS
And in a Python console, try:

import brainbox
print(brainbox.__file__)

import os
print(os.getcwd())

Ok so we are using “CentOS Linux”, I do not think its the python version as my env has python 3.12 but I may have installed an outdated brainbox version which I got here. Running from brainbox.io still gives the ModuleNotFoundError: No module named 'brainbox' So I recreated the environment, here is the full list of what I did to do that…

conda create --name replay_trajectory_classification python=3.12
conda activate replay_trajectory_classification
conda install -c edeno replay_trajectory_classification
conda install ipykernel
python -m ipykernel install --user --name replay_trajectory_classification --display-name "Python (replay_trajectory_classification)"
pip install ONE-api
pip install ibl-neuropixel
pip install iblatlas

Python versions and which python are here…

(replay_trajectory_classification) [acampbell@itchy ~]$ python --version
Python 3.12.3
(replay_trajectory_classification) [acampbell@itchy ~]$ which python
~/miniconda3/envs/replay_trajectory_classification/bin/python

then in python…

(replay_trajectory_classification) [acampbell@itchy ~]$ python
Python 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:38:13) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import brainbox
__file__)Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'brainbox'
>>> import brainbox
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'brainbox'
>>> print(brainbox.__file__)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'brainbox' is not defined
>>> import os
>>> print(os.getcwd())
/home/acampbell

pip list…

(replay_trajectory_classification) [acampbell@itchy ~]$ pip list
Package                          Version
-------------------------------- ---------
asttokens                        2.4.1
bokeh                            3.4.1
boto3                            1.34.102
botocore                         1.34.102
Brotli                           1.1.0
certifi                          2024.2.2
charset-normalizer               3.3.2
click                            8.1.7
cloudpickle                      3.0.0
colorama                         0.4.6
colorlog                         6.8.2
comm                             0.2.2
contourpy                        1.2.1
cycler                           0.12.1
cytoolz                          0.12.3
dask                             2024.5.0
dask-expr                        1.1.0
debugpy                          1.8.1
decorator                        5.1.1
distributed                      2024.5.0
exceptiongroup                   1.2.0
executing                        2.0.1
flake8                           7.0.0
fonttools                        4.51.0
fsspec                           2024.3.1
ibl-neuropixel                   1.0.0
iblatlas                         0.5.1
iblutil                          1.8.0
idna                             3.7
imagecodecs                      2024.1.1
imageio                          2.34.1
importlib_metadata               7.1.0
ipykernel                        6.29.3
ipython                          8.24.0
jedi                             0.19.1
Jinja2                           3.1.4
jmespath                         1.0.1
joblib                           1.4.2
jupyter_client                   8.6.1
jupyter_core                     5.7.2
kiwisolver                       1.4.5
lazy_loader                      0.4
llvmlite                         0.42.0
locket                           1.0.0
lz4                              4.3.3
MarkupSafe                       2.1.5
matplotlib                       3.8.4
matplotlib-inline                0.1.7
mccabe                           0.7.0
msgpack                          1.0.7
mtscomp                          1.0.2
nest_asyncio                     1.6.0
networkx                         3.3
nptyping                         2.5.0
numba                            0.59.1
numpy                            1.26.4
ONE-api                          2.7.0
packaging                        24.0
pandas                           2.2.2
parso                            0.8.4
partd                            1.4.2
patsy                            0.5.6
pexpect                          4.9.0
pickleshare                      0.7.5
pillow                           10.3.0
pip                              24.0
platformdirs                     4.2.1
ply                              3.11
prompt-toolkit                   3.0.42
psutil                           5.9.8
ptyprocess                       0.7.0
pure-eval                        0.2.2
pyarrow                          16.0.0
pyarrow-hotfix                   0.6
pycodestyle                      2.11.1
pyflakes                         3.2.0
Pygments                         2.18.0
pynrrd                           1.0.0
pyparsing                        3.1.2
PyQt5                            5.15.9
PyQt5-sip                        12.12.2
PySocks                          1.7.1
python-dateutil                  2.9.0
pytz                             2024.1
PyWavelets                       1.4.1
PyYAML                           6.0.1
pyzmq                            26.0.3
regularized-glm                  1.0.2
replay-trajectory-classification 1.3.15
requests                         2.31.0
s3transfer                       0.10.1
scikit-image                     0.22.0
scikit-learn                     1.4.2
scipy                            1.13.0
seaborn                          0.13.2
setuptools                       69.5.1
sip                              6.7.12
six                              1.16.0
sortedcontainers                 2.4.0
stack-data                       0.6.2
statsmodels                      0.14.1
tblib                            3.0.0
threadpoolctl                    3.5.0
tifffile                         2024.5.10
toml                             0.10.2
tomli                            2.0.1
toolz                            0.12.1
tornado                          6.4
tqdm                             4.66.4
track-linearization              2.1.0
traitlets                        5.14.3
typing_extensions                4.11.0
tzdata                           2024.1
urllib3                          2.2.1
wcwidth                          0.2.13
wheel                            0.43.0
xarray                           2024.3.0
xyzservices                      2024.4.0
zict                             3.0.0
zipp                             3.17.0

Oh this brainbox is not from us. We need to change the name so that there is no confusion with this third-party package.

So make sure it is uninstalled:
pip uninstall brainbox

And then install ibllib
pip install ibllib

You do not need ONE-api / ibl-neuropixel nor iblatlas are they are all dependencies of ibllib. Brainbox is a package within ibllib.

Let me know if you still have issues!

You sir are a legend thank you, it works now.