Dhanashri Dinkar
Dhanashri Dinkar

Reputation: 1

Apache Pig not working

I'm working on apache pig. I have installed Hadoop and it is running sucessfully. But when I enter the 'pig' command on the terminal , I do not get any output. I tried using 'pig -x local' but it gives the following error

pig: invalid option -- 'x'

usage: pig

I made the following changes in bashrc and profile -

bashrc-

export PIG_HOME=/usr/local/pig-0.12.1
export PATH=$PATH:$PIG_HOME/bin
export PIG_CLASSPATH=$HADOOP_HOME/etc/hadoop/

profile-

export PIG_HOME=/usr/local/pig-0.12.1

export PATH=$PATH:$PIG_HOME/bin:$HADOOP_HOME/bin

I cannot figure out why the output is not being displayed. Can you please help? Thanks in advance.

Upvotes: 0

Views: 6770

Answers (4)

DINO U
DINO U

Reputation: 126

just follow steps:

  1. Open your .bashrc file using command $ gedit ~/.bashrc (this will open your .bashrc file in text editor)

  2. copy below code and paste it in your .bashrc file

    export PIG_HOME=/usr/local/pig-0.16.0

    export PIG_CONF_DIR=$PIG_HOME/conf

    export PIG_CLASSPATH=$PIG_CONF_DIR

    export PATH=$PIG_HOME/bin:$PATH

  3. then save the file (ctl+s), then close the file and go to terminal. then type

    source ~/.bashrc

  4. press enter button again type

    pig -version

  5. you will see below

    Apache Pig version 0.16.0 (r1746530)

    compiled Jun 01 2016, 23:10:49

it means you are on right track.

Upvotes: 1

Neil Takru
Neil Takru

Reputation: 11

Please check if in /usr/games you have a pig file. If that's the case then you should run the following commands-

sudo apt-get remove bsdgames
sudo apt-get remove --auto-remove bsdgames
sudo apt-get purge bsdgames
sudo apt-get purge --auto-remove bsdgames

After this shut down the system and then after starting use pig -version command. I hope it helps!

Upvotes: 1

Rakeshb
Rakeshb

Reputation: 1

If anyone facing issue with apache-pig setup

here is solution:

rock@rock-VirtualBox:~$ pig -version

pig: invalid option -- 'v'

usage: pig

rock@rock-VirtualBox:~$ pig -x local

pig: invalid option -- 'x'

usage: pig

If your facing same above issue, just follow steps:

rock@rock-VirtualBox:~$ gedit .bashrc

Change like or write else copy paste in gedit

PIG_HOME PATH:-

export PIG_HOME=/usr/local/Hadoop-env/pig-0.16.0

export PIG_CONF_DIR=$PIG_HOME/conf

export PIG_CLASSPATH=$PIG_CONF_DIR

export PATH=$PIG_HOME/bin:$PATH

Press ctrl+s to save it, close gedit then go to command line/terminal

rock@rock-VirtualBox:~$ source .bashrc

rock@rock-VirtualBox:~$ pig -version

Apache Pig version 0.16.0 (r1746530) 

compiled Jun 01 2016, 23:10:49

issue is solved as per my case

Upvotes: 0

Eshan Chattaraj
Eshan Chattaraj

Reputation: 1

check the .bashrc file and see whether that very line is commented or not..and after that make sure hadoop path--

"export PIG_CLASSPATH=$HADOOP_HOME/etc/hadoop/bin"

"export PIG_HOME=/usr/local/pig-0.12.1"

is written correctly. if not try to reinstall/update the Pig

Upvotes: 0

Related Questions