简体   繁体   中英

Error in installing spacy in anaconda in windows

Not able to install spacy, tensorflow, librosa in anaconda, every time it says permission denied.

I have tried installing it from anaconda prompt and also from the jupyter notebook using pip, but has not worked.

conda install -c conda-forge spacy

Error message :

conda install -c conda-forge spacy
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.10
  latest version: 4.6.14

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - spacy


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    mkl-2018.0.3               |                1       178.1 MB
    numpy-1.15.4               |   py36ha559c80_0          36 KB
    thinc-7.0.4                |   py36he980bc4_0         1.4 MB  conda-forge
    mkl_random-1.0.2           |           py36_0         267 KB  conda-forge
    wasabi-0.2.2               |             py_0          18 KB  conda-forge
    numpy-base-1.15.4          |   py36h8128ebf_0         3.9 MB
    plac-0.9.6                 |             py_1          18 KB  conda-forge
    tqdm-4.32.1                |             py_0          41 KB  conda-forge
    cython-blis-0.2.4          |   py36hfa6e2cd_0         2.6 MB  conda-forge
    srsly-0.0.7                |   py36h6538335_0         185 KB  conda-forge
    spacy-2.1.4                |   py36he980bc4_0        89.0 MB  conda-forge
    cymem-2.0.2                |   py36h74a9793_0          35 KB
    ca-certificates-2019.6.16  |       hecc5488_0         183 KB  conda-forge
    preshed-2.0.1              |   py36h33f27b4_0          70 KB
    mkl_fft-1.0.10             |           py36_0         130 KB  conda-forge
    murmurhash-1.0.0           |   py36h6538335_0          17 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       275.8 MB

The following NEW packages will be INSTALLED:

    blas:            1.0-mkl
    cymem:           2.0.2-py36h74a9793_0
    cython-blis:     0.2.4-py36hfa6e2cd_0  conda-forge
    mkl_fft:         1.0.10-py36_0         conda-forge
    mkl_random:      1.0.2-py36_0          conda-forge
    murmurhash:      1.0.0-py36h6538335_0  conda-forge
    numpy-base:      1.15.4-py36h8128ebf_0
    plac:            0.9.6-py_1            conda-forge
    preshed:         2.0.1-py36h33f27b4_0
    spacy:           2.1.4-py36he980bc4_0  conda-forge
    srsly:           0.0.7-py36h6538335_0  conda-forge
    thinc:           7.0.4-py36he980bc4_0  conda-forge
    tqdm:            4.32.1-py_0           conda-forge
    wasabi:          0.2.2-py_0            conda-forge

The following packages will be UPDATED:

    ca-certificates: 2017.08.26-h94faf87_0             --> 2019.6.16-hecc5488_0
  conda-forge
    certifi:         2018.1.18-py36_0                  --> 2019.3.9-py36_0
  conda-forge
    mkl:             2018.0.1-h2108138_4               --> 2018.0.3-1

    numpy:           1.14.0-py36h4a99626_1             --> 1.15.4-py36ha559c80_0

    openssl:         1.0.2n-h74b6da3_0                 --> 1.0.2r-hfa6e2cd_0
  conda-forge
    vc:              14-h0510ff6_3                     --> 14.1-h0510ff6_4

    vs2015_runtime:  14.0.25123-3                      --> 14.15.26706-h3a45250_
4

Proceed ([y]/n)? y


Downloading and Extracting Packages
mkl 2018.0.3: ######################################################### | 100%
numpy 1.15.4: ######################################################### | 100%
thinc 7.0.4: ########################################################## | 100%
mkl_random 1.0.2: ##################################################### | 100%
wasabi 0.2.2: ######################################################### | 100%
numpy-base 1.15.4: #################################################### | 100%
plac 0.9.6: ########################################################### | 100%
tqdm 4.32.1: ########################################################## | 100%
cython-blis 0.2.4: #################################################### | 100%
srsly 0.0.7: ########################################################## | 100%
spacy 2.1.4: ########################################################## | 100%
cymem 2.0.2: ########################################################## | 100%
ca-certificates 2019.6.16: ############################################ | 100%
preshed 2.0.1: ######################################################## | 100%
mkl_fft 1.0.10: ####################################################### | 100%
murmurhash 1.0.0: ##################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(481): An error occurred while uninstalling packag
e 'defaults::numpy-1.14.0-py36h4a99626_1'.
PermissionError(13, 'Access is denied')
Attempting to roll back.

Rolling back transaction: done

PermissionError(13, 'Access is denied')

While installing from jupyter I get the following error :

!pip install spacy

Collecting spacy
  Downloading https://files.pythonhosted.org/packages/83/26/b829c281ea584cd1d3889e40b57527782b748cbd91e753796506210f8bb4/spacy-2.1.4-cp36-cp36m-win_amd64.whl (29.0MB)
Collecting murmurhash<1.1.0,>=0.28.0 (from spacy)
  Downloading https://files.pythonhosted.org/packages/15/8f/0dad3ca706e31258cf7b9adf40f8d2103444a09dd7d66d46cf6980025c65/murmurhash-1.0.2-cp36-cp36m-win_amd64.whl
