Installing the whole development toolchain for Colour roughly means deploying:
- Python 2.7 and Python 3.5
- Apache 2.2
- Php 5.5
- ... and too many things I just don't remember!
I decided to see how I could make that setup a bit more portable and easier to deploy.
The following guide assume that you have that you have PyCharm installed and are using Mac Os X, although it should pretty much be platform agnostic.
Development Workspace Creation
- On your local filesystem, in your development workspace, create a
- Clone the colour-vagrant repository:
You should now have a
colour-vagrantdirectory nested into the
Let's open the
colour-vagrantdirectory into PyCharm.
We will loosely follow Jetbrain's PyCharm Documentation.
VirtualBox directories syncing performance degrades quickly with large number of files.
As a result the directories syncing is done with NFS.
You will however be asked for your Mac Os X password at each virtual machine spin up because Vagrant needs to modify configuration files on the Mac Os X host.
In order to avoid that and following the Vagrant Documentation, you can edit your Mac Os X
/etc/sudoersfile and append the following content:
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports %admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
PyCharm Vagrant Configuration
The canonical way is to use Vagrant from the command line as described in Vagrant Documentation, but here we will leverage the PyCharm integration.
- Set the
Instance Folderfield to your
- Add a new Vagrant box to
PyCharm in the
Boxestab and use the following image: http://files.vagrantup.com/precise64.box
- Add the fabric-vagrant
plugin to PyCharm in the
Your configuration screen should be approximately as follows:
With everything setup, hit the
PyCharm ---> Tools ---> Vagrant ---> Up
menu item to spin up the virtual machine.
You can go grab a coffee, the initial provisioning will take roughly 25-30 minutes.
If the provisioning ended smoothly, you should have the following elements available:
colour, colour-notebooks and colour-science.org repositories
cloned into the
colour-sciencedirectory right next to the
- Remote Python environments installed into the virtual machine at the following location with all the dependencies needed:
vagrant@precise64:~$ cd /home/vagrant/anaconda/envs/ vagrant@precise64:~/anaconda/envs$ ll total 20 drwxrwxr-x 5 vagrant vagrant 4096 Sep 5 10:00 ./ drwxrwxr-x 14 vagrant vagrant 4096 Sep 5 10:00 ../ drwxrwxr-x 12 vagrant vagrant 4096 Sep 5 10:00 python2.7/ drwxrwxr-x 11 vagrant vagrant 4096 Sep 5 09:58 python3.5/
- The colour-science.org website served from the virtual machine at the following address: http://localhost:8080/
PyCharm Environment Configuration
The remote Python interpreters paths are as follows:
Add the paths mappings from the Mac Os X host to the virtual machine in the
Defaultsconfigurations, in my case the mappings are as follows:
/Users/KelSolaar/Documents/Developement/colour-science = /colour-science
Your Run/Debug configuration screen should be approximately looking like that:
SSH Connection & Display
Accessing the virtual machine is done by using
PyCharm ---> Tools Start SSH session... menu item.
However if you want to be able to export the display and see the figures you
will have to manually
ssh into the virtual machine:
You will also need to add the virtual machine to the X11 hosts by issuing the following command on the Mac Os X host:
The Jupyter Notebooks server is started as follows:
Then you can access it on the Mac Os X host at the following url: http://localhost:8888/