Why can't I install new version of Pytorch? - pytorch

My OS is CentOS 7, and I want to install PyTorch so I did the following:
(pt_gpu) [martin#A08-R32-I196-3-FZ2LTP2 mlm]$ conda -V
conda 4.6.2
(pt_gpu) [martin#A08-R32-I196-3-FZ2LTP2 mlm]$ conda install -c anaconda pytorch-gpu
What's strange is that the installation message shows that it is installing a very old version of PyTorch:
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: /home/martin/anaconda3/envs/pt_gpu
added / updated specs:
- pytorch-gpu
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2018.12.5 | 0 123 KB anaconda
certifi-2018.11.29 | py36_0 146 KB anaconda
pytorch-gpu-0.1.12 | py36_0 16.8 MB anaconda
------------------------------------------------------------
Total: 17.0 MB
The following packages will be UPDATED:
openssl pkgs/main::openssl-1.1.1a-h7b6447c_0 --> anaconda::openssl-1.1.1-h7b6447c_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main --> anaconda
certifi pkgs/main --> anaconda
mkl pkgs/main::mkl-2017.0.4-h4c4d0af_0 --> anaconda::mkl-2017.0.1-0
pytorch-gpu pkgs/free --> anaconda
Proceed ([y]/n)? y
Downloading and Extracting Packages
certifi-2018.11.29 | 146 KB | ########################################################################################################################## | 100%
ca-certificates-2018 | 123 KB | ########################################################################################################################## | 100%
pytorch-gpu-0.1.12 | 16.8 MB | ########################################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
To verify what's installed, I did:
(pt_gpu) [martin#A08-R32-I196-3-FZ2LTP2 mlm]$ python -c "import torch; print(torch.__version__)"
0.1.12
Why is it that?

According to their official website( https://pytorch.org ) , they install package named pytorch, not pytorch-gpu.
conda install pytorch torchvision -c pytorch

Related

can not import TensorFlow in Spyder or Python (ModuleNotFoundError: No module named 'tensorflow')

I have tried to install both CPU and GPU version of TensorFlow according to the manual from here https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/ and all was ok:
(tf-gpu) C:\Users\Kosh>conda create -n tf tensorflow Collecting
package metadata (current_repodata.json): done Solving environment:
done
==> WARNING: A newer version of conda exists. <== current version: 4.7.12 latest version: 4.8.3
Please update conda by running
$ conda update -n base -c defaults conda
Package Plan
environment location: C:\Anaconda3\envs\tf
added / updated specs:
- tensorflow
The following packages will be downloaded:
package | build
---------------------------|-----------------
_tflow_select-2.2.0 | eigen 3 KB
tensorflow-2.1.0 |eigen_py37hd727fc0_0 4 KB
tensorflow-base-2.1.0 |eigen_py37h49b2757_0 35.4 MB
------------------------------------------------------------
Total: 35.4 MB
The following NEW packages will be INSTALLED:
_tflow_select pkgs/main/win-64::_tflow_select-2.2.0-eigen
absl-py pkgs/main/win-64::absl-py-0.9.0-py37_0 asn1crypto
pkgs/main/win-64::asn1crypto-1.3.0-py37_0 astor
pkgs/main/win-64::astor-0.8.0-py37_0 blas
pkgs/main/win-64::blas-1.0-mkl blinker
pkgs/main/win-64::blinker-1.4-py37_0 ca-certificates
pkgs/main/win-64::ca-certificates-2020.1.1-0 cachetools
pkgs/main/noarch::cachetools-3.1.1-py_0 certifi
pkgs/main/win-64::certifi-2020.4.5.1-py37_0 cffi
pkgs/main/win-64::cffi-1.14.0-py37h7a1dbc1_0 chardet
pkgs/main/win-64::chardet-3.0.4-py37_1003 click
pkgs/main/noarch::click-7.1.1-py_0 cryptography
pkgs/main/win-64::cryptography-2.8-py37h7a1dbc1_0 gast
pkgs/main/win-64::gast-0.2.2-py37_0 google-auth
pkgs/main/noarch::google-auth-1.13.1-py_0 google-auth-oauth~
pkgs/main/noarch::google-auth-oauthlib-0.4.1-py_2 google-pasta
pkgs/main/noarch::google-pasta-0.2.0-py_0 grpcio
pkgs/main/win-64::grpcio-1.27.2-py37h351948d_0 h5py
pkgs/main/win-64::h5py-2.10.0-py37h5e291fa_0 hdf5
pkgs/main/win-64::hdf5-1.10.4-h7ebc959_0 icc_rt
pkgs/main/win-64::icc_rt-2019.0.0-h0cc432a_1 idna
pkgs/main/noarch::idna-2.9-py_1 intel-openmp
pkgs/main/win-64::intel-openmp-2020.0-166 keras-applications
pkgs/main/noarch::keras-applications-1.0.8-py_0 keras-preprocessi~
pkgs/main/noarch::keras-preprocessing-1.1.0-py_1 libprotobuf
pkgs/main/win-64::libprotobuf-3.11.4-h7bd577a_0 markdown
pkgs/main/win-64::markdown-3.1.1-py37_0 mkl
pkgs/main/win-64::mkl-2020.0-166 mkl-service
pkgs/main/win-64::mkl-service-2.3.0-py37hb782905_0 mkl_fft
pkgs/main/win-64::mkl_fft-1.0.15-py37h14836fe_0 mkl_random
pkgs/main/win-64::mkl_random-1.1.0-py37h675688f_0 numpy
pkgs/main/win-64::numpy-1.18.1-py37h93ca92e_0 numpy-base
pkgs/main/win-64::numpy-base-1.18.1-py37hc3f5095_1 oauthlib
pkgs/main/noarch::oauthlib-3.1.0-py_0 openssl
pkgs/main/win-64::openssl-1.1.1f-he774522_0 opt_einsum
pkgs/main/noarch::opt_einsum-3.1.0-py_0 pip
pkgs/main/win-64::pip-20.0.2-py37_1 protobuf
pkgs/main/win-64::protobuf-3.11.4-py37h33f27b4_0 pyasn1
pkgs/main/noarch::pyasn1-0.4.8-py_0 pyasn1-modules
pkgs/main/noarch::pyasn1-modules-0.2.7-py_0 pycparser
pkgs/main/noarch::pycparser-2.20-py_0 pyjwt
pkgs/main/win-64::pyjwt-1.7.1-py37_0 pyopenssl
pkgs/main/win-64::pyopenssl-19.1.0-py37_0 pyreadline
pkgs/main/win-64::pyreadline-2.1-py37_1 pysocks
pkgs/main/win-64::pysocks-1.7.1-py37_0 python
pkgs/main/win-64::python-3.7.7-h60c2a47_0_cpython requests
pkgs/main/win-64::requests-2.23.0-py37_0 requests-oauthlib
pkgs/main/noarch::requests-oauthlib-1.3.0-py_0 rsa
pkgs/main/noarch::rsa-4.0-py_0 scipy
pkgs/main/win-64::scipy-1.4.1-py37h9439919_0 setuptools
pkgs/main/win-64::setuptools-46.1.3-py37_0 six
pkgs/main/win-64::six-1.14.0-py37_0 sqlite
pkgs/main/win-64::sqlite-3.31.1-he774522_0 tensorboard
pkgs/main/noarch::tensorboard-2.1.0-py3_0 tensorflow
pkgs/main/win-64::tensorflow-2.1.0-eigen_py37hd727fc0_0
tensorflow-base
pkgs/main/win-64::tensorflow-base-2.1.0-eigen_py37h49b2757_0
tensorflow-estima~
pkgs/main/noarch::tensorflow-estimator-2.1.0-pyhd54b08b_0 termcolor
pkgs/main/win-64::termcolor-1.1.0-py37_1 urllib3
pkgs/main/win-64::urllib3-1.25.8-py37_0 vc
pkgs/main/win-64::vc-14.1-h0510ff6_4 vs2015_runtime
pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_1 werkzeug
pkgs/main/win-64::werkzeug-0.14.1-py37_0 wheel
pkgs/main/win-64::wheel-0.34.2-py37_0 win_inet_pton
pkgs/main/win-64::win_inet_pton-1.1.0-py37_0 wincertstore
pkgs/main/win-64::wincertstore-0.2-py37_0 wrapt
pkgs/main/win-64::wrapt-1.12.1-py37he774522_1 zlib
pkgs/main/win-64::zlib-1.2.11-h62dcd97_3
Proceed ([y]/n)? y
Downloading and Extracting Packages
_tflow_select-2.2.0 | 3 KB | ############################################################################ | 100% tensorflow-2.1.0 | 4 KB |
###################################################################### | 100% tensorflow-base-2.1. | 35.4 MB |
###################################################################### | 100% Preparing transaction: done Verifying transaction: done
Executing transaction: done
#
To activate this environment, use
#
$ conda activate tf
#
To deactivate an active environment, use
#
$ conda deactivate
(tf-gpu) C:\Users\Kosh> (tf-gpu) C:\Users\Kosh> (tf-gpu)
C:\Users\Kosh>conda activate tf-2 Could not find conda environment:
tf-2 You can list all discoverable environments with conda info
--envs.
(tf-gpu) C:\Users\Kosh>conda activate tf
but when I try to import it in Spyder or in Python I get the same result:
import tensorflow as tf
Traceback (most recent call last):
File "<ipython-input-1-64156d691fe5>", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
Can somebody help me with this?
I have the same problem using Python 3.7 and Tensorflow 2.1.
I created the environment tf-2 using conda create -n tf-2 tensorflow pandas.
There is no error using command prompt, but Spyder didn't find the Tensorflow library.
I verified that the IPython window was showing Python 3.6.9 (base version), while the command prompt was returning 3.7 to this command:
python -c "import platform; print(platform.python_version())"
The reason were:
the new environment didn't have Spyder installed;
conda install Tensorflow 1.13 by default.
Then, I removed the environment tf2 and recreated it including the Python version and Spyder:
conda create -n tf2 python=3.6 spyder
Then, I installed tensorflow by pip.
conda activate tf2
pip install tensorflow
It worked for me:
Run the anaconda prompt as administrator.(right click-> run as administrator).
pip uninstall tensorflow.
Close anaconda prompt.
Again run anaconda prompt as administrator.
type:
conda install tensorflow
It will ask for some y / n
Type y.
Now after all done, change your python interpreter's environment to anaconda environment where you installed tensorflow.
After that tensorflow imported successfully!

Understanding Conda, getting ResolvePackageNotFound error

I am new to conda. I read that it makes maintaining different versions of package easy. I cloned a git repo: https://github.com/datitran/face2face-demo using
git clone https://github.com/datitran/face2face-demo
instead of what is asked on the above git page, but sadly when I ran
conda env create -f environment.yml
It gave me following error:
Collecting package metadata (repodata.json): done
Solving environment: failed
ResolvePackageNotFound:
- mkl==2017.0.3=0
- jpeg==9b=0
- readline==6.2=2
- xz==5.2.2=1
- libpng==1.6.27=0
- tk==8.5.18=0
- numpy==1.13.0=py35_0
- bzip2==1.0.6=3
I ran these in Ubuntu as well as Mac, but got the same error at both the places.
So my question is (all related, basically I was hoping that conda will not give me these errors):
Why conda is not able to resolve these?
How to resolve them?
Whats the point of using conda if I bump into these issues even after installing it. What is there in 500Mb+ installer which I downloaded?
My second question is regarding conda shell on mac which I asked at: How to open conda shell in mac
Why conda is not able to resolve these?
Because the package versions you request are not available from the default channels (any more). As of conda version 4.7, the so called free channel was removed from the defaults, which now results in some older module versions not being found any more. You can tell by typing conda search <package name>:
conda search mkl
Loading channels: done
# Name Version Build Channel
mkl 2017.0.4 h4c4d0af_0 pkgs/main
mkl 2018.0.0 hb491cac_4 pkgs/main
mkl 2018.0.1 h19d6760_4 pkgs/main
mkl 2018.0.2 1 pkgs/main
mkl 2018.0.3 1 pkgs/main
mkl 2019.0 117 pkgs/main
mkl 2019.0 118 pkgs/main
mkl 2019.1 144 pkgs/main
mkl 2019.3 199 pkgs/main
mkl 2019.4 243 pkgs/main
As you can see, your requested version is not there. Easily fixed though by adding the -c free, i.e. manually adding the free channel again:
conda search -c free mkl
Loading channels: done
# Name Version Build Channel
mkl 11.3.1 0 free
mkl 11.3.3 0 free
mkl 2017.0.1 0 free
mkl 2017.0.3 0 free
mkl 2017.0.4 h4c4d0af_0 pkgs/main
mkl 2018.0.0 hb491cac_4 pkgs/main
mkl 2018.0.1 h19d6760_4 pkgs/main
mkl 2018.0.2 1 pkgs/main
mkl 2018.0.3 1 pkgs/main
mkl 2019.0 117 pkgs/main
mkl 2019.0 118 pkgs/main
mkl 2019.1 144 pkgs/main
mkl 2019.3 199 pkgs/main
mkl 2019.4 243 pkgs/main
You can add this switch to your environment creation by editing the environment.yml:
channels: !!python/tuple
- menpo
- defaults
- free
Whats the point of using conda if I bump into these issues even after installing it. What is there in 500Mb+ installer which I downloaded?
Don't confuse anaconda and conda, which are two different things. conda, the package and environment manager comes with anaconda and miniconda. anaconda comes also with many packages pre installed, whcih you can see if you type conda list. If you don't want to have all these pre-installed packages (since you only want to create your own environment anyway), you could replace anaconda with miniconda, which does not have any packages pre-insatlled (except of course for python, pip, conda and their dependencies)

Anaconda error and OSError: could not find or load spatialindex_c.dll

I am facing "OSError: could not find or load spatialindex_c.dll" error whenever importing any uninstalled module e.g. geopandas,earthpy in Jupyter notebook.
Moreover, when I install any module using anaconda i face several issues.
First of all, Upon openning and activating the base environment i find this warning.
C:\Users>activate base
The system cannot find the path specified.
C:\Users>set "GDAL_DRIVER_PATH="
(base) C:\Users>conda --version
conda 4.7.10
Secondly, while using conda to install a module e.g. numpy i face this kind of problem.
(geo) C:\Users\Jarin Tasnim>conda install -c anaconda numpy
Collecting package metadata (repodata.json): done
Solving environment: done
Package Plan
environment location: C:\Users\Jarin Tasnim\Anaconda3\envs\geo
added / updated specs:
- numpy
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.6.16 | py36_0 155 KB anaconda
numpy-1.15.4 | py36ha559c80_0 36 KB anaconda
------------------------------------------------------------
Total: 190 KB
The following packages will be UPDATED:
certifi pkgs/main::certifi-2018.10.15-py36_0 --> anaconda::certifi-2019.6.16-py36_0
The following packages will be SUPERSEDED by a higher-priority channel:
numpy pkgs/main --> anaconda
Proceed ([y]/n)? y
Downloading and Extracting Packages
certifi-2019.6.16 | 155 KB | | 0%
numpy-1.15.4 | 36 KB | | 0%
[WinError 193] %1 is not a valid Win32 application
[WinError 193] %1 is not a valid Win32 application
Should i install anaconda again?

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')
I think uninstalling numpy or updating all the packages conda update --all which also includes numpy may solve this issue.
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.

SpaCy OSError: Can't find model 'en'

even though I downloaded the model it cannot load it
[jalal#goku entity-sentiment-analysis]$ which python
/scratch/sjn/anaconda/bin/python
[jalal#goku entity-sentiment-analysis]$ sudo python -m spacy download en
[sudo] password for jalal:
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz (37.4MB)
100% |████████████████████████████████| 37.4MB 9.4MB/s
Installing collected packages: en-core-web-sm
Running setup.py install for en-core-web-sm ... done
Successfully installed en-core-web-sm-2.0.0
Linking successful
/usr/lib/python2.7/site-packages/en_core_web_sm -->
/usr/lib64/python2.7/site-packages/spacy/data/en
You can now load the model via spacy.load('en')
import spacy
nlp = spacy.load('en')
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-0fcabaab8c3d> in <module>()
1 import spacy
2
----> 3 nlp = spacy.load('en')
/scratch/sjn/anaconda/lib/python3.6/site-packages/spacy/__init__.py in load(name, **overrides)
17 "to load. For example:\nnlp = spacy.load('{}')".format(depr_path),
18 'error')
---> 19 return util.load_model(name, **overrides)
20
21
/scratch/sjn/anaconda/lib/python3.6/site-packages/spacy/util.py in load_model(name, **overrides)
118 elif hasattr(name, 'exists'): # Path or Path-like to model data
119 return load_model_from_path(name, **overrides)
--> 120 raise IOError("Can't find model '%s'" % name)
121
122
OSError: Can't find model 'en'
How should I fix this?
If I don't use sudo for downloading the en model, I get:
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz (37.4MB)
100% |████████████████████████████████| 37.4MB 9.6MB/s ta 0:00:011 62% |████████████████████ | 23.3MB 8.6MB/s eta 0:00:02
Requirement already satisfied (use --upgrade to upgrade): en-core-web-sm==2.0.0 from https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz in /scratch/sjn/anaconda/lib/python3.6/site-packages
You are using pip version 10.0.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Error: Couldn't link model to 'en'
Creating a symlink in spacy/data failed. Make sure you have the required
permissions and try re-running the command as admin, or use a
virtualenv. You can still import the model as a module and call its
load() method, or create the symlink manually.
/scratch/sjn/anaconda/lib/python3.6/site-packages/en_core_web_sm -->
/scratch/sjn/anaconda/lib/python3.6/site-packages/spacy/data/en
Download successful but linking failed
Creating a shortcut link for 'en' didn't work (maybe you don't have
admin permissions?), but you can still load the model via its full
package name:
nlp = spacy.load('en_core_web_sm')
FINALLY CLEARED THE ERROR !!!
Best Way to Install now
pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm
Always Open Anaconda Prompt / Command Prompt with Admin Rights to avoid Linking errors!!!
Tried multiple options including :
python -m spacy download en
conda install -c conda-forge spacy
python -m spacy download en_core_web_sm
python -m spacy link en_core_web_sm en
None worked since im using my Company's Network. Finally this Command Worked like a Charm :-)
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz --no-deps
Updated with Latest Link :
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz --no-deps
Thanks to the Updated Github Links :-)
By using sudo python ... you install the model for a different python interpreter than your local one. In fact, it says in your log that the spaCy model is installed to /usr/lib64/python2.7/site-packages/ instead of /scratch/sjn/anaconda/lib/python3.6/site-packages/.
Try running python -m spacy download en and it should install the model to the correct directory.
1) Install Spacy
$ python -m spacy download en
2) Install the model en_core_web_sm
$ python -m spacy download en_core_web_sm
>>> import spacy
>>> nlp = spacy.load("en_core_web_sm")
oh well. turns out even though my which python was showing anaconda python, when I was using python download it was linking it to python2.7 local on my machine. I fixed it using below command:
$ sudo /scratch/sjn/anaconda/bin/python -m spacy download en
I am using anaconda jupyter notebook and was getting same error. Ran below commands in anaconda prompt (run as administrator) and it resolved my issue:
(base) C:\WINDOWS\system32>conda install -c conda-forge spacy
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\yadav\Anaconda3
added / updated specs:
- spacy
The following packages will be downloaded:
package | build
---------------------------|-----------------
cymem-2.0.3 | py37h6538335_0 35 KB conda-forge
cython-blis-0.4.1 | py37hfa6e2cd_0 4.3 MB conda-forge
murmurhash-1.0.0 | py37h6538335_0 17 KB conda-forge
plac-0.9.6 | py_1 18 KB conda-forge
preshed-3.0.2 | py37h6538335_1 89 KB conda-forge
spacy-2.2.1 | py37he980bc4_0 7.4 MB conda-forge
srsly-0.2.0 | py37h6538335_0 189 KB conda-forge
thinc-7.1.1 | py37he980bc4_0 1.4 MB conda-forge
wasabi-0.4.0 | py_0 19 KB conda-forge
------------------------------------------------------------
Total: 13.4 MB
The following NEW packages will be INSTALLED:
cymem conda-forge/win-64::cymem-2.0.3-py37h6538335_0
cython-blis conda-forge/win-64::cython-blis-0.4.1-py37hfa6e2cd_0
murmurhash conda-forge/win-64::murmurhash-1.0.0-py37h6538335_0
plac conda-forge/noarch::plac-0.9.6-py_1
preshed conda-forge/win-64::preshed-3.0.2-py37h6538335_1
spacy conda-forge/win-64::spacy-2.2.1-py37he980bc4_0
srsly conda-forge/win-64::srsly-0.2.0-py37h6538335_0
thinc conda-forge/win-64::thinc-7.1.1-py37he980bc4_0
wasabi conda-forge/noarch::wasabi-0.4.0-py_0
Proceed ([y]/n)? Y
Downloading and Extracting Packages
cython-blis-0.4.1 | 4.3 MB | ############################################################################ | 100%
cymem-2.0.3 | 35 KB | ############################################################################ | 100%
srsly-0.2.0 | 189 KB | ############################################################################ | 100%
thinc-7.1.1 | 1.4 MB | ############################################################################ | 100%
plac-0.9.6 | 18 KB | ############################################################################ | 100%
spacy-2.2.1 | 7.4 MB | ############################################################################ | 100%
preshed-3.0.2 | 89 KB | ############################################################################ | 100%
wasabi-0.4.0 | 19 KB | ############################################################################ | 100%
murmurhash-1.0.0 | 17 KB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) C:\WINDOWS\system32>python -m spacy download en
Collecting en_core_web_sm==2.2.0
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz (12.0MB)
|████████████████████████████████| 12.0MB 409kB/s
Requirement already satisfied: spacy>=2.2.0 in c:\users\yadav\anaconda3\lib\site-packages (from en_core_web_sm==2.2.0) (2.2.2)
Requirement already satisfied: numpy>=1.15.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.16.2)
Requirement already satisfied: thinc<7.4.0,>=7.3.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (7.3.1)
Requirement already satisfied: wasabi<1.1.0,>=0.3.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.4.0)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (2.21.0)
Requirement already satisfied: setuptools in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (40.8.0)
Requirement already satisfied: plac<1.2.0,>=0.9.6 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.1.3)
Requirement already satisfied: srsly<1.1.0,>=0.1.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.2.0)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (2.0.3)
Requirement already satisfied: importlib-metadata>=0.20; python_version < "3.8" in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.23)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.0.2)
Requirement already satisfied: blis<0.5.0,>=0.4.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.4.1)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (3.0.2)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in c:\users\yadav\anaconda3\lib\site-packages (from thinc<7.4.0,>=7.3.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (4.36.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (2019.3.9)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (1.24.1)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (3.0.4)
Requirement already satisfied: zipp>=0.5 in c:\users\yadav\anaconda3\lib\site-packages (from importlib-metadata>=0.20; python_version < "3.8"->spacy>=2.2.0->en_core_web_sm==2.2.0) (0.6.0)
Requirement already satisfied: more-itertools in c:\users\yadav\anaconda3\lib\site-packages (from zipp>=0.5->importlib-metadata>=0.20; python_version < "3.8"->spacy>=2.2.0->en_core_web_sm==2.2.0) (6.0.0)
Building wheels for collected packages: en-core-web-sm
Building wheel for en-core-web-sm (setup.py) ... done
Created wheel for en-core-web-sm: filename=en_core_web_sm-2.2.0-cp37-none-any.whl size=12019131 sha256=f716e80f029462a80e9fb79ef353c1ac8c0f81d3754778bb6fec520d640fcc87
Stored in directory: C:\Users\yadav\AppData\Local\Temp\pip-ephem-wheel-cache-bvy0x0eg\wheels\48\5c\1c\15f9d02afc8221a668d2172446dd8467b20cdb9aef80a172a4
Successfully built en-core-web-sm
Installing collected packages: en-core-web-sm
Found existing installation: en-core-web-sm 2.0.0
Uninstalling en-core-web-sm-2.0.0:
Successfully uninstalled en-core-web-sm-2.0.0
Successfully installed en-core-web-sm-2.2.0
✔ Download and installation successful
You can now load the model via spacy.load('en_core_web_sm')
symbolic link created for C:\Users\yadav\Anaconda3\lib\site-packages\spacy\data\en <<===>> C:\Users\yadav\Anaconda3\lib\site-packages\en_core_web_sm
✔ Linking successful
C:\Users\yadav\Anaconda3\lib\site-packages\en_core_web_sm -->
C:\Users\yadav\Anaconda3\lib\site-packages\spacy\data\en
You can now load the model via spacy.load('en')
(base) C:\WINDOWS\system32>
Then in jupyter notebook load it like below:
nlp = spacy.load('en',parse=True,tag=True, entity=True)
If you use other python version, you can run :
sudo python3.6 -m spacy download en
With me, my version 3.6
I hope it can help your problem!
As you are using Anaconda, open Anaconda Prompt as an Admin and execute the following command
python -m spacy download en
To load Spacy 'en' in Jupyter Notebook use the following command
spacy.load('en')
you need to download en_core_web_sm
if you are using anaconda , then run this command
conda install -c conda-forge spacy-model-en_core_web_sm
and load it as
nlp= spacy.load('en_core_web_sm')
Bc i didnt find my error here (For everyone who uses jupyter Notebook, Alteryx, Company Network and had this error):
i tried to create a macro with python for topic detection but got the Error that there is not a module named "en_core_web_sm"
Install following Packages at the beginning with following code:
from ayx import Package
Package.installPackages(['pandas','numpy', 'matplotlib',
'gensim', 'spacy', 'pyLDAvis',
'https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz'])
And if you are referencing to the module use:
import en_core_web_sm
nlp = en_core_web_sm.load()
worked for me perf fine :))
Go to https://github.com/explosion/spacy-models
Download the model you want to load in SpaCy
Paste the downloaded file in SpaCy folder present inside the Anaconda folder
open cmd there. Type the following command and hit enter:
pip install en_core_web_md-1.2.0.tar.gz
The above command may vary depending upon the version of the file downloaded.
Voila! Error has gone :)
pip install https://github.com/explosion/spacy-
models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
#fixes an permission error when attempting to create the symlinks on windows 10
python -m spacy link en_core_web_sm en_core_web_smc
from Jupyter notes
import spacy
nlp = spacy.load('en_core_web_sm')
Since you are using python version 3.6, try using -
python3 -m spacy download en
instead of just python -m .....
If you have already downloaded spacy and the language model (E.g., en_core_web_sm or en_core_web_md), then you can follow these steps:
Open Anaconda prompt as admin
Then type : python -m spacy link [package name or path] [shortcut]
For E.g., python -m spacy link /Users/you/model en
This will create a symlink to the your language model. Now you can load the model using spacy.load("en") in your notebooks or scripts
A quick hack to fix: Install an available model (e.g. en_core_web_sm) and then make the symlink yourself. Copy the two paths spacy says that it can't link (probably due to the virtual environment running without admin elevation) and use e.g. mklink on Windows.
E.g. mklink /D C:\Users\USER\PROJECT\venv2\lib\site-packages\spacy\data\en C:\Users\USER\PROJECT\venv2\lib\site-packages\en_core_web_sm

Resources