Skip to content

Spacy 3.0 not working in colab pro #7912

Closed
@satbalak

Description

How to reproduce the behaviour

I have google colab pro and when I do !nvidia-smi, I see that I have been allocated Tesla P100-PCIE.

After installing Spacy 3.0 and installing cupy library, I get the following error when I even try to get the spacy version

!python -m spacy info
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.7/dist-packages/spacy/__init__.py", line 10, in <module>
    from thinc.api import prefer_gpu, require_gpu, require_cpu  # noqa: F401
  File "/usr/local/lib/python3.7/dist-packages/thinc/__init__.py", line 5, in <module>
    from .config import registry
  File "/usr/local/lib/python3.7/dist-packages/thinc/config.py", line 14, in <module>
    import srsly
  File "/usr/local/lib/python3.7/dist-packages/srsly/__init__.py", line 4, in <module>
    from ._msgpack_api import read_msgpack, write_msgpack, msgpack_dumps, msgpack_loads
  File "/usr/local/lib/python3.7/dist-packages/srsly/_msgpack_api.py", line 3, in <module>
    from . import msgpack
  File "/usr/local/lib/python3.7/dist-packages/srsly/msgpack/__init__.py", line 13, in <module>
    from ._msgpack_numpy import encode_numpy as _encode_numpy
  File "/usr/local/lib/python3.7/dist-packages/srsly/msgpack/_msgpack_numpy.py", line 19, in <module>
    import cupy
  File "/usr/local/lib/python3.7/dist-packages/cupy/__init__.py", line 12, in <module>
    _environment._preload_libraries()  # NOQA
  File "/usr/local/lib/python3.7/dist-packages/cupy/_environment.py", line 286, in _preload_libraries
    if (config is None) or (config['packaging'] == 'conda'):
KeyError: 'packaging'

This error did not occur till yesterday when I used the free colab pro :-( ... I suspect this is something

Your Environment

  • Operating System: Google Colab with Tesla P100 GPU
  • Python Version Used: 3.20.7
  • spaCy Version Used: 3
  • Environment Information:
!wget https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64 -O cuda-repo-ubuntu1604–9–2-local_9.2.88–1_amd64.deb

!dpkg -i cuda-repo-ubuntu1604–9–2-local_9.2.88–1_amd64.deb
!apt-key add /var/cuda-repo-9–2-local/7fa2af80.pub
!apt-get update
!apt-get install cuda-9.2

!pip install torch==1.7.1+cu92 torchvision==0.8.2+cu92 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

!pip install -U spacy[cuda92,transformers]
!export CUDA_PATH=”/usr/local/cuda-9.2"
!export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH

!pip install -U spacy
!python -m spacy download en_core_web_trf

!pip install cupy

After installing cupy, I see that that Spacy commands start giving the above error. Please help!
It worked fine till yesterday when I was on the free google colab when it was taking a different type of GPU

Metadata

Assignees

No one assigned

    Labels

    gpuUsing spaCy on GPUinstallInstallation issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions