简体   繁体   中英

Can't setup Python environment on vanilla Ubuntu Server

I wrote a simple Python server which, among others things, uses tabula-py wrapper for the Java library Tabula. After testing it locally, using a corresponding client and determining everything works, I attempted to run it on a vanilla Ubuntu Server 16.04 VBox instance. As I was getting a runtime error (same as below), I attempted a simple test using Python CLI:

>>> import tabula
>>> df = tabula.read_pdf("https://www.autotrolej.hr/att/wp-content/uploads/2016/04/lin-2-vazi-od-16-01-2017.pdf")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/wrapper.py", line 54, in read_pdf_table
    output = subprocess.check_output(args)
  File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Server is started from the command line and the shebang used is:

#!/usr/bin/env python

I tried exporting pip freeze requirements and installing the same libraries on the VBox server, only to get the same subprocess error during installation for many of those libraries. I'm guessing it's a Python environment problem as Ubuntu Server does not have Python preinstalled so I probably neglected installing an important core library or setting an environment variable. What am I missing?

As the project description of tabula-py says:

Simple wrapper of tabula-java

Tabula-java requires Java. Make sure that you have Java installed on your computer . To make sure that java works, type java -version .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM