spacy throws exception when run from Terminal, fails to import as module
- Dominant language
- Python
- Stars
- 33.9k
- Forks
- 4.7k
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
Installed spacy and it's requirements as per the instructions here: https://pypi.org/project/spacy/
Result:
```
Downloading spacy-3.8.14-cp313-cp313-macosx_11_0_arm64.whl (6.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.0/6.0 MB 811.1 kB/s 0:00:07
Installing collected packages: spacy
Successfully installed spacy-3.8.14
```
When running any spacy commands from the Terminal like
```
python -m spacy validate
```
the following error message appears
```
Traceback (most recent call last):
File "", line 203, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy/__main__.py", line 4, in
setup_cli()
~~~~~~~~~^^
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy/cli/_util.py", line 75, in setup_cli
registry.cli.get_all()
~~~~~~~~~~~~~~~~~~~~^^
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/catalogue/__init__.py", line 110, in get_all
result.update(self.get_entry_points())
~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/catalogue/__init__.py", line 125, in get_entry_points
result[entry_point.name] = entry_point.load()
~~~~~~~~~~~~~~~~^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/metadata/__init__.py", line 179, in load
module = import_module(match.group('module'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1395, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1023, in exec_module
File "", line 488, in _call_with_frames_removed
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy_curated_transformers/cli/debug_pieces.py", line 20, in
from ..pipeline.transformer import CuratedTransformer
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy_curated_transformers/pipeline/__init__.py", line 1, in
from .transformer import CuratedTransformer
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy_curated_transformers/pipeline/transformer.py", line 24, in
from ..models.listeners import ListenerStateUtils
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy_curated_transformers/models/__init__.py", line 1, in
from .architectures import (
...<6 lines>...
)
File "/Users/guy/Library/Python/3.13/lib/python/site-packages/spacy_curated_transformers/models/architectures.py", line 6, in
from curated_transformers.models.albert import AlbertConfig, AlbertEncoder
ImportError: cannot import name 'AlbertConfig' from 'curated_transformers.models.albert' (/Users/guy/Library/Python/3.13/lib/python/site-packages/curated_transformers/models/albert/__init__.py)
```
## How to reproduce the behaviour
Install spaCy as per the official instructions
## Your Environment
* Operating System: macOS 15.7.7 (arm64)
* Python Version Used: 3.13.14
* spaCy Version Used: 3.8.14
* Environment Information: ?
Contributor guide
Research direction
Start by reproducing `python -m spacy validate` in the stated macOS and Python 3.13 environment, then trace the import path through `spacy/__main__.py`, `spacy/cli/_util.py`, and `spacy_curated_transformers/cli/debug_pieces.py`. Done means the command runs without the `AlbertConfig` import error after installing spaCy according to the official instructions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100