question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Dependency Bug]`sentencepiece` is not installed as a dependency in conda

See original GitHub issue

🐛 Bug

Describe the bug After installing the torchtext, and trying the code below (in the repro section) an error pops up: ModuleNotFoundError: No module named 'sentencepiece'. I think the package should be installed automatically as a dependency.

The problem is that the depndency on sentencepiece is specified for pip, but not for conda (see attachments)

To Reproduce

After installing using

conda install -c pytorch torchtext

run the following:

from torchtext import data
from torchtext import datasets

imdb_set = datasets.IMDB(DATA_PATH,
                         text_field=data.Field(),
                         label_field=data.LabelField())
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-15-019e470b76d6> in <module>
----> 1 from torchtext import data
      2 from torchtext import datasets
      3 
      4 imdb_set = datasets.IMDB(DATA_PATH,
      5                          text_field=data.Field(),

~/miniconda3/envs/py37-ml/lib/python3.7/site-packages/torchtext/__init__.py in <module>
----> 1 from . import data
      2 from . import datasets
      3 from . import utils
      4 from . import vocab
      5 from . import experimental

~/miniconda3/envs/py37-ml/lib/python3.7/site-packages/torchtext/data/__init__.py in <module>
      8 from .pipeline import Pipeline
      9 from .utils import get_tokenizer, interleave_keys
---> 10 from .functional import generate_sp_model, \
     11     load_sp_model, \
     12     sentencepiece_numericalizer, \

~/miniconda3/envs/py37-ml/lib/python3.7/site-packages/torchtext/data/functional.py in <module>
----> 1 import sentencepiece as spm
      2 import re
      3 
      4 __all__ = [
      5     "generate_sp_model", "load_sp_model",

ModuleNotFoundError: No module named 'sentencepiece'

Expected behavior

If some core part of the torchtext package is using a third-party package, it should be added as a dependency.

Screenshots

conda search --info torchtext doesn’t list sentencepiece as a dependency.

image

However, pip show torchtext does:

image

Environment

Collecting environment information… PyTorch version: 1.4.0 Is debug build: No CUDA used to build PyTorch: 10.1

OS: Ubuntu 18.04.4 LTS GCC version: (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 CMake version: version 3.10.2

Python version: 3.7 Is CUDA available: Yes CUDA runtime version: 10.1.243 GPU models and configuration: GPU 0: GeForce GT 730 GPU 1: GeForce RTX 2080 Ti

Nvidia driver version: 440.44 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5 /usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudnn.so.7.6.5 /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7.6.5 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7.6.5

Versions of relevant libraries: [pip] numpy==1.18.1 [pip] torch==1.4.0 [pip] torchaudio==0.4.0a0+719bcc7 [pip] torchsummary==1.5.1 [pip] torchtext==0.5.0 [pip] torchvision==0.5.0 [conda] blas 1.0 mkl
[conda] mkl 2020.0 166
[conda] mkl-service 2.3.0 py37he904b0f_0
[conda] mkl_fft 1.0.15 py37ha843d7b_0
[conda] mkl_random 1.1.0 py37hd6b4f25_0
[conda] pytorch 1.4.0 py3.7_cuda10.1.243_cudnn7.6.3_0 pytorch [conda] torchaudio 0.4.0 py37 pytorch [conda] torchsummary 1.5.1 pypi_0 pypi [conda] torchtext 0.5.0 py_1 pytorch [conda] torchvision 0.5.0 py37_cu101 pytorch

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
zhangguanheng66commented, Apr 7, 2020

As a temporary walkaround, users can install sentencepiece from channel powerai

conda install -c powerai sentencepiece

We will build our conda package in the similar way. https://github.com/pytorch/text/pull/726

1reaction
z-a-fcommented, Apr 1, 2020

Maybe to mitigate this problem, it is worth adding pip as a dependency in the meta.yaml, and adding pip install sentencepiece==xx.xx in the build section?

Read more comments on GitHub >

github_iconTop Results From Across the Web

sentencepiece library is not being installed in the system
sentencepiece is a library that requires binary extensions and thus has to package individual wheels for each operating system, ...
Read more >
sentencepiece - PyPI
Python wrapper for SentencePiece. This API will offer the encoding, decoding and training of Sentencepiece. Build and Install SentencePiece. For Linux (x64/i686) ...
Read more >
Package List — Spack 0.20.0.dev0 documentation
This is a list of things you can install using Spack. ... Versions: 2.2.26; Build Dependencies: tcsh; Description: Legacy NCBI BLAST distribution --...
Read more >
note: this error originates from a subprocess, and is likely not a ...
exit() C:\Users\donhu>conda install -c huggingface transformers 'conda' is not ... updating the dependencies; install a very specific rust version.
Read more >
Installation - Hugging Face
Install Transformers for whichever deep learning library you're working with ... different projects, and avoid compatibility issues between dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found