I have PyTorch installed in my machine but whenever I try to do the following-
from torchtext import data
from torchtext import datasets
I get the following error.
ImportError: No module named 'torchtext'
How can I install torchtext?
I have PyTorch installed in my machine but whenever I try to do the following-
from torchtext import data
from torchtext import datasets
I get the following error.
ImportError: No module named 'torchtext'
How can I install torchtext?
As stated in the PyTorch forum, simply do:
$ pip install https://github.com/pytorch/text/archive/master.zip
That should do it.
If not, as an alternative, try:
$ pip install torchtext
For more advanced options, dependencies, and customized installations see:
I am using conda and succeeded with
conda install -c pytorch torchtext
The package was released with setuptools support. You can clone the repository and run python setup.py install
. Unfortunately, I don't think that they have released it on pip.
I got the import statements to work after i ran these commands:
conda create --name test5 python=3.6
conda install -c pytorch pytorch torchvision cpuonly torchtext
python
>>> from torchtext import data
>>> from torchtext import datasets
Or if you are using conda, you can run
conda install -c derickl torchtext
pip install --upgrade git+https://github.com/pytorch/text
I used it to ugrade on google colab