0

I have to install py4jdbc module in python on windows 10, but i am having the followings errors when i try to use pip install py4jdbc or from the source:

Error 1: "The executable sbt cannot be found"

Pip Error

Error 2: "the file doesn't exist..."

Error From source

I have sbt already install and in the path.

Is there something i am missing?

Nacho
  • 3
  • 5
  • Do you have `sbt.exe` in the `%PATH%`? Can you run `sbt.exe` from the terminal? – phd Feb 15 '20 at 16:02
  • yes , i can run sbt from the terminal and even do the hello world in scala. – Nacho Feb 16 '20 at 17:12
  • `python -c "from distutils.spawn import find_executable; print(find_executable('sbt'))"` – phd Feb 16 '20 at 17:19
  • When i run this on cmd i get None, what does it means? – Nacho Feb 18 '20 at 13:09
  • You don't have `sbt.exe` in `%PATH%`. It could be `sbt.bat` or `sbt.cmd` but not `sbt.exe`. And `py4jdbc` uses function `find_executable` that on w32 looks for only `.exe`. – phd Feb 18 '20 at 13:11
  • Thank you, where should i download sbt.exe? Because as you said, in my instalation dir,i only have sbt.bat – Nacho Feb 18 '20 at 13:19

1 Answers1

0

It seems py4jdbc was not tested on Windows as it uses a function distutils.spawn.find_executable that on w32 looks only for sbt.exe while you have sbt.bat.

My advice is to try to fix py4jdbc. Download it with pip download py4jdbc (it also downloads dependency py4j), unpack the archive py4jdbc-0.1.6.8.tar.gz and edit setup.py: at line 28 replace 'sbt' with 'sbt.bat'. Install with pip install . (<- the dot at the end means "the current directory".)

phd
  • 82,685
  • 13
  • 120
  • 165