Tutorial: Setting up your Environment¶
Getting a working local copy of Batavia requires a few steps: getting a copy of the Batavia code, and the ouroboros dependency within a virtual environment.
You’ll need to have Python 3.5, 3.6 or 3.7 available for Batavia to work. Instructions on how to set this up are on our Environment setup guide.
Setup a beeware folder to store everything:
$ mkdir beeware $ cd beeware
Get a copy of the Batavia code by running a
git clone
:$ git clone https://github.com/beeware/batavia
We’ll need to create a virtual environment, and install Batavia into it.
$ python3.5 -m venv venv
$ . venv/bin/activate
(venv) $ cd batavia
(venv) $ pip install -e .
$ python3.5 -m venv venv $ . venv/bin/activate (venv) $ cd batavia (venv) $ pip install -e .
In addition, you need to install Node.js. You need to have a recent version of Node; we test using v6.9.1. It’s possible you might already have Node installed, so to check what version you have, run:
$ node --version
If you have an older version of Node.js, or a version from the 11.x, you will need to download and install a version from the “stable” 10.x series.
Once you’ve installed node, you need to make sure you have a current version of npm. Batavia requires npm v6.0 or greater; you can determine what version of npm you have by running:
$ npm --version
If you have an older version of npm, you can upgrade by running:
$ npm install -g npm
Once you’ve got npm, you can use it to install Batavia’s JavaScript dependencies:
$ npm install
Lastly, compile the Batavia library and bundle its dependencies:
$ npm run build
Your final setup should end up looking like this:
_ beeware
\_ batavia
\_ venv (if using virtualenv)
You now have a working Batavia environment!
Next Steps¶
Next, we can setup the sandbox, and try out running Python in your browser. Or your can try running some Python code from the command line.
Troubleshooting Tips¶
After running “npm run build”, if you receive the error:
"Module not found: Error: Cannot resolve 'file' or 'directory' ./stdlib"
Run this command:
$ python compile_stdlib.py
Then try compiling the Batavia library again:
$ npm run build