IBLLIB Python Installation Guide¶
Python-specific dependency : Python 3.7 or higher.
The following steps will indicate how to :
- setup a virtual environment using Anaconda
- define ONE connection settings
- Optional: test for the installation
Environment and ibllib setup¶
The IBL has a unified set of dependencies for various applications, ibllib being one of those. The steps to setup the unified environment are here:https://github.com/int-brain-lab/iblenv
Instantiate One class: Define connection settings¶
The first step is to instantiate the One class: behind the scenes, the constructor connects to the IBL cloud database and gets credentials.
The connections settings are defined in a JSON parameter file (named .one_params). The file is created when you first run
- In Linux, the file is in
- In Windows, the file is in the Roaming App directory
- In Mac OS, the file is in the user directory
In case of doubt, type the command
io.getappdir in a Matlab prompt,
from pathlib import Path; print(Path.home()) in Python.
It will return the directory of the JSON .one_params file.
Note: The JSON .one_params file is uniquely stored, and shared across Matlab and Python.
There are two ways to define the connection settings.
setup() static method¶
In a Python terminal, type:
from oneibl.one import ONE ONE.setup() # For first time use, need to define connection credentials
- you can access a python terminal from a shell terminal by typing the command
pythonin the ibllibenv virtual environment) For an
pip install ipythonin the environment.
- To run with Spyder, link the Python Interpreter to the virtual environment you created.
- To run with Jupyter, type in the command
jupyter notebookwith your virtual environment activated as above (
pip install jupyterwill install jupyter if it’s not already available).
You will be asked to enter the following information:
ALYX_LOGIN # Input your IBL user name ALYX_PWD # Input your IBL password ALYX_URL: # Should be automatically set as: https://alyx.internationalbrainlab.org - press ENTER CACHE_DIR: # Local repository, can ammend or press ENTER FTP_DATA_SERVER: # Should be automatically set as: ftp://ibl.flatironinstitute.org - press ENTER FTP_DATA_SERVER_LOGIN: # Should be automatically set as: iblftp - press ENTER FTP_DATA_SERVER_PWD # Request Password for FTP from Olivier HTTP_DATA_SERVER: # Should be automatically set as: http://ibl.flatironinstitute.org - press ENTER HTTP_DATA_SERVER_LOGIN: # Should be automatically set as: iblmember - press ENTER HTTP_DATA_SERVER_PWD # Request Password for HTTP from IBL admins
one.setup changes the JSON .one_params file. Again, the file is shared across Python and Matlab platforms.
2. Edit the JSON .one_params file manually¶
Note: In Mac OS/Linux, use the command
nano in a terminal.
Once the connections settings are defined, there is no need to setup the class One again if willing to connect with the credentials saved in the JSON .one_params file.
The tutorial in the next section will show you how to change credentials withough changing the JSON file (useful for seldom connection with different credentials).