aws-lambda



Install SAM CLI


$ sudo pip install --user --upgrade aws-sam-cli


Get a list of existing Lambda functions


aws lambda list-functions

Using Postman to test AWS API Gateway





As an Amazon Associate I earn from qualifying purchases.

Wordpress-AWS

How to install WordPress blog on the free Amazon AWS EC2 instance.


To start, there is no point re-stating the steps as they are very clear in the AWS tutorial provided below.

Why I decided to look at the WordPress self-hosting if I have this blog for last 10 years?

There are really 2 reasons:

  • Extensions available for WordPress are far superior to any other blogging platform
  • The WordPress hosted on EC2 instance is on well, Amazon AWS, the infrastructure lives in the same datacenter and benefits from high speed connection to my other micro-services such as AWS Lambda functions. 


Stay tuned for customization tips.

References:



As an Amazon Associate I earn from qualifying purchases.

CANtact v1.0 Open Source Controller Area Network (CAN) to USB Converter

CANtact v1.0 Open Source Controller Area Network (CAN) to USB Converter





References:



As an Amazon Associate I earn from qualifying purchases.

Slack Slash Commands with AWS Lambda

Introduction

Incorporating Lambda functionality into your Slack opens endless possibilities for automation. 

The commands may provide a quick method to store the information such as "/todo" and "/memo" as well as very sophisticated methods to "/deploy" some code, or "/reserve" assets. 

With some additional work, the commands such as "/predict" or "/classify" could call on machine learning models. 

The options are truly unlimited and can serve your team, or you individually. 

If you constantly add the new automation skills to your repertoire,  it is going to give you that extra "edge" in the hyper-competitive world.

For ideas on constantly building your set of skills, read my article on Singularity on Medium.com.


Basic Architecture


  • The individual user, or a team, interact with the Slack client app or website.
  • The particular Slack team is identified by a unique token
  • The commands are identified by a leading /slash
  • The AWS API Gateway is able to provide:
    • monetization for the API
    • DDOS attack protection
    • throttling the frequency of received API calls
  • There can be an AWS Lambda function to verify the token and delegate tasks which might limit the security exposure of the system
  • AWS Lambda functions fulfill a very particular skill and connect to other AWS services or APIs as needed. 
  • Over many years you can have thousands of skills that you could progressively perfect and monetize 




Cost Considerations


  • AWS API Gateway costs $3.50 per month per million requests. The first million is free.
  • AWS Encryption costs about $1 per month


Create an AWS "IAM" role for this service



Create role step 1


select Lambda




Create role step 2a


Search and select "AWSLambdaBasicExecutionRole"



Create role step 2b


Search and select "AmazonDynamoDBFullAccess"


Create role step 3


Name the role












Go to the Slack you are an ADMINISTRATOR for:
e.g. https://ukidlucas.slack.com/apps

Search for "Slash Commands"



https://ukidlucas.slack.com/apps/[....]-slash-commands

It should display something like:




Click "Add Configuration"

Choose a Command: "/HelloWorld"

Click "Add Slash Command Integration"

From the "Outgoing Data" copy token=LONG_ALPHA_NUMERIC

Save the token value for next step.














Open AWS new Lambda with "slack-echo-command-python" blueprint

You can search and navigate to this blueprint, or click the link below.




Lambda Function: Basic Information



















Updating "Execution Role"



  • At first, the created role was not available, but later when I edited the Lambda Function it showed up:














Lambda Function: Slack Token


  • Paste the previously saved Slack token













Configuring Triggers: API name























Save the Lambda Function



  • Click on the "API Gateway" trigger block
  • Copy the API endpoint URL 
  • Paste that URL into the Slack 
  • Save the Slack Configuration



Try Calling the /helloworld from Slack

slackbot [10:12 AM]
Darn - that slash command didn't work (error message: `502_service_error`). Manage the command at text.

Go to AWS CloudWatch (your logs) by clicking Monitoring

https://console.aws.amazon.com/cloudwatch/





You can see that the initialization error has occurred having to do with Encryption


