Skip to content

ImportError: cannot import name 'Tensor' from 'torch' (unknown location) #1302

@daimenhutchison

Description

@daimenhutchison

Hi, I'm trying to setup a self-hosted installation on Rocky 9.3. I've followed the instructions, and ensured that I have the dependencies listed in the requirements.txt (and the linux version). The installation completed with no errors and I was able to create the extension fine.

I get the following error;

postgres=# SELECT pgml.transform(
    'translation_en_to_fr',
    inputs => ARRAY[
        'Welcome to the future!',
        'Where have you been all this time?'
    ]
) AS french;
ERROR:  Traceback (most recent call last):
  File "transformers.py", line 10, in <module>
  File "/usr/local/lib/python3.9/site-packages/InstructorEmbedding/__init__.py", line 1, in <module>
    from .instructor import *
  File "/usr/local/lib/python3.9/site-packages/InstructorEmbedding/instructor.py", line 8, in <module>
    from torch import Tensor, device
 ImportError: cannot import name 'Tensor' from 'torch' (unknown location)

I'm able to run SELECT * FROM pgml.load_dataset('diabetes'); no problem.

And this SELECT pgml.validate_python_dependencies(); returns;

Python version: 3.9.18 (main, Sep  7 2023, 00:00:00) 
[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]
Scikit-learn 1.3.2, XGBoost 2.0.2, LightGBM 4.1.0, NumPy 1.26.2

Not sure what to check next, would appreciate any advice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions