How to install torchtext 0.4.0 on conda
Asked Answered
C

5

7

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?

Chaumont answered 31/7, 2019 at 8:33 Comment(0)
A
3
  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!

Anisotropic answered 31/7, 2019 at 12:9 Comment(0)
D
5

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

conda install -c pytorch torchtext

https://anaconda.org/pytorch/torchtext

Dovev answered 18/9, 2019 at 19:11 Comment(0)
A
3
  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!

Anisotropic answered 31/7, 2019 at 12:9 Comment(0)
R
0
conda install -c derickl torchtext

torchtext package is available in derickl channel. You can also use pip install in conda. The conda environment will create a layer of pip installed packages.

Raybourne answered 31/7, 2019 at 8:48 Comment(2)
This gives torchtext 0.3.0, though.Chaumont
It should be there conda list. If you do conda env export > environment.yml and open the yaml file, you will see under pip, the packages that conda will install using pip when recreation environment from y’all fileRaybourne
D
0

I was able to install torchtext-0.4.0 in my windows's anaconda environment using

pip install https://github.com/pytorch/text/archive/master.zip

Discerning answered 31/7, 2019 at 12:8 Comment(0)
B
0

You might consider adding it to conda-forge, there was a good start here but I don't think it went into conda-forge. Then you could run conda install -c conda-forge torchtext

Burial answered 31/7, 2019 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.