The extra level of encryption using KMS:


Set the token value as the "kmsEncryptedToken" value

Create Customer Master Key (CMK):






References






As an Amazon Associate I earn from qualifying purchases.

Distributed Cloud as a Pathway to Adaptable Artificial Intelligence.

I have published a new article on Medium.com

Distributed Cloud as a Pathway to Adaptable Artificial Intelligence.


https://medium.com/@ukidlucas/distributed-machine-learning-and-gp-ai-fc2a0e3f6db


As an Amazon Associate I earn from qualifying purchases.

singularity

I wrote a new article on Medium.

Distributed Machine Learning and AI

https://medium.com/@ukidlucas/distributed-machine-learning-and-gp-ai-fc2a0e3f6db


As an Amazon Associate I earn from qualifying purchases.

AUTOSAR









As an Amazon Associate I earn from qualifying purchases.

Enable code completion in Jupyter Notebook




$ pip install jupyter_contrib_nbextensions
$ jupyter contrib nbextension install --user
$ jupyter notebook


Open "Nbextensions" tab, select Hinterland




As an Amazon Associate I earn from qualifying purchases.

#book: ebooks


Having been a long-time user of Kindle and Nook, I end up using Google Books most of the time, here are some reasons:

  • Amazon Kindle does not support ePub which is a most common format
  • Barnes and Noble Nook does not allow to upload new books to the cloud and from there to the Nook via WiFi
  • Only Google Books allow reading the text using the Android system voice (TTS)
  • For Google Books adding newly purchased books is as simple as clicking "Upload files"



To manage my eBooks I use:


As an Amazon Associate I earn from qualifying purchases.

android-adb


It is frustrating when you cannot connect to ADB.

Here is a list of troubleshooting items:

Developer Options - ADB

The first one is obviously enabling ADB in Settings > Developer Options

USB role


The USB role for ADB should be the "Device", your computer is the "Host".


  • Device
    • this device is powered by the USB
    • this device can send ADB data to the Host
  • Host Mode
    • this device powers the USB
    • this device sends and receives the data
  • Accesory - this device cannot be a "Host", but acts like one
    • this device powers the USB
    • this device sends and receives the data



Correct DATA USB cable (and hubs)


This one gets me the most often, once you verify that the USB cable works label it.
The same goes for any hub or USB C to USB A converter.



References




As an Amazon Associate I earn from qualifying purchases.

TensorFlow-serving


TensorFlow Docker Serving








As an Amazon Associate I earn from qualifying purchases.

Android Vendor Testing Suite (VTS)


Android Vendor Testing Suite (VTS)





As an Amazon Associate I earn from qualifying purchases.

Is the (Android) user a goat?

Is the (Android) user a goat?

A very important method to know your users. 





As an Amazon Associate I earn from qualifying purchases.

Detroit Autonomous Vehicle and Robotics Meetup



Detroit Autonomous Vehicle and Robotics Meetup 


Thursday, November 15, 2018, from 6:00 PM to 9:00 PM (EST)

Detroit, MI
EventBright.com



As an Amazon Associate I earn from qualifying purchases.

AI-career

I have updated the article on LinkedIn:

High Tech (as in A.I.) career path.


https://www.linkedin.com/pulse/how-stay-relevant-your-high-tech-career-uki-dominque-lucas/


As an Amazon Associate I earn from qualifying purchases.

Machine Learning Supervised Speaker Recognition (Diarization)

References:

https://arxiv.org/abs/1810.04719

https://github.com/google/uis-rnn

https://catalog.ldc.upenn.edu/LDC2001S97



As an Amazon Associate I earn from qualifying purchases.

Setting up the Raspberry Pi with a 7-inch touchscreen

Overview


In this tutorial, I will show steps for setting up the Raspberry Pi 3B with a 7-inch touchscreen. Later, I will add a dual camera support. As usual, I am doing most of the work on the MacBook Pro, but the steps will easily translate to another operating system (Windows, or Linux).

