Python GraphLab in Anaconda

In this tutorial I wrote down my own steps on how to configure GraphLab on Mac for the Coursera Machine Learning class from the University of Washington:
Starting from the very beginning...

Check your Anaconda


If you do NOT have conda installed, then download it here (Python 3.6 version),
you can always downgrade to 2.7 later.

Sign up to Anaconda cloud:

https://anaconda.org

$ conda --version

conda 4.5.11

Conda update all packages



Even if you installed the newest Anaconda, there will be a ton of changes..

$ conda update --all

Check if you may already have Python 2.7 environment

$ conda env list
# conda environments:
base * /Volumes/DATA/anaconda3


Python Version

You need to work in anaconda=4.0.0 Python 2.7

Without conda you have:
$ python --versionPython 2.7.10


switching to conda:
$ source activate base(base) uki 19:29 ~ $ python --version
Python 3.6.6 :: Anaconda, Inc.

Create the new environment with Python 2.7 anaconda=4.0.0




 $ conda create -n py2 python=2.7.15


List available environments


$ conda env list# conda environments:
base * /Volumes/DATA/anaconda3
py27 /Volumes/DATA/anaconda3/envs/py2

$ source activate py27(py27) uki  19:34 ~ $ python --versionPython 2.7.15 :: Anaconda, Inc.

The actual installation of GraphLab


$ pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/YOUR_EMAIL/YOUR_LICENSE_FROM_TURI/GraphLab-Create-License.tar.gz


Installing Jupiter kernel to support GraphLab and Python 2.7




$ python -m pip install ipykernel



$ python -m ipykernel install --user --name py2 --display-name "Python (py2.7.15)"Installed kernelspec py2 in /Users/uki/Library/Jupyter/kernels/py2


$ cd SOME SRC ROOT FOLDER OF YOUR NOTEBOOK(py27) uki  19:41 Week3 $ jupyter notebook


Inside jupyter notebook execute:

import graphlab

if the installation was correct it will work (no output), if not you will see:

ImportError: No module named graphlab




As an Amazon Associate I earn from qualifying purchases.

ROS Kinetic on Ubuntu 16.04 (Mac Parallels)




http://wiki.ros.org/Installation/Ubuntu

Installation


$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

$ sudo apt-get update

$ sudo apt-get install ros-kinetic-desktop-full
....


Initialize

$ sudo rosdep init


Add the source of Kinetic setp.bash to ~/.bashrc


$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc


Install ROS Install tools

$ sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential


$ printenv | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros



$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make


~/catkin_ws/src$ cat CMakeLists.txt


~/catkin_ws$ source devel/setup.bash


Finding ROS packages on your system


$ rospack find roscpp
/opt/ros/kinetic/share/roscpp


$ roscd roscpp/cmake
parallels@parallels-vm:/opt/ros/kinetic/share/roscpp/cmake


$ rosls roscpp_tutorials
cmake  launch  package.xml  srv



Creating a ROS (catkin) Package

~/catkin_ws/src$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
Created file beginner_tutorials/CMakeLists.txt
Created file beginner_tutorials/package.xml
Created folder beginner_tutorials/include/beginner_tutorials
Created folder beginner_tutorials/src
Successfully created files in /home/parallels/catkin_ws/src/beginner_tutorials. Please adjust the values in package.xml.


Building catkin

~/catkin_ws/src$ cd ~/catkin_ws
parallels@parallels-vm:~/catkin_ws$ catkin_make

$ . ~/catkin_ws/devel/setup.bash
$ rospack depends1 beginner_tutorials
roscpp
rospy
std_msgs


$ rospack depends1 rospy
genpy
roscpp
rosgraph
rosgraph_msgs
roslib
std_msgs




$ source /opt/ros/kinetic/setup.bash 


~/catkin_ws$ catkin_make
~/catkin_ws$ catkin_make install



$ cd ~/catkin_ws/
~/catkin_ws$ ls src
beginner_tutorials  CMakeLists.txt

catkin_make

ROS Nodes 


http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes


$ sudo apt-get install ros-kinetic-ros-tutorials


Starting ROS Core Service


