Here is the code I'm trying to use:
import sys
!{sys.executable} -m pip install spacy
!{sys.executable} -m spacy download en
This is the response:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Input In [12], in <cell line: 2>()
1 import sys
----> 2 get_ipython().system('{sys.executable} -m pip install spacy')
3 get_ipython().system('{sys.executable} -m spacy download en')
File /lib/python3.9/site-packages/IPython/core/interactiveshell.py:2442, in InteractiveShell.system_piped(self, cmd)
2437 raise OSError("Background processes not supported.")
2439 # we explicitly do NOT return the subprocess status code, because
2440 # a non-None value would trigger :func:`sys.displayhook` calls.
2441 # Instead, we store the exit_code in user_ns.
-> 2442 self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
File /lib/python3.9/site-packages/IPython/utils/_process_posix.py:148, in ProcessHandler.system(self, cmd)
146 child = pexpect.spawnb(self.sh, args=['-c', cmd]) # Pexpect-U
147 else:
--> 148 child = pexpect.spawn(self.sh, args=['-c', cmd]) # Vanilla Pexpect
149 flush = sys.stdout.flush
150 while True:
151 # res is the index of the pattern that caused the match, so we
152 # know whether we've finished (if we matched EOF) or not
File /lib/python3.9/site-packages/IPython/utils/_process_posix.py:57, in ProcessHandler.sh(self)
55 self._sh = pexpect.which(shell_name)
56 if self._sh is None:
---> 57 raise OSError('"{}" shell not found'.format(shell_name))
59 return self._sh
OSError: "sh" shell not found
Also, the instructions I am following say I need to select File, New Notebook, Python 3. But I can only select File, New Notebook, and then a popup asks me to select a kernal. Does that matter? (I have tried all kernal options.)
The frustrating thing is that I did this same tutorial a few weeks ago and it worked fine.
[Edit: Thank you to everyone who is helping me figure this out, but unfortunately none of these solutions are working. I looked at the link provided by JonSG, but I'm afraid it's all greek to me. I'm starting to think this is an issue with Jupyter, rather than the code. Again, I appreciate the help, but I'm throwing in the towel.]