# API Client for Python Installation
# Requirements
The Cytomine API client for Python library is compatible with Python 2.7 and Python 3.6+. As Python 2.7 is deprecated, this installation guide focuses on Python 3. However, instructions are similar for Python 2.
WARNING
The python
and pip
commands refer to the Python version running on your computer (assumed to be version 3.x in this guide). If you have both Python 2 and Python 3 installed on your computer, the python
and pip
commands are associated to Python 2. In this case, python
and pip
have to be replaced by python3
and pip3
respectively to run Python 3. Adapt the commands below to your running version.
The way to install Python depends on your OS or Linux distribution. For Windows and MacOS, get the installers on the Python.org official website (opens new window).
For Linux, python
is available with your package manager. For example, on Ubuntu and any debian-based linux distributions, you can install Python and its package manager (pip
) with:
sudo apt-get install python3 python3-pip
# Install as a package
To retrieve the package using pip
:
pip install --extra-index-url=https://packagecloud.io/cytomine-uliege/Cytomine-python-client/pypi/simple cytomine-python-client
The Cytomine API client for Python last release is now installed. See API Client for Python usage to getting started.
To ease further updates, you might permanently add the extra-index-url
to your pip
configuration. It can be achieved with the following commands. For more information, see the package repository details (opens new window).
curl -s https://packagecloud.io/install/repositories/cytomine-uliege/Cytomine-python-client/script.python.sh | bash
pip install cytomine-python-client
2
# Install from source
# Install dependencies
The Cytomine API client for Python requires some other Python libraries that need to be installed before the client. To install these dependencies, run:
pip install requests requests-toolbelt cachecontrol six future shapely numpy opencv-python-headless
# Download the source code
- Go to Github repository for the Cytomine API client library (opens new window) to get the latest release
- On this page, click Source code and download the archive
- Extract the downloaded
Cytomine-python-client.zip
archive - Open the
Cytomine-python-client
folder
TIP
To get the latest developments not yet released (not recommended), go Github repository for the Cytomine API client library (opens new window) and click Code. You might be interested in
- Download a ZIP file and extract the source code from the archive
- Use
git clone
to clone the repository on your computer.
# Install the Cytomine Python client
In the Cytomine-python-client
folder, run:
pip install .
The Cytomine API client for Python last release is now installed. See API Client for Python usage to getting started.
# Docker containers
For Docker users, a Docker image is available with Python and the Cytomine API client for Python pre-installed.
To run an interactive Python terminal in a Docker container, run
sudo docker run -it --rm cytomineuliege/software-python3-base:v2.2.2
where v2.2.2
is the Python client version. Check the latest releases on the Cytomine API client for Python library on Github (opens new window).
To run a Python script script.py
, don't forget to map the folder containing your script (and your output if needed):
sudo docker run -it --rm -v /tmp:/tmp cytomineuliege/software-python3-base:v2.2.2 python /tmp/script.py