IBLLIB Python Installation Guide¶
Python-specific dependency : Python 3.6 or higher.
Install Anaconda/Miniconda onto your machine¶
Download and install the Anaconda python distribution from here (chosing the right OS): https://www.anaconda.com/download/#download Note : Download the latest version.
Before you begin, make sure you have installed ibllib properly on your system as per the previous instructions. Make sure your computer is connected to an IBL accredited network.
The following steps will indicate how to :
- setup a virtual environment using Anaconda
- install requirements and packages
- define ONE connection settings
- test for the installation All of that can be done using shell terminal command lines.
Setup a virtual environment using Anaconda¶
In a shell terminal, type the following commands:
cd ibllib/ virtualenv iblenv --python=python3.7 source ./venv/bin/activate
conda create -n iblenv python=3.7 conda activate iblenv
conda create -n iblenv python=3.7 anaconda source activate iblenv
Install requirements and packages¶
pip install ibllib
NB: make sure you did activate your environment as shown above before installing !
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).
- 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).