I have ordered the touchscreen display a while ago and it's been sitting on my bench, but right now I am working on the image recognition in my car (a separate tutorial) and I would like to see what I am capturing, also to be able to start and to stop the process from a touchscreen.

I have ordered the case for the setup, but I have to see how it would work for me as I need a stereo (or rather dual) cameras that will require an additional pair of Raspberry Pi boards. I do not believe that Pi Zero will do, as I will do a heavy pre-processing of the images before sending them to the Machine Learning model.



There is also a 10.1-inch (1280x800) capacitive touchscreen available, but this might be for the next stage of the project.

The products mentioned are shown below:


Raspberry Pi 3B 7-inch touchscreen 7-inch case 10.1 touchscreen Infrared camera





Download SD Card Formatter for Mac


https://www.sdcard.org/downloads/formatter_4/eula_mac/index.html


Format the SD card




Download Raspbian with Desktop


https://www.raspberrypi.org/downloads/raspbian/


UZip the Rasbian OS and you get .img

2018-10-09-raspbian-stretch.zip
2018-10-09-raspbian-stretch.img

Check where is your SD Card mounted

$ diskutil list
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.9 GB disk2
1: Windows_FAT_32 PI3_RASBIAN 15.9 GB disk2s1

Unmount your SD Card




$ sudo diskutil unmountDisk /dev/disk2
Password:
Unmount of all volumes on disk2 was successful

 Put the image on the SD Card


$ sudo dd bs=1m if=/Users/uki/Downloads/2018-10-09-raspbian-stretch.img of=/dev/disk2
3944+0 records in
3944+0 records out

4135583744 bytes transferred in 3019.441172 secs (1369652 bytes/sec)

Wait a long time with no feedback.

Eject the SD Card


$ sudo diskutil eject /dev/disk2
Password:

Disk /dev/disk2 ejected

Insert the SD Card into the Raspberry Pi

Make sure you insert the SD Card correctly, the slot is under the Display ribbon.

Connect pins


  • --- RED 5V
  • --- BLACK Ground
  • --- GREEN (serial data) - SDA1 I/O I2C bus
  • --- YELLOW(system clock) - SCL1 I2C bus

The pin layout for Raspberry 2 and 3 is the same.







References:




As an Amazon Associate I earn from qualifying purchases.

TuriCreate: display images in Jupyter notebook instead using explore() method

When using TuriCreate in a Jupyter notebook, explore() method for images does not work very well. I created a helper method that shows me the images and their labels.


# shorthand
# sframe[3]['image'].show()

# image_testing_SFrame[0:5]['image'].explore()
sframe = image_testing_SFrame[0:5] # show first 5 records

def show_images(sframe, image_column="image", label_column="label"):
    for subset_dictionary in sframe:
        image = subset_dictionary[image_column]
        print(subset_dictionary[label_column])
        image.show()
show_images(sframe, image_column="image", label_column="label")
show_images(sframe)
 


As an Amazon Associate I earn from qualifying purchases.

TuriCreate: SFrame filter_by()

Create a subset SFrame by filtering a bigger SFrame




Filter using a single string


dogs_SFrame = image_training_SFrame.filter_by(values="dog", column_name="label", exclude=False) 
print(dogs_SFrame["label"][0:15]) 
['dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog', 'dog']


Filter using an array of strings


animals = ["dog", "cat", "bird"] 
animals_SFrame = image_training_SFrame.filter_by(values=animals, column_name='label', exclude=False) 
print(animals_SFrame["label"][0:15]) 
['bird', 'cat', 'cat', 'dog', 'bird', 'dog', 'bird', 'bird', 'cat', 'dog', 'cat', 'bird', 'cat', 'cat', 'dog']




Example:

training_sframes = {}
for label in unique_labels:
    #print (label)
    training_sframes[label] = image_training_SFrame.filter_by(
        values = label,
        column_name = "label",
        exclude = False)
   
for key_name in training_sframes: # dictionary training_sframes
    print(key_name)






As an Amazon Associate I earn from qualifying purchases.

TuriCreate: Find unique records in a SFrame

Find unique records in a dataset (SFrame)




labels_column_SArray = SFrame_DataSet['label']
print(type(labels_column_SArray))
unique_labels = labels_column_SArray.unique()
print(unique_labels)
['bird', 'dog', 'cat', 'automobile']





As an Amazon Associate I earn from qualifying purchases.

multi_cam_pi

https://www.pyimagesearch.com/2016/01/18/multiple-cameras-with-the-raspberry-pi-and-opencv/


As an Amazon Associate I earn from qualifying purchases.

Fabric Python library to run SSH to multiple computers

Fabric Python library can be used to send SSH commands to multiple computers at the same time.

This comes useful when doing distributed updates to the SBC (i.e. Raspberry Pi) cluster.

http://www.fabfile.org/




As an Amazon Associate I earn from qualifying purchases.

FarmAidBot

Attending a meetup on Saturday, update coming soon.
















As an Amazon Associate I earn from qualifying purchases.

Android Dev Summit

https://youtu.be/ei_5R0CvLm4




As an Amazon Associate I earn from qualifying purchases.

A very BIG ML dataset un-TAR GZIP command

I have learned that none of my GUI Mac programs were able to expand the 13 GB dataset, however, the command line had no problem with it.


$ tar xvzf BIG_DATASET_MANY_THOUSANDS_FOLDERS.tar.gz

It would be great is it was this simple!

The command has failed as I run out of 41 GB of free disk space before I was able to expand it.

Alternatively, I considered going one directory at the time,

$ tar xvfz BIG_DATASET_MANY_THOUSANDS_FOLDERS.tar.gz /directory_path


with a script that traverses the directories. This way I can keep track which directories were correctly expanded.

At this point, I ended up with multiple directories on various disks, a directory merging tool is very useful:

# parameters:
# -a --archive; look at everything recursively
# -i; --itemize-changes; print update about each file
# -h; --human-readable
# -W; --whole-file; avoid file deltas
# --progress; show progress in terminal
# --log-file=XYZ.log; log the progress to file, this might be useful when resuming
$ rsync -aW source_directory/ destination_directory/


References:

  • https://www.thegeekstuff.com/2010/04/unix-tar-command-examples/
  • https://medium.com/@sethgoldin/a-gentle-introduction-to-rsync-a-free-powerful-tool-for-media-ingest-86761ca29c34











As an Amazon Associate I earn from qualifying purchases.

Re-installing Anaconda for TuriCreate environment

Recently, I run out of disk space and had to move my Anaconda to a disk with more room.

I had a bad experience with moving the anaconda3 folder, so I opted to do a full installation.

1) Download Anaconda installer


Usually, I grab the newest version 3, but truthfully, TuriCreate still uses old python-2.7.15.

https://www.anaconda.com/download/#macos

Install it in the new location following GUI screens.

2) Back up your existing conda env

If you have an environment that you want to preserve, you can save its configuration to a small yml file.

$ conda env export > environment_turi_20181105.yml

3) Delete the previous location of Anaconda


rm -r .... /anacondaX/

4) Restore the conda evn from yml file

I provided you my yml file for convenience.
conda env create -f environment_turi_20181105.yml

5) Change to that conda env




$ conda activate turi


and make sure conda env is correct:

$ conda env list
# conda environments:
#
/Users/uki/.julia/conda/3
/Users/uki/.julia/packages/ORCA/uEiWT/deps
base /anaconda2
turi * /anaconda2/envs/turi

6) Re-install Jupyter Notebook kernel


python -m ipykernel install --user --name turi --display-name "Python 2.7 (turi)"

7) Start Jupyter Notebook and test 


$ jupyter notebook






As an Amazon Associate I earn from qualifying purchases.

Installing Turi Create on Python 3.6 Anaconda Environment

Installing TuriCreate on Python 3.6 Anaconda Environment

1) Check what Python version Apple Turi Create supports



Turi Create requires:
  • Python 2.7, 3.5, 3.6

2) Switch to Python 3.6 environment

$ source activate py36



