SpaCy OSError: Can't find model 'en' - nlp

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

Related

Why pip does not install a package?

pip install indicates that the nitime package was successfully installed but it is not. Why is this?
$ pip3 install nitime
Defaulting to user installation because normal site-packages is not writeable
Collecting nitime
Using cached nitime-0.9.tar.gz (6.2 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./.local/lib/python3.8/site-packages (from nitime) (1.22.3)
Requirement already satisfied: cython in /usr/lib64/python3.8/site-packages (from nitime) (0.29.14)
Requirement already satisfied: scipy in ./.local/lib/python3.8/site-packages (from nitime) (1.8.0)
Requirement already satisfied: matplotlib in /usr/lib64/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: networkx in /usr/lib/python3.8/site-packages (from nitime) (2.5)
Requirement already satisfied: nibabel in ./.local/lib/python3.8/site-packages (from nitime) (3.2.2)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib64/python3.8/site-packages (from matplotlib->nitime) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.8/site-packages (from matplotlib->nitime) (2.4.7)
Requirement already satisfied: python-dateutil>=2.1 in ./.local/lib/python3.8/site-packages (from matplotlib->nitime) (2.8.2)
Requirement already satisfied: decorator>=4.3.0 in /usr/lib/python3.8/site-packages (from networkx->nitime) (4.4.0)
Requirement already satisfied: packaging>=14.3 in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (21.3)
Requirement already satisfied: setuptools in ./.local/lib/python3.8/site-packages (from nibabel->nitime) (60.6.0)
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from cycler>=0.10->matplotlib->nitime) (1.14.0)
Using legacy 'setup.py install' for nitime, since package 'wheel' is not installed.
Installing collected packages: nitime
Running setup.py install for nitime ... done
Successfully installed nitime
$ pip3 show nitime
WARNING: Package(s) not found: nitime
$ python3 -c "import nitime"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'nitime'
$ pip3 show pip
Name: pip
Version: 22.0.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig#python.org
License: MIT
Location: /home/servoz/.local/lib/python3.8/site-packages
Requires:
Required-by:
$ uname -a
Linux 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ python3 -V
Python 3.8.10
EDIT:
Ok! I managed to install using dnf install python3-nitime (fedora).
I don't really understand why pip doesn't work with nitime on fedora ...
This may be because of conflicts with other packages, so try doing this in a new environment. Try creating a virtual environment. Install virtualenv using this:
pip install virtualenv
Create a virtual environment named venv using this:
virtualenv venv
To activate the virtual environment, use this:
source ./venv/bin/activate
Try installing nitime now:
pip3 install nitime
Done!
You can deactivate the virtual environment using this:
deactivate

Why rasa init is not getting executed?

I have installed rasa using the below commands on my Windows 10.
d:\Learning\vs_rasa_4_beg_udemy>python -m venv ./venv
d:\Learning\vs_rasa_4_beg_udemy>.\venv\Scripts\activate
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install -U --user pip
(venv) d:\Learning\vs_rasa_4_beg_udemy>python -m pip install --upgrade pip
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install rasa
After the above, I have run
(venv) d:\Learning\vs_rasa_4_beg_udemy>rasa init
for which I am getting the message:
'rasa' is not recognized as an internal or external command, operable
program or batch file.
I tried to rerun the pip3 install rasa, which shows that all requirements are satisfied. Why is that rasa init is not getting executed? What shall be done? Appreciate inputs.
(venv) d:\Learning\vs_rasa_4_beg_udemy>pip3 install rasa
Requirement already satisfied: rasa in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (0.0.5)
Requirement already satisfied: requests in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from rasa) (2.26.0)
Requirement already satisfied: charset-normalizer~=2.0.0 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (2.0.6)
Requirement already satisfied: certifi>=2017.4.17 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (2021.5.30)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (1.26.7)
Requirement already satisfied: idna<4,>=2.5 in d:\learning\vs_rasa_4_beg_udemy\venv\lib\site-packages (from requests->rasa) (3.2)
Please check if the Python version you're using matches the rasa requirements (currently only Python 3.6, 3.7 and 3.8 are supported)

Error installing open-cv | windows | anaconda | python 3.8

I am trying to install Open-cv on anaconda prompt but every time I start installation using
python -m pip install opencv-python
it shows me different errors, I have tried installing OpenCV using cmd but it shows:
Requirement already satisfied: opencv-python in c:\users\wajid\appdata\local\programs\python\python38-32\lib\site-packages (4.5.1.48)
Requirement already satisfied: numpy>=1.17.3 in c:\users\wajid\appdata\local\programs\python\python38-32\lib\site-packages (from opencv-python) (1.20.2)
what does this mean? Checked on jupyter notebook it shows:
ModuleNotFoundError: No module named 'cv2'
I have only single version of python installed on my laptop.

How to install and run gym box2d environment in google colab?

I have followed this method to run a box2d enviroment without rendering it in google colab,
!apt-get install python-box2d
!pip install box2d-py
!pip install gym[Box_2D]
import gym
env = gym.make("BipedalWalker-v2")
but its showing this
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-box2d is already the newest version (2.3.2~dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
Requirement already satisfied: box2d-py in /usr/local/lib/python3.6/dist-packages (2.3.8)
Requirement already satisfied: gym[Box_2D] in /usr/local/lib/python3.6/dist-packages (0.15.3)
WARNING: gym 0.15.3 does not provide the extra 'box_2d'
Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from gym[Box_2D]) (1.12.0)
Requirement already satisfied: pyglet<=1.3.2,>=1.2.0 in /usr/local/lib/python3.6/dist-packages (from gym[Box_2D]) (1.3.2)
Requirement already satisfied: numpy>=1.10.4 in /usr/local/lib/python3.6/dist-packages (from gym[Box_2D]) (1.17.3)
Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from gym[Box_2D]) (1.3.1)
Requirement already satisfied: cloudpickle~=1.2.0 in /usr/local/lib/python3.6/dist-packages (from gym[Box_2D]) (1.2.2)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from pyglet<=1.3.2,>=1.2.0->gym[Box_2D]) (0.16.0)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-10-62ca95674145> in <module>()
3 get_ipython().system('pip install gym[Box_2D]')
4 import gym
----> 5 env = gym.make("BipedalWalker-v2")
3 frames
/usr/local/lib/python3.6/dist-packages/gym/envs/registration.py in load(name)
16 mod_name, attr_name = name.split(":")
17 mod = importlib.import_module(mod_name)
---> 18 fn = getattr(mod, attr_name)
19 return fn
20
AttributeError: module 'gym.envs.box2d' has no attribute 'BipedalWalker'
I also tried to install this box2d from pip pip install Box2D but its not installing in colab. How do we install and run a box2d gym enviroment in google colag?
I was able to get it working with !pip3 install box2d-py==2.3.8.
Please create a new Colab notebook, Click on File -> New notebook. On a new (fresh) Colab execute these:
!pip3 install box2d-py
!pip3 install gym[Box_2D]
import gym
env = gym.make("BipedalWalker-v3")
The gym is installed by default in the new notebook however you have to install the box2d-py and gym[Box_2D]. Please close the current notebook if you have encountered the error. Simply use a new notebook (VERY IMPORTANT) and go on with above procedure of pip install. It will work!

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.

Resources