Created a new env with conda
conda create -n spacy python=3.5 ipython
and then install spacy (1.6.0) with pip (conda still has version 0.101.0)
pip install spacy
But I still get this error.
In [1]: import spacy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c080f6458562> in <module>()
----> 1 import spacy
/home/alexis/anaconda3/envs/spacy/lib/python3.5/site-packages/spacy/__init__.py in <module>()
4 from .about import __version__
5
----> 6 from . import en
7 from . import de
8 from . import zh
/home/alexis/anaconda3/envs/spacy/lib/python3.5/site-packages/spacy/en/__init__.py in <module>()
6 from ..util import match_best_version
7 from ..util import get_data_path
----> 8 from ..language import Language
9 from ..lemmatizer import Lemmatizer
10 from ..vocab import Vocab
/home/alexis/anaconda3/envs/spacy/lib/python3.5/site-packages/spacy/language.py in <module>()
15
16
---> 17 from .tokenizer import Tokenizer
18 from .vocab import Vocab
19 from .tagger import Tagger
ImportError: /home/alexis/anaconda3/envs/spacy/lib/python3.5/site-packages/spacy/tokenizer.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZTINSt8ios_base7failureB5cxx11E
There is a similar issue here https://github.com/explosion/sense2vec/issues/19 but that solution did not help.
Note, I don't have that problem on MacOS Sierra.
% conda list
# packages in environment at /home/alexis/anaconda3/envs/spacy:
#
cloog 0.18.0 0
cloudpickle 0.2.2 <pip>
cymem 1.31.2 <pip>
cytoolz 0.8.2 <pip>
decorator 4.0.11 py35_0
flexmock 0.10.2 <pip>
gmp 6.1.0 0
ipython 5.2.2 py35_0
ipython_genutils 0.1.0 py35_0
isl 0.15 0
libgcc 5.2.0 0
mpc 1.0.3 0
mpfr 3.1.5 0
murmurhash 0.26.4 <pip>
numpy 1.12.0 <pip>
openssl 1.0.2k 0
path.py 10.1 py35_0
pathlib 1.0.1 <pip>
pexpect 4.2.1 py35_0
pickleshare 0.7.4 py35_0
pip 9.0.1 py35_1
plac 0.9.6 <pip>
preshed 0.46.4 <pip>
prompt_toolkit 1.0.9 py35_0
ptyprocess 0.5.1 py35_0
pygments 2.1.3 py35_0
python 3.5.2 0
readline 6.2 2
semver 2.7.5 <pip>
setuptools 27.2.0 py35_0
simplegeneric 0.8.1 py35_1
six 1.10.0 py35_0
spacy 1.6.0 <pip>
sputnik 0.9.3 <pip>
sqlite 3.13.0 0
thinc 6.2.0 <pip>
tk 8.5.18 0
toolz 0.8.2 <pip>
tqdm 4.11.2 <pip>
traitlets 4.3.1 py35_0
ujson 1.35 <pip>
wcwidth 0.1.7 py35_0
wheel 0.29.0 py35_0
xz 5.2.2 1
zlib 1.2.8 3
Most of the time this sort of error comes down to the PATH ordering leading to an unexpected copy of pip being executed. Could you do:
pip --version
And
python -m pip --version
To check that when you do pip install spacy, the copy of pip that's being run is what you expect?
If problems persist, the more manual process --- that therefore gives you more control --- is to clone the repository and compile the code using python setup.py build_ext --inplace. You can then do python setup.py sdist to create the distribution file, which you can intall using pip. This gives you end-to-end control of the build, so if something goes wrong you can see what's going on.
pip --version did output the one from my conda env.
Just in case I created a new one with everything
conda create -n spacy python=3.5 anaconda
I then proceeded to follow your steps and as far as I can tell it seemed to be alright. Building took a long time and there were a lot of outputs. Cannot really print it here. Unfortunately in the end I still get the same error.
Here is the full list of packages that were installed
卤% conda list
# packages in environment at /home/alexis/anaconda3/envs/spacy:
#
_license 1.1 py35_1
alabaster 0.7.9 py35_0
anaconda 4.3.0 np111py35_0
anaconda-client 1.6.0 py35_0
anaconda-navigator 1.4.3 py35_0
argcomplete 1.0.0 py35_1
astroid 1.4.9 py35_0
astropy 1.3 np111py35_0
babel 2.3.4 py35_0
backports 1.0 py35_0
beautifulsoup4 4.5.3 py35_0
bitarray 0.8.1 py35_0
blaze 0.10.1 py35_0
bokeh 0.12.4 py35_0
boto 2.45.0 py35_0
bottleneck 1.2.0 np111py35_0
cairo 1.14.8 0
cffi 1.9.1 py35_0
chardet 2.3.0 py35_0
chest 0.2.3 py35_0
click 6.7 py35_0
cloudpickle 0.2.2 py35_0
clyent 1.2.2 py35_0
colorama 0.3.7 py35_0
configobj 5.0.6 py35_0
contextlib2 0.5.4 py35_0
cryptography 1.7.1 py35_0
curl 7.52.1 0
cycler 0.10.0 py35_0
cymem 1.31.2 <pip>
cython 0.25.2 py35_0
cytoolz 0.8.2 py35_0
dask 0.13.0 py35_0
datashape 0.5.4 py35_0
dbus 1.10.10 0
decorator 4.0.11 py35_0
dill 0.2.5 py35_0
docutils 0.13.1 py35_0
entrypoints 0.2.2 py35_0
et_xmlfile 1.0.1 py35_0
expat 2.1.0 0
fastcache 1.0.2 py35_1
flask 0.12 py35_0
flask-cors 3.0.2 py35_0
flexmock 0.10.2 <pip>
fontconfig 2.12.1 2
freetype 2.5.5 2
get_terminal_size 1.0.0 py35_0
gevent 1.2.1 py35_0
glib 2.50.2 1
greenlet 0.4.11 py35_0
gst-plugins-base 1.8.0 0
gstreamer 1.8.0 0
h5py 2.6.0 np111py35_2
harfbuzz 0.9.39 2
hdf5 1.8.17 1
heapdict 1.0.0 py35_1
icu 54.1 0
idna 2.2 py35_0
imagesize 0.7.1 py35_0
ipykernel 4.5.2 py35_0
ipython 5.1.0 py35_0
ipython_genutils 0.1.0 py35_0
ipywidgets 5.2.2 py35_1
isort 4.2.5 py35_0
itsdangerous 0.24 py35_0
jbig 2.1 0
jdcal 1.3 py35_0
jedi 0.9.0 py35_1
jinja2 2.9.4 py35_0
jpeg 9b 0
jsonschema 2.5.1 py35_0
jupyter 1.0.0 py35_3
jupyter_client 4.4.0 py35_0
jupyter_console 5.0.0 py35_0
jupyter_core 4.2.1 py35_0
lazy-object-proxy 1.2.2 py35_0
libffi 3.2.1 1
libgcc 4.8.5 2
libgfortran 3.0.0 1
libiconv 1.14 0
libpng 1.6.27 0
libsodium 1.0.10 0
libtiff 4.0.6 3
libxcb 1.12 1
libxml2 2.9.4 0
libxslt 1.1.29 0
llvmlite 0.15.0 py35_0
locket 0.2.0 py35_1
lxml 3.7.2 py35_0
markupsafe 0.23 py35_2
matplotlib 2.0.0 np111py35_0
mistune 0.7.3 py35_0
mkl 2017.0.1 0
mkl-service 1.1.2 py35_3
mpmath 0.19 py35_1
multipledispatch 0.4.9 py35_0
murmurhash 0.26.4 <pip>
nbconvert 4.2.0 py35_0
nbformat 4.2.0 py35_0
networkx 1.11 py35_0
nltk 3.2.2 py35_0
nose 1.3.7 py35_1
notebook 4.3.1 py35_0
numba 0.30.1 np111py35_0
numexpr 2.6.1 np111py35_2
numpy 1.11.3 py35_0
numpydoc 0.6.0 py35_0
odo 0.5.0 py35_1
openpyxl 2.4.1 py35_0
openssl 1.0.2k 0
pandas 0.19.2 np111py35_1
partd 0.3.7 py35_0
path.py 10.0 py35_0
pathlib 1.0.1 <pip>
pathlib2 2.2.0 py35_0
patsy 0.4.1 py35_0
pcre 8.39 1
pep8 1.7.0 py35_0
pexpect 4.2.1 py35_0
pickleshare 0.7.4 py35_0
pillow 4.0.0 py35_0
pip 9.0.1 py35_1
pixman 0.34.0 0
plac 0.9.2 <pip>
ply 3.9 py35_0
preshed 0.46.4 <pip>
prompt_toolkit 1.0.9 py35_0
psutil 5.0.1 py35_0
ptyprocess 0.5.1 py35_0
py 1.4.32 py35_0
pyasn1 0.1.9 py35_0
pycosat 0.6.1 py35_1
pycparser 2.17 py35_0
pycrypto 2.6.1 py35_4
pycurl 7.43.0 py35_2
pyflakes 1.5.0 py35_0
pygments 2.1.3 py35_0
pylint 1.6.4 py35_1
pyopenssl 16.2.0 py35_0
pyparsing 2.1.4 py35_0
pyqt 5.6.0 py35_2
pytables 3.3.0 np111py35_0
pytest 3.0.5 py35_0
python 3.5.2 0
python-dateutil 2.6.0 py35_0
pytz 2016.10 py35_0
pyyaml 3.12 py35_0
pyzmq 16.0.2 py35_0
qt 5.6.2 3
qtawesome 0.4.3 py35_0
qtconsole 4.2.1 py35_1
qtpy 1.2.1 py35_0
readline 6.2 2
redis 3.2.0 0
redis-py 2.10.5 py35_0
requests 2.12.4 py35_0
rope 0.9.4 py35_1
scikit-image 0.12.3 np111py35_1
scikit-learn 0.18.1 np111py35_1
scipy 0.18.1 np111py35_1
seaborn 0.7.1 py35_0
semver 2.7.5 <pip>
setuptools 27.2.0 py35_0
simplegeneric 0.8.1 py35_1
singledispatch 3.4.0.3 py35_0
sip 4.18 py35_0
six 1.10.0 py35_0
snowballstemmer 1.2.1 py35_0
sockjs-tornado 1.0.3 py35_0
spacy 1.6.0 <pip>
sphinx 1.5.1 py35_0
sputnik 0.9.3 <pip>
spyder 3.1.2 py35_0
sqlalchemy 1.1.5 py35_0
sqlite 3.13.0 0
statsmodels 0.6.1 np111py35_1
sympy 1.0 py35_0
terminado 0.6 py35_0
thinc 6.2.0 <pip>
tk 8.5.18 0
toolz 0.8.2 py35_0
tornado 4.4.2 py35_0
tqdm 4.11.2 <pip>
traitlets 4.3.1 py35_0
ujson 1.35 <pip>
unicodecsv 0.14.1 py35_0
wcwidth 0.1.7 py35_0
werkzeug 0.11.15 py35_0
wheel 0.29.0 py35_0
widgetsnbextension 1.2.6 py35_0
wrapt 1.10.8 py35_0
xlrd 1.0.0 py35_0
xlsxwriter 0.9.6 py35_0
xlwt 1.2.0 py35_0
xz 5.2.2 1
yaml 0.1.6 0
zeromq 4.1.5 0
zlib 1.2.8 3
The conda-forge channel now has spaCy packages up to the latest release. You can install them via: conda install -c conda-forge spacy
I'm facing the same problem on MacOS Sierra with a new Miniconda installation.
My error message is a tad different though and might be more helpful:
from .tokenizer import Tokenizer
File ".env/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd", line 155, in init spacy.tokenizer (spacy/tokenizer.cpp:12130)
File "/Users/holger/miniconda3/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
Ending in:
AttributeError: module 'threading' has no attribute 'RLock'
I have positively no clue where the
.env/local/lib/python2.7/site-packages/Cython/Includes/numpy/
import path come from. No Python 2.7 installed and no .env directory there either.
Thanks @rolando installing with conda-forge solves the problem. Still don't know what's happening exactly. conda-forge installs these
(spacy) glitch@gpu-instance:~$ conda install spacy -c conda-forge
Fetching package metadata ...........
Solving package specifications: .
Package plan for installation in environment /home/glitch/anaconda3/envs/spacy:
The following NEW packages will be INSTALLED:
cymem: 1.31.2-py35_0 conda-forge
murmurhash: 0.26.4-py35_0 conda-forge
plac: 0.9.6-py35_0
preshed: 0.46.4-py35_0 conda-forge
semver: 2.7.5-py35_0 conda-forge
spacy: 1.6.0-np111py35_0 conda-forge
sputnik: 0.9.3-py35_0 conda-forge
thinc: 6.2.0-np111py35_0 conda-forge
tqdm: 4.11.2-py35_0 conda-forge
ujson: 1.35-py35_0
and pip installs
(spacy) glitch@gpu-instance:~$ pip install spacy
Collecting spacy
Collecting preshed<0.47.0,>=0.46.0 (from spacy)
Requirement already satisfied: six in ./anaconda3/envs/spacy/lib/python3.6/site-packages (from spacy)
Requirement already satisfied: cloudpickle in ./anaconda3/envs/spacy/lib/python3.6/site-packages (from spacy)
Collecting plac (from spacy)
Using cached plac-0.9.6-py2.py3-none-any.whl
Collecting cymem<1.32,>=1.30 (from spacy)
Collecting thinc<6.3.0,>=6.2.0 (from spacy)
Collecting ujson>=1.35 (from spacy)
Collecting sputnik<0.10.0,>=0.9.2 (from spacy)
Using cached sputnik-0.9.3-py2.py3-none-any.whl
Collecting murmurhash<0.27,>=0.26 (from spacy)
Requirement already satisfied: numpy>=1.7 in ./anaconda3/envs/spacy/lib/python3.6/site-packages (from spacy)
Collecting pathlib (from spacy)
Requirement already satisfied: cytoolz<0.9,>=0.8 in ./anaconda3/envs/spacy/lib/python3.6/site-packages (from thinc<6.3.0,>=6.2.0->spacy)
Collecting tqdm<5.0.0,>=4.10.0 (from thinc<6.3.0,>=6.2.0->spacy)
Using cached tqdm-4.11.2-py2.py3-none-any.whl
Collecting flexmock (from thinc<6.3.0,>=6.2.0->spacy)
Collecting semver (from sputnik<0.10.0,>=0.9.2->spacy)
Installing collected packages: cymem, preshed, plac, tqdm, murmurhash, flexmock, thinc, ujson, semver, sputnik, pathlib, spacy
Successfully installed cymem-1.31.2 flexmock-0.10.2 murmurhash-0.26.4 pathlib-1.0.1 plac-0.9.6 preshed-0.46.4 semver-2.7.6 spacy-1.6.0 sputnik-0.9.3 thinc-6.2.0 tqdm-4.11.2 ujson-1.35
It's a spot the difference game. In both cases I removed the spacy env and recreated it with
conda create -n spacy python=3.5 anaconda
Hope this helps.
P.S.: In case you're wondering, I created a new account on the server just in case. That's why the user was alexis and now it's glitch
Thanks for updating :tada:
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
The
conda-forgechannel now has spaCy packages up to the latest release. You can install them via:conda install -c conda-forge spacy