Collecting blis<0.3.0,>=0.2.2 (from spacy)
  Downloading https://files.pythonhosted.org/packages/84/0e/35f8ce00fc3412aa3a888a3d8e040c4c65ccbad8310aa2981d3e6f379867/blis-0.2.4-cp36-cp36m-win_amd64.whl (3.1MB)
Collecting preshed<2.1.0,>=2.0.1 (from spacy)
  Downloading https://files.pythonhosted.org/packages/a6/c0/3c238c146ed72f92a1cc3771fa3f66091b80d2a8e15b7c987912443b7843/preshed-2.0.1-cp36-cp36m-win_amd64.whl (73kB)
Requirement already satisfied: jsonschema<3.1.0,>=2.6.0 in c:\programdata\anaconda3\lib\site-packages (from spacy)
Collecting srsly<1.1.0,>=0.0.5 (from spacy)
  Downloading https://files.pythonhosted.org/packages/8c/b5/75b8284a3ec9d6cc98a3fef0a581bf0b3493adabb1d33751fc1aa969f4e3/srsly-0.0.7-cp36-cp36m-win_amd64.whl (171kB)
Collecting wasabi<1.1.0,>=0.2.0 (from spacy)
  Downloading https://files.pythonhosted.org/packages/f4/c1/d76ccdd12c716be79162d934fe7de4ac8a318b9302864716dde940641a79/wasabi-0.2.2-py3-none-any.whl
Collecting plac<1.0.0,>=0.9.6 (from spacy)
  Downloading https://files.pythonhosted.org/packages/9e/9b/62c60d2f5bc135d2aa1d8c8a86aaf84edb719a59c7f11a4316259e61a298/plac-0.9.6-py2.py3-none-any.whl
Collecting numpy>=1.15.0 (from spacy)
  Using cached https://files.pythonhosted.org/packages/20/ed/e036d31a9b2c750f270cbb1cfc1c0f94ac78ae504eea7eec3267be4e294a/numpy-1.16.4-cp36-cp36m-win_amd64.whl
Requirement already satisfied: requests<3.0.0,>=2.13.0 in c:\programdata\anaconda3\lib\site-packages (from spacy)
Collecting thinc<7.1.0,>=7.0.2 (from spacy)
  Downloading https://files.pythonhosted.org/packages/12/b0/2c6c0f0edd87a3a4ac039bec792a61603233901a6df53e976d746eb86d04/thinc-7.0.4-cp36-cp36m-win_amd64.whl (1.9MB)
Collecting cymem<2.1.0,>=2.0.2 (from spacy)
  Downloading https://files.pythonhosted.org/packages/c2/93/4b543adf6c0d73ed4e05d92abfb644c2743cd656adc8058510fdfac80680/cymem-2.0.2-cp36-cp36m-win_amd64.whl
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy)
Requirement already satisfied: idna<2.7,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy)
Collecting tqdm<5.0.0,>=4.10.0 (from thinc<7.1.0,>=7.0.2->spacy)
  Downloading https://files.pythonhosted.org/packages/9f/3d/7a6b68b631d2ab54975f3a4863f3c4e9b26445353264ef01f465dc9b0208/tqdm-4.32.2-py2.py3-none-any.whl (50kB)
Installing collected packages: murmurhash, numpy, blis, cymem, preshed, srsly, wasabi, plac, tqdm, thinc, spacy
  Found existing installation: numpy 1.14.0
    Uninstalling numpy-1.14.0:
Exception:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\numpy' -> 'C:\\Users\\SHREYA~1.TRI\\AppData\\Local\\Temp\\pip-inr_379k-uninstall\\programdata\\anaconda3\\lib\\site-packages\\numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\ProgramData\Anaconda3\lib\shutil.py", line 556, in move
    rmtree(src)
  File "C:\ProgramData\Anaconda3\lib\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\ProgramData\Anaconda3\lib\shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\ProgramData\Anaconda3\lib\shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\numpy\\add_newdocs.py'
You are using pip version 9.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Tried this too after a suggestion but doesn't work !

(base) C:\Users\companyadmin>conda update -n base conda
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.6.14               |           py36_0         2.1 MB

The following packages will be UPDATED:

    conda: 4.4.10-py36_0 --> 4.6.14-py36_0

Proceed ([y]/n)? y


Downloading and Extracting Packages
conda 4.6.14: ######################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(481): An error occurred while uninstalling packag
e 'defaults::conda-4.4.10-py36_0'.
PermissionError(13, 'Access is denied')
Attempting to roll back.

Rolling back transaction: done

PermissionError(13, 'Access is denied')

我认为卸载 numpy 或更新所有包conda update --all也包括 numpy 可以解决这个问题。

If all the other solutions didn't worked out, just uninstall Anaconda and install it again. This resolved my problem on mac. Of course you'll lose all the installed environments and some packages under Anaconda, so you may probably need to install the required ones later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM