Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improt error: ModuleNotFoundError: No module named 'torch._C' #1758

Open
sherwinNG opened this issue Nov 15, 2022 · 2 comments
Open

improt error: ModuleNotFoundError: No module named 'torch._C' #1758

sherwinNG opened this issue Nov 15, 2022 · 2 comments

Comments

@sherwinNG
Copy link

`In [1]: from sentence_transformers import SentenceTransformer

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from sentence_transformers import SentenceTransformer

~/anaconda3/envs/zhangxuewen/lib/python3.6/site-packages/sentence_transformers/init.py in
1 version = "2.2.2"
2 MODEL_HUB_ORGANIZATION = 'sentence-transformers'
----> 3 from .datasets import SentencesDataset, ParallelSentencesDataset
4 from .LoggingHandler import LoggingHandler
5 from .SentenceTransformer import SentenceTransformer

~/anaconda3/envs/zhangxuewen/lib/python3.6/site-packages/sentence_transformers/datasets/init.py in
----> 1 from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset
2 from .NoDuplicatesDataLoader import NoDuplicatesDataLoader
3 from .ParallelSentencesDataset import ParallelSentencesDataset
4 from .SentencesDataset import SentencesDataset
5 from .SentenceLabelDataset import SentenceLabelDataset

~/anaconda3/envs/zhangxuewen/lib/python3.6/site-packages/sentence_transformers/datasets/DenoisingAutoEncoderDataset.py in
----> 1 from torch.utils.data import Dataset
2 from typing import List
3 from ..readers.InputExample import InputExample
4 import numpy as np
5 import nltk

~/anaconda3/envs/zhangxuewen/lib/python3.6/site-packages/torch/utils/init.py in
2 import sys
3
----> 4 from .throughput_benchmark import ThroughputBenchmark
5 from ._crash_handler import enable_minidumps, disable_minidumps, enable_minidumps_on_exceptions
6

~/anaconda3/envs/zhangxuewen/lib/python3.6/site-packages/torch/utils/throughput_benchmark.py in
1
----> 2 import torch._C
3
4 def format_time(time_us=None, time_ms=None, time_s=None):
5 '''Defines how to format time'''

ModuleNotFoundError: No module named 'torch._C'`

@sherwinNG
Copy link
Author

import sklearn can solve this question

@SebJansen
Copy link

I tried with python3.11, but there where wheels missing on pypi

then on 3.10, I got the aforementioned error message which you copy pasted

eventually with 3.9, I got things working

my 2c, caveat emptor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants