This chapter will explain how to install mcx-python. Please select the operating system you are u using:
Install Python 3.7 or lower
Python 3 should already be installed on your Ubuntu distribution.
Check if your version is Python 3.7 or lower.
If the version is 3.7 or below, you are good to go.
If the version is 3.8 or higher, install Python 3.7 and set it as default. This is done by following the actions below.
sudo apt install python3.7 sudo update-alternatives --config python
The last command will show you an error:
“update-alternatives: error: no alternatives for python”.
Run the commands below, where instead of “3.x” you fill-in the version is you obtained when running
sudo update-alternatives --install /usr/bin/python python /usr/bin/python**3.x** 1 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
After that run the command below and select python 3.7.
sudo update-alternatives --config python
Motorcortex-python can be installed by using the
To be able to use pip to install python packages this first needs to be installed:
sudo apt install python3-pip
Then download, build and install the motorcortex-python package via pip.
sudo -H pip3 install motorcortex-python
This will install motorcortex-python for Python3 for all users.
Congratulations Motorcortex-python is now installed
Install Virtual Environment
Motorcortex-python can also be installed inside a virtual environment. This can be useful if your system has a different python environment than the one required for Motorcortex or if you would like to keep the Motorcortex-python tools separate from the rest of the system for security reasons. A Virtual Environment, is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects.
Check if virtual environment is already installed on your system you can check this using the following command:
If you see a version number for instance 1.6.1 it is already installed. If not you will have to install Vitrualenv:
sudo apt-get install virtualenv
Setting up Vitrualenv
You will need a directory for your virtual enviroment. You may choose any location you desire:
To create a folder for your new app that includes a clean copy of Python3 run:
virtualenv -p python3 ~/virtualenvironment/mcx-env
We have created this new folder called mcx-env. To begin cd into your new project:
Now you are in your virtual environment folder you can activate your virtual environment:
Notice your prompt will have a shell in this case (mcx-env). If you would like to leave your virtual environment type the following command:
Installing Motorcotex-Python in Vitrualenv
Motorcortex-python can be installed by using the “pip” tool. download, build and install the motorcortex-python package via pip.
pip3 install motorcortex-python
Congratulations Motorcortex-python is now installed in your virtual environment.
Install Python 3.7 or lower
Python 3 from the python website: https://www.python.org/downloads/windows/. Choose the appropriate installer for your system. Make sure you choose Python 3.7.
Launch the installer and choose
All options are selected by default (documentation and test suite are actually optional) Click
Under the Advanced Options select
Add Python to environment variables.
Congratulations Python 3 is now installed.
Motorcortex-python is the core library required for any Motorcortex application. It provides convenient ways to communicate with Motorcortex-based applications.
Motorcortex-python can be installed by using the “pip” tool. You have to be connected to the internet to install packaged using pip.
- Open a
Command Promptby pressing the
Windowskey and typing “cmd”.
It may be necessary to use “Run as administrator” if installation commands fail.
- In the Command Prompt window type:
python -m pip install Motorcortex-python
motorcortex-pythonpackage is now installed for the current user.
Alternative Installation Instructions
Alternatively the user can use the miniconda package management and environment management system.
Install Miniconda Python3
Miniconda Python 3 from the Conda website:
https://docs.conda.io/en/latest/miniconda.html. Choose the appropriate installer for your system.
Launch the installer.
Select for who the installation is designated and click
Choose your desired destination folder and click
Register Anaconda as my default Python --
Installto start the installation.
Finishto finish the installation.
It is very convenient to use the Miniconda Cheetsheet when using miniconda.
Anaconda Prompt by pressing the
windows key, type
anaconda in the search field and select appropriate.
- In the Anaconda Prompt window, to create the mcx-env environment, type:
conda create -n mcx-env python=3.7
To remove an environment use ”conda env remove -n
Activate the environment:
conda activate mcx-env
To access this environment a next time open an Anaconda Prompt window and type
conda activate mcx-env. To deactivate an environment type