1

I tried to try a chatbot made by a friend of mine with Rasa on a Windows 10. Getting started with the installation of the backend through their tutorial I was surprised that I couldn't link model to 'en_core_web_md' after using python -m spacy link en_core_web_md en. Here is the full error message:

Error: Couldn't link model to 'en_core_web_md'
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.

C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en_core_web_md


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('{name}')
Download successful but linking failed


(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>
(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>python -m spacy link en_core_web_md en

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.

C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en

Traceback (most recent call last):
  File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\__main__.py", line 31, in <module>
plac.call(commands[command], sys.argv[1:])
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\cli\link.py", line 48, in link
symlink_to(link_path, model_path)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\compat.py", line 87, in symlink_to
orig.symlink_to(dest)
  File "C:\Python36\lib\pathlib.py", line 1327, in symlink_to
self._accessor.symlink(target, self, target_is_directory)
  File "C:\Python36\lib\pathlib.py", line 393, in wrapped
return strfunc(str(pathobjA), str(pathobjB), *args)
OSError: symbolic link privilege not held

(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>sudo python -m spacy link en_core_web_md en
C:\Python36\python.exe: No module named spacy

It's weird because I was able to do so on Ubuntu. Do you have any idea ?

Revolucion for Monica
  • 2,848
  • 8
  • 39
  • 78
  • 1
    In windows, run the same command as administrator. I had the same issue, running it as administrator fixed it. You can see it here: https://stackoverflow.com/questions/43459437/spacy-link-error – Srikar Nov 30 '18 at 10:52

4 Answers4

2

This is a known problem. In fact your error message is giving exactly what went wrong. The script could not create Symbolic link (a Shortcut) for en_core_web_md. Perform the following to fix the issue

  • Goto your directory: C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\

  • Create a shortcut to destination: C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md

  • Name it as en


If you want to know how to create the shortcut, following screenshots might help

Goto the folder, C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\ and right click and create shortcut

enter image description here

Provide the target directory: In you case it is C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md Then click on Next

enter image description here

You have to name the shortcut as en. Then click on Finish

enter image description here

Karthik Sunil
  • 544
  • 5
  • 15
1

Following the log that you have provided. Is possible to be a permission problem.

Try to open CMD with Administrator privileges, and then run spacy link command again.

Renato Aguiar
  • 91
  • 1
  • 5
1

What I did was open bash as admin, then run the command:

python -m spacy link en_core_web_md en

If you are using a virtualenv make sure to activate the said virtualenv first.

4b0
  • 21,981
  • 30
  • 95
  • 142
1

You can also use the mklink command in cmd to create a symbolic link in the desired folder.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.
Ansel D'souza
  • 63
  • 1
  • 6