Cannot Install Spacy on Windows 10 for Python 3.8

See original GitHub issue

So… I have installed a Python 3.8.2 and put in “pip install -U spacy” to CMD; and then, things go wrong, and repeated attempts still didn’t render any success.

My Environment

  • Operating System: Windows 10
  • Python Version Used: Python 3.8.2 + Pip 20.1
  • spaCy Version Used: Newest(2.2.4)
  • Environment Information:

I have tried items recommended in the Troubleshooting section that I can match, but to no success; the spacy library is not installed. Below is the error messages:

C:\Users\34346>pip install -U spacy
Collecting spacy
  Using cached spacy-2.2.4.tar.gz (6.1 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'd:\python\py 3.8.2\python.exe' 'd:\python\py 3.8.2\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\34346\AppData\Local\Temp\pip-build-env-c3vxqm3v\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'cython>=0.25' 'cymem>=2.0.2,<2.1.0' 'preshed>=3.0.2,<3.1.0' 'murmurhash>=0.28.0,<1.1.0' thinc==7.4.0
       cwd: None
  Complete output (117 lines):
  Collecting setuptools
    Using cached setuptools-46.1.3-py3-none-any.whl (582 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting cython>=0.25
    Using cached Cython-0.29.17-cp38-cp38-win32.whl (1.6 MB)
  Collecting cymem<2.1.0,>=2.0.2
    Using cached cymem-2.0.3.tar.gz (51 kB)
  Collecting preshed<3.1.0,>=3.0.2
    Using cached preshed-3.0.2.tar.gz (167 kB)
  Collecting murmurhash<1.1.0,>=0.28.0
    Using cached murmurhash-1.0.2.tar.gz (35 kB)
  Collecting thinc==7.4.0
    Using cached thinc-7.4.0.tar.gz (1.3 MB)
      ERROR: Command errored out with exit status 1:
       command: 'd:\python\py 3.8.2\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\34346\\AppData\\Local\\Temp\\pip-install-jbucxtcb\\thinc\\setup.py'"'"'; __file__='"'"'C:\\Users\\34346\\AppData\\Local\\Temp\\pip-install-jbucxtcb\\thinc\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\34346\AppData\Local\Temp\pip-pip-egg-info-j01sl7za'
           cwd: C:\Users\34346\AppData\Local\Temp\pip-install-jbucxtcb\thinc\
      Complete output (97 lines):
      Processing numpy/random\_bounded_integers.pxd.in
      Processing numpy/random\mtrand.pyx
      Traceback (most recent call last):
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 61, in process_pyx
          from Cython.Compiler.Version import version as cython_version
      ModuleNotFoundError: No module named 'Cython'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 238, in <module>
          main()
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 234, in main
          find_process_files(root_dir)
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 225, in find_process_files
          process(root_dir, fromfile, tofile, function, hash_db)
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 191, in process
          processor_function(fromfile, tofile)
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\tools\cythonize.py", line 66, in process_pyx
          raise OSError('Cython needs to be installed in Python as a module')
      OSError: Cython needs to be installed in Python as a module
      Running from numpy source directory.
      C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
        run_build = parse_setuppy_commands()
      Traceback (most recent call last):
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
          yield saved
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
          yield
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
          _execfile(setup_script, ns)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
          exec(code, globals, locals)
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 488, in <module>
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 469, in setup_package
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 275, in generate_cython
      RuntimeError: Running cythonize failed!

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "C:\Users\34346\AppData\Local\Temp\pip-install-jbucxtcb\thinc\setup.py", line 264, in <module>
          setup_package()
        File "C:\Users\34346\AppData\Local\Temp\pip-install-jbucxtcb\thinc\setup.py", line 201, in setup_package
          setup(
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\__init__.py", line 144, in setup
          _install_setup_requires(attrs)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "d:\python\py 3.8.2\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
          dist = best[req.key] = env.best_match(
        File "d:\python\py 3.8.2\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
          return self.obtain(req, installer)
        File "d:\python\py 3.8.2\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
          return installer(requirement)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
          return cmd.easy_install(req)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
          return self.install_item(spec, dist.location, tmpdir, deps)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
          dists = self.install_eggs(spec, download, tmpdir)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
          return self.build_and_install(setup_script, setup_base)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
          self.run_setup(setup_script, setup_base, args)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
          run_setup(setup_script, args)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
          raise
        File "d:\python\py 3.8.2\lib\contextlib.py", line 131, in __exit__
          self.gen.throw(type, value, traceback)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
          yield
        File "d:\python\py 3.8.2\lib\contextlib.py", line 131, in __exit__
          self.gen.throw(type, value, traceback)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
          saved_exc.resume()
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 141, in resume
          six.reraise(type, exc, self._tb)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
          raise value.with_traceback(tb)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
          yield saved
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
          yield
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
          _execfile(setup_script, ns)
        File "d:\python\py 3.8.2\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
          exec(code, globals, locals)
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 488, in <module>
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 469, in setup_package
        File "C:\Users\34346\AppData\Local\Temp\easy_install-2nm1trc4\numpy-1.18.4\setup.py", line 275, in generate_cython
      RuntimeError: Running cythonize failed!
      Cythonizing sources
      ----------------------------------------
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\python\py 3.8.2\python.exe' 'd:\python\py 3.8.2\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\34346\AppData\Local\Temp\pip-build-env-c3vxqm3v\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'cython>=0.25' 'cymem>=2.0.2,<2.1.0' 'preshed>=3.0.2,<3.1.0' 'murmurhash>=0.28.0,<1.1.0' thinc==7.4.0 Check the logs for full command output.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
svlandegcommented, May 11, 2020

I think it would good to go through the documentation of virtual environments that I linked earlier, to understand what they are about and how they work. It is useful to install any Python software - not just spaCy. The commands are slightly different on Windows and Linux.

On my Windows, the commands look something like this:

python -m venv myvenv
.\myvenv\Scripts\activate
pip install spacy --no-cache-dir
3reactions
gowrijpcommented, Jul 14, 2020

I found a working method to install spacy in anaconda (using anaconda prompt) create a virtual env in anaconda Then run the command conda install -c conda-forge spacy

I am using Python 3.8 and windown 32 bit machine

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Cannot install module spaCy - Stack Overflow
Go to that directory. C:\Users\User_Name\AppData\Local\pip\cache · Delete cache file · Then upgrading the pip. python -m pip install --upgrade pip.
Read more >
Install spaCy · spaCy Usage Documentation
This error means that the spaCy module can't be located on your system, or in your environment. Make sure you have spaCy installed....
Read more >
Installing spaCy | Mastering spaCy - Packt Subscription
Let's get started by installing and setting up spaCy. spaCy is compatible with 64-bit Python 2.7 and 3.5+, and can run on Unix/Linux,...
Read more >
Problem with installing the spaCy module: Need help
I was trying to install the spacy module with Thonny 3.2.7 in Windows 10 Home 64-bit, and I've been getting an error message....
Read more >
spacy - PyPI
⏳ Install spaCy · Operating system: macOS / OS X · Linux · Windows (Cygwin, MinGW, Visual Studio) · Python version: Python 3.6+...
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