Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install torchtext 0.4.0 on conda

The torchtext 0.4.0 library exists (can be downloaded thru pip), but conda install torchtext=0.4.0 will not work. How can I download torchtext to a anaconda environment?

like image 288
gust Avatar asked Jul 31 '19 08:07

gust


2 Answers

You can also use the pytorch channel as described on the official anaconda site:

conda install -c pytorch torchtext

https://anaconda.org/pytorch/torchtext

like image 68
gneusch Avatar answered Sep 24 '22 03:09

gneusch


  1. Create conda env with python:

    $ conda create -n torchtext python=3.7

  2. Activate it:

    $ conda activate torchtext

torchtext 0.4.0 installation currently is not available via conda. So we will use pip, anyway pip installs torchtext inside your activated conda env.

  1. Let's find torchtex available versions:

    (torchtext)$ pip search torchtext torchtext (0.3.1) - Text utilities and datasets for PyTorch

As you can see there is no 0.4.0. 4. But we can install it from official github repo:

(torchtext)$ pip install git+https://github.com/pytorch/text.git
  1. Verify the installation:

    (torchtext)$ conda list

    ...

    torch 1.1.0 pypi_0 pypi

    torchtext 0.4.0 pypi_0 pypi

    tqdm 4.32.2 pypi_0 pypi

    ...

    (torchtext)$ python -c "import torchtext; print('torchtext is fine!')"

    torchtext is fine!

like image 30
trsvchn Avatar answered Sep 23 '22 03:09

trsvchn