0

I am unable to use pip install to install a library in jupyter notebook.

I tried running pip install ffprobe and I received the error below

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_19512\1427077936.py in <module>
----> 1 get_ipython().run_line_magic('conda', 'install -c travis ffprobe')

~\anaconda3\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2362                 kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2363             with self.builtin_trap:
-> 2364                 result = fn(*args, **kwargs)
   2365             return result
   2366 

~\anaconda3\lib\site-packages\decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

~\anaconda3\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~\anaconda3\lib\site-packages\IPython\core\magics\packaging.py in conda(self, line)
    107             extra_args.extend(["--prefix", sys.prefix])
    108 
--> 109         self.shell.system(' '.join([conda, command] + extra_args + args))
    110         print("\nNote: you may need to restart the kernel to use updated packages.")

~\anaconda3\lib\site-packages\ipykernel\zmqshell.py in system_piped(self, cmd)
    629                 if path is not None:
    630                     cmd = "pushd %s &&%s" % (path, cmd)
--> 631                 self.user_ns["_exit_code"] = system(cmd)
    632         else:
    633             self.user_ns["_exit_code"] = system(self.var_expand(cmd, depth=1))

~\anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    143         if path is not None:
    144             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 145         return process_handler(cmd, _system_body)
    146 
    147 def getoutput(cmd):

~\anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     77     if shell and os.name == 'posix' and 'SHELL' in os.environ:
     78         executable = os.environ['SHELL']
---> 79     p = subprocess.Popen(cmd, shell=shell,
     80                          executable=executable,
     81                          stdin=subprocess.PIPE,

~\anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    949                             encoding=encoding, errors=errors)
    950 
--> 951             self._execute_child(args, executable, preexec_fn, close_fds,
    952                                 pass_fds, cwd, env,
    953                                 startupinfo, creationflags, shell,

~\anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1418             # Start the process
   1419             try:
-> 1420                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1421                                          # no special security
   1422                                          None, None,

FileNotFoundError: [WinError 2] The system cannot find the file specified

The first thing I tried to do was add --user at the end of my command so it is pip install ffprobe-python --user but I still received the same error. After that I tried upgrading pip using pip install --upgrade pip but it didn't work.

I tried entering anaconda3/share/jupyter/python3 and checking if the kernel.json file has any issue but there was no problem

Lastly I tried going into subprocesses.py and changing the shell from this function to true but it didnt solve anything

def __init__(self, args, bufsize=-1, executable=None,
                 stdin=None, stdout=None, stderr=None,
                 preexec_fn=None, close_fds=True,
                 shell=False, cwd=None, env=None, universal_newlines=None,
                 startupinfo=None, creationflags=0,
                 restore_signals=True, start_new_session=False,
                 pass_fds=(), *, user=None, group=None, extra_groups=None,
                 encoding=None, errors=None, text=None, umask=-1):

Please do let me know if any more information needs to be provided as I am quite new to this and any help would be greatly appreciated.

I just tried %conda install -c travis ffprobe and installing the package that was mentioned however I still received the same error as the one above.

  • I'd suggest trying to use conda by running in the notebook, `%conda install -c travis ffprobe`, since the type of issue seems similar to [here](https://github.com/explosion/spaCy/issues/2386#issuecomment-392731007). Only the original command you show is meant to be run inside the notebook and them more explicitly it would be `%pip install ffprobe-python`. The other ones you refer to are to be run in a terminal in the same environment. The magic one from inside the notebook should handle all that stuff so you don't want to interfere by adding the additional items when running inside a notebook. – Wayne Jan 13 '23 at 19:16
  • It seems the conda one [here](https://anaconda.org/travis/ffprobe) is older but maybe it will get you past the issue. – Wayne Jan 13 '23 at 19:19
  • Thanks so much for the help. I'm sorry I didn't know about the formatting I'll edit it real quick. – worstusername Jan 13 '23 at 20:07
  • Don't edit `subprocess.py` unless you know you aren't going to miss something up. That seems to be for things beyond ffprobe (I think) and could potentially mess up other things, maybe. – Wayne Jan 13 '23 at 22:00
  • Sorry for the late reply. I reverted the changes as many people in the same thread said to not do that. It's just that I was at my wit's end and was trying everything to get it to work. – worstusername Jan 14 '23 at 16:54

0 Answers0