Skip to content

Bug with pip_install function on Colab #89

@narugo1992

Description

@narugo1992

Only happens on colab

from hbutils.system import pip_install
pip_install(['onnxruntime-gpu'], silent=False)
---------------------------------------------------------------------------
UnsupportedOperation                      Traceback (most recent call last)
[<ipython-input-9-7d731497eb49>](https://localhost:8080/#) in <module>
      1 from hbutils.system import pip_install
      2 
----> 3 pip_install(['onnxruntime-gpu'], silent=False)

4 frames
[/usr/local/lib/python3.8/dist-packages/hbutils/system/python/package.py](https://localhost:8080/#) in pip_install(reqs, silent, force, user)
    173     """
    174     if force or not check_reqs(reqs):
--> 175         pip('install', *(('--user',) if user else ()), *reqs, silent=silent)
    176 
    177 

[/usr/local/lib/python3.8/dist-packages/hbutils/system/python/package.py](https://localhost:8080/#) in pip(silent, *args)
     89     with open(os.devnull, 'w') as sout:
     90         try:
---> 91             process = subprocess.run(
     92                 [sys.executable, '-m', 'pip', *args],
     93                 stdin=sys.stdin if not silent else None,

[/usr/lib/python3.8/subprocess.py](https://localhost:8080/#) in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    491         kwargs['stderr'] = PIPE
    492 
--> 493     with Popen(*popenargs, **kwargs) as process:
    494         try:
    495             stdout, stderr = process.communicate(input, timeout=timeout)

[/usr/lib/python3.8/subprocess.py](https://localhost:8080/#) 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, encoding, errors, text)
    806         (p2cread, p2cwrite,
    807          c2pread, c2pwrite,
--> 808          errread, errwrite) = self._get_handles(stdin, stdout, stderr)
    809 
    810         # We wrap OS handles *before* launching the child, otherwise a

[/usr/lib/python3.8/subprocess.py](https://localhost:8080/#) in _get_handles(self, stdin, stdout, stderr)
   1487             else:
   1488                 # Assuming file-like object
-> 1489                 c2pwrite = stdout.fileno()
   1490 
   1491             if stderr is None:

UnsupportedOperation: fileno

And the stdout is this thing

import sys
print(sys.stdout)
print(sys.__stdout__)
<ipykernel.iostream.OutStream object at 0x7faffd26fee0>
<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions