AbdullahO / tspdb

tspdb: Time Series Predict DB
Apache License 2.0
185 stars 58 forks source link

SELECT test_tspdb(); gives error #11

Closed cheslansimpson closed 2 years ago

cheslansimpson commented 2 years ago

Hi, I followed the instruction and everything is working well up until I get to the "SELECT test_tspdb();" command in postgres. I then get the error below.

postgres=# CREATE EXTENSION tspdb; CREATE EXTENSION postgres=# SELECT test_tspdb(); ERROR: ModuleNotFoundError: No module named 'tspdb' CONTEXT: Traceback (most recent call last): PL/Python function "test_tspdb", line 2, in from tspdb.src.database_module.plpy_imp import plpyimp PL/Python function "test_tspdb"

Any suggestions on how else to troubleshoot would be very much appreciated?

Also, I had to change the permission on both tspdb files copied to... /usr/share/postgresql/12/extension/

Thanks

AbdullahO commented 2 years ago

This indicate that the tspdb python library is not installed on the python engine used by PostgreSQL. This happens when you use the "wrong" pip when installing tspDB. Can you give me more details about the operating system you are using? Generally, we recommend using Ubuntu as it is easier to debug.

cheslansimpson commented 2 years ago

I am using Ubuntu. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal

I installed python3.6 along with other versions of python

AbdullahO commented 2 years ago

I think the problem lie in the fact the pip used to install the package is not the pip used for the python version used by Postgres. To check, you should get the same error if you write the query

DO $$ import tspdb $$ LANGUAGE plpython3u;

To know which version is being used by your Postgres, you can write the query

DO $$ import sys plpy.notice(sys.version) plpy.notice(sys.executable) $$ LANGUAGE plpython3u;

I suspect that you have other python3 versions and when you used pip, you installed the package for that version. Check which python your postgres is using, and then install the tspDB package there.

Also refer to the Demo in Colab, the installation seems to work well there, so I suspect the problem is with previous versions of python installed.

optionsraghu commented 2 years ago

I am getting the following error. Can you please help? I have followed the installation verbartim.

postgres=# SELECT test_tspdb(); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed.

cheslansimpson commented 2 years ago

@[AbdullahO] -- Thanks for the advice below. It worked. Installed it under python 3.8. Replaced "3.6" with "3.8".

I think the problem lie in the fact the pip used to install the package is not the pip used for the python version used by Postgres. To check, you should get the same error if you write the query

DO $$ import tspdb $$ LANGUAGE plpython3u;

To know which version is being used by your Postgres, you can write the query

DO $$ import sys plpy.notice(sys.version) plpy.notice(sys.executable) $$ LANGUAGE plpython3u;

I suspect that you have other python3 versions and when you used pip, you installed the package for that version. Check which python your postgres is using, and then install the tspDB package there.

Also refer to the Demo in Colab, the installation seems to work well there, so I suspect the problem is with previous versions of python installed.