$ conda env list
# conda environments:
/Users/uki/.julia/conda/3
/Users/uki/.julia/packages/ORCA/uEiWT/deps
base /Volumes/DATA/anaconda3
py2 /Volumes/DATA/anaconda3/envs/py2
py36 * /Volumes/DATA/anaconda3/envs/py36

3) Find TuriCreate v5.1.0 package

Browse: https://anaconda.org/derickl/turicreate

$ conda install -c derickl turicreate

4) Install Jupyter Notebook kernel conda module 


$ conda install ipykernel

5) Make sure all the packages are matching and updated

$ conda update --all

6) Install Jupyter Notebook kernel with this Environment


python -m ipykernel install --user --name py36 --display-name "Python 3.6 Turi (env py36)"
Installed kernelspec py36 in /Users/uki/Library/Jupyter/kernels/py36

7) Backup your Environment

Just because things go wrong all the time.

$ conda env export > environment_py36_20181102.yml

8) Start Jupyter notebook


$ jupyter notebook



Test Turi in Jupyter Notebook


import turicreate as turi
WARNING: You are using MXNet 1.2.1 which may result in breaking behavior. To fix this, please install the currently recommended version: pip uninstall -y mxnet && pip install mxnet==1.1.0 If you want to use a CUDA GPU, then change 'mxnet' to 'mxnet-cu90' (adjust 'cu90' depending on your CUDA version):




(py36) $ pip uninstall -y mxnet && pip install mxnet==1.1.0














As an Amazon Associate I earn from qualifying purchases.

Julia language is not ready (2018)

Update: I have picked up Julia again in 2020 and I am enjoying it.



Beyond the core math and functions, which work fine, trying to run any of the 2200 packages in Julia 1.0.1 is a night full of frustrations.

I have tried countless code examples and most of them fail.

The most important to me "using PyCall" was the final signal for me that Julia and I need a little time apart. Maybe when some percentage of packages make it from 0.1 and 0.3 to something like 0.9 and 1.0 then Julia will be more usable.




import Pkg;






Pkg.add("PyCall")




Updating registry at `~/.julia/registries/General` Updating git-repo `https://github.com/JuliaRegistries/General.git` [1mFetching: [========================================>] 100.0 %.0 %
Resolving package versions... 
Updating `~/.julia/environments/v1.0/Project.toml` [5c1ef01f] 
- Cookbook v0.3.0 [5befdd30] - Hilbert v0.1.0 [5c077215] 
- LatticeSites v0.2.0 Updating `~/.julia/environments/v1.0/Manifest.toml` [5c1ef01f] 
- Cookbook v0.3.0 [5befdd30] 
- Hilbert v0.1.0 [5c077215] 
- LatticeSites v0.2.0





Pkg.update()


Updating registry at `~/.julia/registries/General` 
Updating git-repo `https://github.com/JuliaRegistries/General.git` 
Resolving package versions... 
Installed KernelDensity ── v0.5.1 
Installed Interpolations ─ v0.9.2 
Updating `~/.julia/environments/v1.0/Project.toml` [5cadff95] 
- JuliennedArrays v0.1.0 [5ab0869b] ↑ KernelDensity v0.5.0 ⇒ v0.5.1 [5c958174] 
- SuperEnum v0.1.3 Updating `~/.julia/environments/v1.0/Manifest.toml` [a98d9a8b] ↓ Interpolations v0.10.5 ⇒ v0.9.2 [5cadff95] 
- JuliennedArrays v0.1.0 [5ab0869b] ↑ 
KernelDensity v0.5.0 ⇒ v0.5.1 [5c958174] 
- SuperEnum v0.1.3




using PyCall


SYSTEM: show(lasterr) caused an error Stacktrace: [1] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:630 [2] macro expansion at ./logging.jl:312 [inlined] [3] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:701 [4] _require(::Base.PkgId) at ./loading.jl:934 [5] require(::Base.PkgId) at ./loading.jl:855 [6] macro expansion at ./logging.jl:311 [inlined] [7] require(::Module, ::Symbol) at ./loading.jl:837 [8] top-level scope at In[1]:1
KERNEL EXCEPTION
SYSTEM: show(lasterr) caused an errorStacktrace:
[1] #invokelatest#1 at ./essentials.jl:697 [inlined]
[2] invokelatest at ./essentials.jl:696 [inlined]
[3] eventloop(::ZMQ.Socket) at /Users/uki/.julia/packages/IJulia/0cLgR/src/eventloop.jl:8
[4] (::getfield(IJulia, Symbol("##12#15")))() at ./task.jl:259
The error above prevents the execution of the below:

@pyimport math 
#math.sin(math.pi / 4) - sin(pi / 4) # returns 0.0




@pyimport time




@pyimport numpy.random as nr nr.rand(3,4)


As an Amazon Associate I earn from qualifying purchases.

Jupyter Error 49







$ jupyter notebook

Traceback (most recent call last):

File "/anaconda3/bin/jupyter-notebook", line 11, in


sys.exit(main())

File "/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance

return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)