$ roscore
... logging to /home/parallels/.ros/log/4127ad4c-c430-11e8-97ed-001c42291ef9/roslaunch-parallels-vm-17556.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1gb .="" p="">
started roslaunch server http://parallels-vm:39325/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [17567]
ROS_MASTER_URI=http://parallels-vm:11311/

setting /run_id to 4127ad4c-c430-11e8-97ed-001c42291ef9
process[rosout-1]: started with pid [17583]
started core service [/rosout]


NEW TERMINAL

~/catkin_ws$ rosnode list
/rosout

Running Turtle Simulator Node

$ rosrun turtlesim turtlesim_node

in new terminal window
$ rosnode list
/rosout
/turtlesim

~/catkin_ws$ rosnode ping turtlesim
rosnode: node is [/turtlesim]
pinging /turtlesim with a timeout of 3.0s
xmlrpc reply from http://parallels-vm:38047/ time=0.795841ms


ROS Topics

http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics

$ rosrun turtlesim turtlesim_node


$ sudo apt-get install ros-kinetic-rqt
$ sudo apt-get install ros-kinetic-rqt-common-plugins



$ rosrun rqt_graph rqt_graph



$ rostopic -h
rostopic is a command-line tool for printing information about ROS Topics.

Commands:
rostopic bw display bandwidth used by topic
rostopic delay display delay of topic from timestamp in header
rostopic echo print messages to screen
rostopic find find topics by type
rostopic hz display publishing rate of topic
rostopic info print information about active topic
rostopic list list active topics
rostopic pub publish data to topic
rostopic type print topic or field type

Type rostopic -h for more detailed usage, e.g. 'rostopic echo -h'



parallels@parallels-vm:~/catkin_ws$ rostopic list
/rosout
/rosout_agg
/turtle1/cmd_vel
/turtle1/color_sensor

/turtle1/pose



$ rostopic echo /turtle1/cmd_vel
linear:
  x: -2.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0
---

$ rostopic list -v

Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher
 * /rosout [rosgraph_msgs/Log] 3 publishers
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /turtle1/cmd_vel [geometry_msgs/Twist] 2 subscribers
 * /rosout [rosgraph_msgs/Log] 1 subscriber



$ rostopic type /turtle1/cmd_vel

geometry_msgs/Twist


$ rosmsg show geometry_msgs/Twist
geometry_msgs/Vector3 linear
  float64 x
  float64 y
  float64 z
geometry_msgs/Vector3 angular
  float64 x
  float64 y

  float64 z



$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
parallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[Aparallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[A
parallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[Aparallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

publishing and latching message for 3.0 seconds






$ rosrun rqt_plot rqt_plot






http://wiki.ros.org/ROS/Tutorials/UnderstandingServicesParams


$ rosservice list
/clear
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level

$ rosservice call /clear

Create another turtle


rosservice call /spawn 2 2 0.2 ""



$ rosparam list
/background_b
/background_g
/background_r
/rosdistro
/roslaunch/uris/host_parallels_vm__40367
/rosversion
/run_id

$ rosparam get /rosdistro
'kinetic

  '

$ rosparam get /rosversion
'1.12.14



$ rosparam dump ros_params_dump.yaml

background_b: 255
background_g: 86
background_r: 69
rosdistro: 'kinetic

  '
roslaunch:
  uris: {host_parallels_vm__40367: 'http://parallels-vm:40367/'}
rosversion: '1.12.14

  '
run_id: d19c2fd2-c4d6-11e8-a520-001c42291ef9

http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch









As an Amazon Associate I earn from qualifying purchases.

Installing VirtualBox on Mac (High Sierra 10.13)


Go to Oracle VirtualBox page:

https://www.virtualbox.org/wiki/Downloads

Download VirtualBox 5.2
https://download.virtualbox.org/virtualbox/5.2.18/VirtualBox-5.2.18-124319-OSX.dmg

Your Mac will prevent you from installing because it is not from the App Store:





Since pressing "Allow" does not have any effect, I gave up and moved to Parallels.




As an Amazon Associate I earn from qualifying purchases.

Million Songs Dataset for Machine Learning (280 GB)

https://labrosa.ee.columbia.edu/millionsong/


As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles