I installed spacy using
sudo pip install spacy
Within Python version 2.7.11, I try
>>> import spacy
and the following error is returned:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Trying within the Terminal
python -m spacy.en.download --force all
outputs
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named spacy.en
Thanks for sharing the issue, we are trying to make it as easy as possible to get started using spaCy. Some questions that will let us help you identify the problem:
Did the installation after sudo pip install spacy run through successfully? SpaCy is a compiled Python extension that needs to be build and hence has some system requirements (e.g., C/C++ compiler, python headers).
Are you using the Python that came with OSX or different one, e.g., homebrew, self-compiled?
Can you please run pip list as well as python -m pip list and paste the output here? Rationale: It could be that pip installed spaCy in a location that isn't obvious to your python interpreter.
Generally it is recommended not to install python packages system-wide (via sudo pip). Having said that, it should still work. Here are the steps for using virtualenv which a popular choice within the Python community and considered best-practice for package management:
sudo pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install spacy
I suspect you are using a recent version of OSX? This is our main development platform and we are pretty confident that spaCy should also work in your environment. Probably it's just a small problem...
Apologies for the inconvenience.
My pip is actually set to Python 3.4 (I expected that to be pip3).
Therefore, I should use
python3 -m spacy.en.download --force all
Please close. Sorry, I am a fool.
ImportError: No module named gold
Also got an ImportError during spaCy install at Processing /spaCy step, when building from source.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "spacy/__init__.py", line 5, in <module>
from .deprecated import resolve_model_name
File "spacy/deprecated.py", line 8, in <module>
from .cli import download
File "spacy/cli/__init__.py", line 5, in <module>
from .train import train, train_config
File "spacy/cli/train.py", line 8, in <module>
from ..scorer import Scorer
File "spacy/scorer.py", line 4, in <module>
from .gold import tags_to_entities
ImportError: No module named gold
I am using spacy v1.9.0 and getting the same error while running pytest:
"ImportError: No module named gold"
please help to resolve this.
Rebuilding from source should help as suggested in 1218.
Try this -
python setup.py build_ext --inplace
I'm having a similar problem while installing spacy.
As I'm working with python3 in pycharm, I tried:
python3 -m spacy.en.download --force all
Spacy seems to be installed on the system:
$ pip list | grep spacy
spacy (1.9.0)
But when I run my code, I get following error:
ImportError: No module named 'spacy'
I already tried running the installation from the anaconda folder, using:
conda install -c conda-forge spacy=1.9.0
But it doesn't seem to work..
Can anyone help me to resolve this issue?
same issue as @IsabelMeraner
Hi While I am trying to install pip install spacy then I am getting error as follows
pip install spacy
Collecting spacy
Using cached spacy-2.0.5.tar.gz
Requirement already satisfied: numpy>=1.7 in c:\users\jr00432239\appdata\local\p
rograms\python\python36-32\lib\site-packages (from spacy)
Collecting murmurhash<0.29,>=0.28 (from spacy)
Using cached murmurhash-0.28.0.tar.gz
Collecting cymem<1.32,>=1.30 (from spacy)
Using cached cymem-1.31.2.tar.gz
Collecting preshed<2.0.0,>=1.0.0 (from spacy)
Using cached preshed-1.0.0.tar.gz
Collecting thinc<6.11.0,>=6.10.1 (from spacy)
Using cached thinc-6.10.2.tar.gz
Collecting plac<1.0.0,>=0.9.6 (from spacy)
Using cached plac-0.9.6-py2.py3-none-any.whl
Requirement already satisfied: six in c:\users\jr00432239\appdata\local\programs
\python\python36-32\lib\site-packages (from spacy)
Collecting pathlib (from spacy)
Using cached pathlib-1.0.1.tar.gz
Collecting ujson>=1.35 (from spacy)
Using cached ujson-1.35.tar.gz
Collecting dill<0.3,>=0.2 (from spacy)
Using cached dill-0.2.7.1.tar.gz
Requirement already satisfied: requests<3.0.0,>=2.13.0 in c:\users\jr00432239\ap
pdata\local\programs\python\python36-32\lib\site-packages (from spacy)
Collecting regex==2017.4.5 (from spacy)
Using cached regex-2017.04.05-cp36-none-win32.whl
Requirement already satisfied: ftfy<5.0.0,>=4.4.2 in c:\users\jr00432239\appdata
\local\programs\python\python36-32\lib\site-packages (from spacy)
Collecting msgpack-python (from spacy)
Using cached msgpack-python-0.5.1.tar.gz
Collecting msgpack-numpy==0.4.1 (from spacy)
Using cached msgpack_numpy-0.4.1-py2.py3-none-any.whl
Collecting wrapt (from thinc<6.11.0,>=6.10.1->spacy)
Using cached wrapt-1.10.11.tar.gz
Collecting tqdm<5.0.0,>=4.10.0 (from thinc<6.11.0,>=6.10.1->spacy)
Using cached tqdm-4.19.5-py2.py3-none-any.whl
Collecting cytoolz<0.9,>=0.8 (from thinc<6.11.0,>=6.10.1->spacy)
Using cached cytoolz-0.8.2.tar.gz
Collecting termcolor (from thinc<6.11.0,>=6.10.1->spacy)
Using cached termcolor-1.1.0.tar.gz
Collecting pyreadline>=1.7.1 (from dill<0.3,>=0.2->spacy)
Using cached pyreadline-2.1.zip
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\jr00432239\appd
ata\local\programs\python\python36-32\lib\site-packages (from requests<3.0.0,>=2
.13.0->spacy)
Requirement already satisfied: idna<2.6,>=2.5 in c:\users\jr00432239\appdata\loc
al\programs\python\python36-32\lib\site-packages (from requests<3.0.0,>=2.13.0->
spacy)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\jr00432239\appdata
\local\programs\python\python36-32\lib\site-packages (from requests<3.0.0,>=2.13
.0->spacy)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\users\jr00432239\appd
ata\local\programs\python\python36-32\lib\site-packages (from requests<3.0.0,>=2
.13.0->spacy)
Requirement already satisfied: html5lib in c:\users\jr00432239\appdata\local\pro
grams\python\python36-32\lib\site-packages (from ftfy<5.0.0,>=4.4.2->spacy)
Requirement already satisfied: wcwidth in c:\users\jr00432239\appdata\local\prog
rams\python\python36-32\lib\site-packages (from ftfy<5.0.0,>=4.4.2->spacy)
Collecting toolz>=0.8.0 (from cytoolz<0.9,>=0.8->thinc<6.11.0,>=6.10.1->spacy)
Using cached toolz-0.9.0.tar.gz
Requirement already satisfied: webencodings in c:\users\jr00432239\appdata\local
\programs\python\python36-32\lib\site-packages (from html5lib->ftfy<5.0.0,>=4.4.
2->spacy)
Installing collected packages: murmurhash, cymem, preshed, wrapt, tqdm, toolz, c
ytoolz, plac, pyreadline, dill, termcolor, pathlib, msgpack-python, msgpack-nump
y, thinc, ujson, regex, spacy
Running setup.py install for murmurhash ... error
Complete output from command c:\users\jr00432239\appdata\local\programs\pyth
on\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users
\JR0043~1\AppData\Local\Temp\pip-build-0g2f9nzp\murmurhash\setup.py';f=ge
tattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.cl
ose();exec(compile(code, __file__, 'exec'))" install --record C:\Users\JR0043~1\
AppData\Local\Temppip-2or65wc6-record\install-record.txt --single-version-exter
nally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
creating build\lib.win32-3.6\murmurhash
copying murmurhash\about.py -> build\lib.win32-3.6\murmurhash
copying murmurhash__init__.py -> build\lib.win32-3.6\murmurhash
creating build\lib.win32-3.6\murmurhash\tests
copying murmurhash\tests\test_import.py -> build\lib.win32-3.6\murmurhash\te
sts
copying murmurhash\tests__init__.py -> build\lib.win32-3.6\murmurhash\tests
copying murmurhash\mrmr.pyx -> build\lib.win32-3.6\murmurhash
copying murmurhash\mrmr.pxd -> build\lib.win32-3.6\murmurhash
copying murmurhash\__init__.pxd -> build\lib.win32-3.6\murmurhash
creating build\lib.win32-3.6\murmurhash\include
creating build\lib.win32-3.6\murmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash2.h -> build\lib.win32-3.6\m
urmurhash\include\murmurhash
copying murmurhash\include\murmurhash\MurmurHash3.h -> build\lib.win32-3.6\m
urmurhash\include\murmurhash
running build_ext
building 'murmurhash.mrmr' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
creating build\temp.win32-3.6\Release\murmurhash
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\jr00432239\appdata\loc
al\programs\python\python36-32\include -IC:\Users\JR0043~1\AppData\Local\Temp\pi
p-build-0g2f9nzp\murmurhash\murmurhash\include -Ic:\users\jr00432239\appdata\loc
al\programs\python\python36-32\include -Ic:\users\jr00432239\appdata\local\progr
ams\python\python36-32\include /EHsc /Tpmurmurhash/mrmr.cpp /Fobuild\temp.win32-
3.6\Release\murmurhash/mrmr.obj /Ox /EHsc
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
Command "c:\users\jr00432239\appdata\local\programs\python\python36-32\python.ex
e -u -c "import setuptools, tokenize;__file__='C:\Users\JR0043~1\AppData\Loc
al\Temp\pip-build-0g2f9nzp\murmurhash\setup.py';f=getattr(tokenize, 'open',
open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,
__file__, 'exec'))" install --record C:\Users\JR0043~1\AppData\Local\Temppip-2
or65wc6-record\install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in C:\Users\JR0043~1\AppData\Local\Temppip-build-0g2f
9nzp\murmurhash\
Can anyone guide me to resolve this issue. My python version is 3 and windows7.
I get this too :(
I face the same problem that it tells me there is no module named 'ujson' when I 'import spacy'
in another new virtual environment, I make sure I pip spacy, it tells me there is no module named "spacy".. any one could helps ? thx!
@RadhaMadhaviBhatta @alexdotterweich @PeterXiaoGuo
Try doing it this way:
conda info --envs
conda create --name spacy
conda activate spacy
conda install -c conda-forge spacy
python
import spacy
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I'm having a similar problem while installing spacy.
As I'm working with python3 in pycharm, I tried:
python3 -m spacy.en.download --force allSpacy seems to be installed on the system:
$ pip list | grep spacyspacy (1.9.0)But when I run my code, I get following error:
ImportError: No module named 'spacy'I already tried running the installation from the anaconda folder, using:
conda install -c conda-forge spacy=1.9.0But it doesn't seem to work..
Can anyone help me to resolve this issue?