Installing Apache Superset into CentOS 7 with Python 3.7

Following are the starter commands to install superset:

  • $ python –version
    • Python 3.7.5
  • $ pip install superset

Possible Errors:

You might be hitting any or all of the following error(s):

Running setup.py install for python-geohash … error
ERROR: Command errored out with exit status 1:

building ‘_geohash’ extension
……
unable to execute ‘gcc’: No such file or directory
error: command ‘gcc’ failed with exit status 1

gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
error: command ‘gcc’ failed with exit status 1

Look for:

  • $ gcc –version <= You must have gcc installed
  • $ locate cc1plus <= You must have cc1plus install

Install the required libraries and tools:

If any of the above components are missing, you need to install a few required libraries:

  • $ sudo yum install mlocate <= For locate command
  • $ sudo updatedb  <= Update for mlocate
  • $ sudo yum install gcc <=For gcc if you don’t have
  • $ sudo yum install gcc-c++  <== For cc1plus if you dont have

Verify the following again:

  • $ gcc –version
  • $ locate cc1plus
    • /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus

Note:

  • If you could locate cc1plus properly however still getting the error, try the following
    • sudo ln -s /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus /usr/local/bin/
  • Try installing again

Final Installation:

Now you can install  superset as below:

  • $ pip install superset
    • Python 3.7.5
      Flask 1.1.1
      Werkzeug 0.16.0
  • $ superset db upgrade
  • $ export FLASK_APP=superset
  • $ flask fab create-admin
    • Recognized Database Authentications.
      Admin User admin created.
  • $ superset init
  • $ superset run -p 8080 –with-threads –reload –debugger

 

That’s all.

@avkashchauhan

Advertisement

Refresher R for Beginners

R Studio Environment

R Location (OSX)

$ ls –l /Library/Frameworks/R.framework/Versions

#Get R Version

version

R01

Environment

getwd()

setwd(“/Users/avkashchauhan/work/global”)

getwd()

dir()

#Getting Help

help(getwd)

#Reading a File

help(read.csv)

filename <- “test.csv”

filex <- read.csv(filename, header = TRUE, sep=”,”)

filex

summary(filex)

filex$id

filex$name

filex$age

filex$zip

names(filex)

attributes(filex)

# Listing All Vars

ls()

# ls() – List of all variables

# DataTypes & number Assignment

asc <- c(1,2,3,4,5,6,7,8,9,10)

# What is c? c is “combine”

asc[2]

asc[5]

asc[5:6]

asc[1:9]

View(asc)

a <- 10

a

a[1]

a[3]

help(sqrt)

a <- sqrt(10)

a

a <- sqrt(10*a)

a

asc

mean(asc)

median(asc)

help(var)

typeof(asc)

typeof(a)

# String data type

a <- c(“this”, “is”, “so”, “fun”)

a

a[1]

typeof(a)

#Understanding c or combine

a <- 10

> a

[1] 10

> a[1]

[1] 10

> a[2]

[1] NA

> a <- c(10)

> a

[1] 10

> a[2]

[1] NA

# DATAFRAME

# creating a data frame

a <- c(1,2,3,4,5,6,7,8,9,10)

b <- c(10,20,30,40,50,60,70,80,90,100)

ab <- data.frame(first=a, second=b)

ab

ab[1]

ab[1][1]

ab[1][2] ß XXX

ab[2]

ab[2][1]

ab[2][2] ß XXX

ab$first

ab$second

ab$second[1]

ab$second[3]

ab$first[10]

View(ab)

#Logical

a <- c(TRUE)

a

typeof(a)

a <- c(FALSE)

a

typeof(a)

#Conditions in R

a <- c(TRUE)

if(!a) a <- c(FALSE)

a ß Still TRUE

if(a) a <- c(FALSE)

a ß FALSE Now

a <- c(TRUE,FALSE)

a

a[1]

a[2]

if (a[1]) a[2] <- TRUE

a

R02

Factor in R – A “factor” is a vector whose elements can take on one of a specific set of values. For example, “Sex” will usually take on only the values “M” or “F,” whereas “Name” will generally have lots of possibilities. The set of values that the elements of a factor can take are called its levels.

a <- factor(c(“Male”, “Female”, “Female”, “Male”, “Male”))

a

a <- factor(c(“A”,”A”,”B”,”A”,”B”,”B”,”C”,”A”,”C”))

a

Tables: (One way and two way)

a <- factor(c(“Male”, “Female”, “Female”, “Male”, “Male”))

a

mytable <- table(a)

a

mytable

summary(a)

attributes(a)

#datatype check R

#Example #1

a <- c(1,2,4)

is.numeric(a)

is.factor(a)

#Example #2

b <- factor(c(“M”, “F”))

b

is.factor(b)

is.numeric(b)

Graph Plotting in R

Using Library ggplot2

#installing ggplot2

install.packages(“ggplot2”)

R03

also installing the dependencies ‘colorspace’, ‘Rcpp’, ‘stringr’, ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’

Using ggplot2 Library

 

library(ggplot2)

detach(package:ggplot2)

head(diamonds)

View(diamonds)

qplot(clarity, data=diamonds, fill=cut, geom=”bar”)

R04

qplot(clarity, data=diamonds, geom=”bar”, fill=cut, position=”stack”)

qplot(clarity, data=diamonds, geom=”freqpoly”, group=cut, colour=cut, position=”identity”)

R05

qplot(carat, data=diamonds, geom=”histogram”, binwidth=0.1)

qplot(carat, data=diamonds, geom=”histogram”, binwidth=0.01)

R06

Graph Source: http://www.ceb-institute.org/bbs/wp-content/uploads/2011/09/handout_ggplot2.pdf

Keywords:  R, Analysis, ggplot,