facebookresearch / pytext

A natural language modeling framework based on PyTorch
https://pytext.readthedocs.io/en/master/
Other
6.34k stars 801 forks source link

No module named 'pytorch' #1706

Open anjali-chadha opened 3 years ago

anjali-chadha commented 3 years ago

Steps to reproduce

Installed both torch and torchtext from the source code

Observed Results

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/init.py in 10 from caffe2.python import workspace 11 from caffe2.python.predictor import predictor_exporter ---> 12 from pytext.data.sources.data_source import DataSource 13 from pytext.task import load 14 from pytext.task.new_task import NewTask

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/data/init.py in 10 NaturalBatchSampler, 11 ) ---> 12 from .data import Batcher, Data, PoolingBatcher, generator_iterator 13 from .data_handler import BatchIterator, CommonMetadata, DataHandler 14 from .disjoint_multitask_data import DisjointMultitaskData

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/data/data.py in 12 from pytext.utils.usage import log_class_usage 13 ---> 14 from .sources import DataSource, RawExample, TSVDataSource 15 from .sources.data_source import ( 16 GeneratorIterator,

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/data/sources/init.py in 2 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 3 ----> 4 from .conllu import CoNLLUNERDataSource 5 from .data_source import DataSource, RawExample 6 from .dense_retrieval import DenseRetrievalDataSource

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/data/sources/conllu.py in 5 from typing import Dict, List, Optional, Type 6 ----> 7 from pytext.data.sources.data_source import RootDataSource, SafeFileWrapper 8 9

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/data/sources/data_source.py in 10 from pytext.data.utils import shard 11 from pytext.utils.data import Slot, parse_slot_string ---> 12 from pytext.utils.file_io import PathManager 13 14

/usr/local/lib/python3.6/dist-packages/pytext_nlp-0.3.3-py3.6.egg/pytext/utils/file_io.py in 10 # TODO: @stevenliu use PathManagerFactory after it's released to PyPI 11 from iopath.common.file_io import HTTPURLHandler ---> 12 from pytorch.text.fb.utils import PATH_MANAGER as PathManager # noqa 13 14

ModuleNotFoundError: No module named 'pytorch'


## Expected Results

  * What did you expect to happen? 
    No errors while importing pytext

Module causing this error `pytorch.text.fb.utils` is not mentioned in the requirements.txt. Is this an internal module to FB?
Any recommendation to circumvent this error?

Thanks!
anjali-chadha commented 3 years ago

@hudeven I came across a commit in June 2021 where you committed changes adding this import statement: https://github.com/facebookresearch/pytext/commit/7ec49a8aa26dbc174436da07ab78f1a591d4c2f0

from pytorch.text.fb.utils import PATH_MANAGER as PathManager  # noqa

Could you help with this issue?

Is torchtext's installation from source supported for non-facebook (external) users? It will be great to update the README.md if that is no longer the case.

Thanks!

wangke1996 commented 3 years ago

same issue here. Torch version: 1.5.1 TorchText version: 0.6.0 Install pytext from source

lyan62 commented 2 years ago

same issue here. Torch version: 1.5.1 TorchText version: 0.6.0 Install pytext from source

same here, did you figure it out?

bbored commented 2 years ago

I guess our gpu is not supported from cuda or you don't have the right cuda version installed for torch.

longxudou commented 2 years ago

Same problem here.

bhomass commented 2 years ago

apparently this is a bug left in the source. installing from pypi does not have this problem.