2

I'm trying to follow the PredictionIO tutorial for a text classification enginge provided here. I'm using OSX and PredictionIO together with PostgreSQL.

When trying to import data into my naked App with the command

pio import --appid 1 --input data/stopwords.json

I get the following error:

Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/pio

So obviously the JDBC driver is missing or not linked appropriately. Here's where my trouble begins. Naively I downloaded the postgres jdbc driver from this source. I read that I need to add it to java's "CLASSPATH", so I tried this by adding

export CLASSPATH=$CLASSPATH:~/java-extensions/postgresql-9.4.1207.jre6.jar

to my bash configuration. Unfortunatly this does not work. A similar error situation is discussed here - but with my knowledge I'm not able to extract useful hints from it.

--

Version details:

psql (PostgreSQL) 9.4.5 installed via homebrew

OSX Yosemite

PredictionIO 0.9.5

pio status reports "Your system is all ready to go."

  • Have you run `install.sh`, because it looks like that downloads the driver. Note that setting the `CLASSPATH` environment variable usually doesn't work well as a lot of Java applications don't actually use it (not sure if that applies to predictionio) – Mark Rotteveel Jan 23 '16 at 16:44
  • Yes, I ran predictionio's `install.sh` initially and its output told me that I have to install PostgreSQL manually (but it was already installed on my machine before, so I only created an approrpriate role and db for PredictionIO). – Robin Stammer Jan 23 '16 at 20:21
  • Possible duplicate of [Error with pio import](http://stackoverflow.com/questions/33691711/error-with-pio-import) – alex9311 Mar 10 '16 at 10:30

2 Answers2

3

See this Google Group thread: https://groups.google.com/d/topic/predictionio-user/yJexMh5HpHc/discussion

tl;dr :

Fixed in next release of PredictionIO (v0.9.6), coming soon.

Workaround for earlier PIO versions :

pio train -- --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar 
  • As stated initially I already know the Google Group, but this solution does not work with the `pio import` command, since it has no `--driver-class-path` flag to set. Do you know if the issue is fixed for the `pio import` command in the next release, too? – Robin Stammer Jan 27 '16 at 10:29
  • 1
    I managed to get the --driver-class-path flag working with import, I'll add it to the answer – alex9311 Mar 10 '16 at 09:49
3

As alex9311 pointed out, the pio import nowadays accepts a flag to specify the driver location:

pio import --appid 1 --input data/stopwords.json --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar 

See also this SO question

Community
  • 1
  • 1