File "/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance

app.initialize(argv)

File "", line 2, in initialize

File "/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error

return method(app, *args, **kwargs)

File "/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1602, in initialize

self.init_webapp()

File "/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1381, in init_webapp

self.http_server.listen(port, self.ip)

File "/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 143, in listen

sockets = bind_sockets(port, address=address)

File "/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 168, in bind_sockets

sock.bind(sockaddr)

OSError: [Errno 49] Can't assign requested address


Short Answer



$ jupyter notebook --ip=127.0.0.1


PORT 8888

You can also explore what you are already running on PORT 8888

$ lsof | grep 8888Skype      407  uki  txt       REG                1,5   

$ lsof -nP | grep 8888


As an Amazon Associate I earn from qualifying purchases.

Julia

Download Julia


https://julialang.org/downloads/

For me, MacOS Package (.dmg)


               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org  (_)     | (_) (_)    |   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.  | | | | | | |/ _` |  |  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29) _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release|__/                   |
julia> println("Hello World,", "Julia!")Hello World,Julia!

Clone Julia:



git clone https://github.com/JuliaLang/julia.git

Visit JuliaBox.com (iJulia Jupyter notebooks):


JuliaBox.com


Install Juno (Atom IDE)


http://docs.junolab.org/latest/man/installation.html

iJulia in Jupyter Notebook



julia> using Pkg
julia> Pkg.add("IJulia")



Jupyter NBInclude.jl


https://github.com/stevengj/NBInclude.jl


$ git clone https://github.com/stevengj/NBInclude.jl.git julia_NBInclude





As an Amazon Associate I earn from qualifying purchases.

Windows 10 UBuntu bash

My company uses mostly Windows and Ubuntu servers, I requested a MacBook, obviously.

However, there are certain internally-written programs that will run on the Windows only, so I run Parallels hypervisor with Windows 10 and Ubuntu.

On Windows 10, I have a hard time with the Command Prompt, last time I used DOS was in c. 1999, so I opted to try installing Bash.

$ ping Google.com
PING Google.com (74.125.138.102) 56(84) bytes of data.
64 bytes from yi-in-f102.1e100.net (74.125.138.102): icmp_seq=1 ttl=128 time=30.4 ms

$ ssh dummy@74.125.138.102
ssh: connect to host 74.125.138.102 port 22: Connection refused

Checking for Python


$ python --version

Command 'python' not found, but can be installed with:

sudo apt install python3
sudo apt install python
sudo apt install python-minimal

You also have python3 installed, you can run 'python3' instead.

$ python3 --version
Python 3.6.5

$ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")
Hello World
>>> exit()
$

Attempting to get Anaconda


wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh
$ chmod +x Anaconda-2.3.0-Linux-x86_64.sh
$ . Anaconda-2.3.0-Linux-x86_64.sh
-bash: .: Anaconda-2.3.0-Linux-x86_64.sh: cannot execute binary file


$ java

Command 'java' not found, but can be installed with:

$ sudo apt install default-jre
$ sudo apt install openjdk-11-jre-headless
$ sudo apt install openjdk-8-jre-headless
$ sudo apt install openjdk-11-jre-headless

$ java --version
openjdk 10.0.1 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)



As an Amazon Associate I earn from qualifying purchases.

Amazon remembers 30 of my past mobile devices!

It is funny, Amazon remembers 30 of my past mobile devices!

I had no idea until I have clicked for a new book to be delivered to my Kindle app.

Can you say I have been into mobile development since 2009?





As an Amazon Associate I earn from qualifying purchases.

graphlab.canvas.set_target('ipynb') error

I am getting an error in the following line:

graphlab.canvas.set_target('ipynb') # alternative 'browser', port=8889


/Volumes/DATA/anaconda3/envs/py27/lib/python2.7/site-packages/graphlab/canvas/server.pyc
108 self.__server = tornado.httpserver.HTTPServer(self.__application, io_loop=self.__loop)
TypeError: initialize() got an unexpected keyword argument 'io_loop'

Fix Attempt 1:

 

$ conda update tornado


environment location: /Volumes/DATA/anaconda3/envs/py27


tornado: 5.1-py27h1de35cc_0 --> 5.1.1-py27h1de35cc_0

Fix is not successful



Fix Attempt 2:


Reinstall Anaconda3


As an Amazon Associate I earn from qualifying purchases.

Install Anaconda Python environment with Jupyter Notebook

This post was updated on September 29, 2022

Check if you have Conda installed

% conda update --all -y
>> command not found: conda

Install Anaconda Python

I prefer an installer on my laptop: 


After installation, make sure you restart the Terminal (control N).

Note, Anaconda includes the following and much more:
  • curl

  • numpy

  • matplotlib

  • jupyter_core

  • protobuf

  • sqlite

  • ipython

  • jupyterlab

  • jupyter

  • notebook

  • matplotlib

  • pip

  • pandas

  • pillow

  • scikit-learn

  • python-3.9



Update Conda


$ conda activate base
$ conda update -n base -c defaults conda
$ conda update --all -y



How to start Jupyter Notebook



cd $REPO // the directory you want as a base of your project (e.g. in GitHub directory)  
jupyter-lab

This will start in the browser: http://localhost:8888/lab


That is all you need to start working.
Alternatively, you may want to create ENVIRONMENT specific installation. This is useful if you work on multiple projects, especially over a long time when LIBRARIES change and code becomes outdated.


Check Python Version that came with Conda

% python --version
Python 3.9.13

 

Create a Conda TensorFlow environment

$ conda create -n py_39_tf python=3.9 tensorflow -y

This installs tensorflow         pkgs/main/osx-64::tensorflow-2.9.1

List conda environments you already created



$ conda info --envs

 

% conda info --envs

# conda environments:

#

base                  *  /Users/uki/opt/anaconda3

py_39_tf                 /Users/uki/opt/anaconda3/envs/py_39_tf





Activate the Conda Environment you want Jupyter in.


% conda activate py_39_tf

(py_39_tf) uki ~ %






Install new Jupyther kernel


$ python -m ipykernel install --user --name py_36_tf --display-name "Python 3.6 (tensorflow)"



 



List currently installed Jupyther kernels 



$ ls -alt ~/Library/Jupyter/kernels/


total 0
drwx------ 7 uki staff 224 Nov 22 11:50 ..
drwxr-xr-x 9 uki staff 288 Nov 22 11:43 .
drwxr-xr-x 5 uki staff 160 Nov 4 06:35 julia-1.4
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python361064bitpy36condaa60168e76a7b4349b469299762ee4c30
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python38264bitpytorchcondaaf5a833263b448b8b2738bb5a7355c8a
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python361064bitturiconda565ecc262d0845fbb235ae21ac24296f












Installed kernelspec py_36_tf in /Users/uki/Library/Jupyter/kernels/py_36_tf

Refresh a page with Jupyther Lab notebook and change to the new kernel.




Delete kernels that you want to replace


$ rm -r ~/Library/Jupyter/kernels/my_old_kernel_name

 



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