rez
rez copied to clipboard
NoneType Error When Using `rez pip` on Windows
On Windows (using PowerShell or command prompt), I get a NoneType
error when runningrez pip -i pylint
(although it doesn't matter which package I try to install).
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\rez\2.72.0\Scripts\rez\rez.exe\__main__.py", line 7, in <module>
File "c:\rez\2.72.0\lib\site-packages\rez\cli\_entry_points.py", line 64, in run_rez
return run()
File "c:\rez\2.72.0\lib\site-packages\rez\cli\_main.py", line 170, in run
returncode = run_cmd()
File "c:\rez\2.72.0\lib\site-packages\rez\cli\_main.py", line 162, in run_cmd
return func(opts, opts.parser, extra_arg_groups)
File "c:\rez\2.72.0\lib\site-packages\rez\cli\pip.py", line 70, in command
pip_install_package(
File "c:\rez\2.72.0\lib\site-packages\rez\pip.py", line 267, in pip_install_package
py_exe, context = find_pip(pip_version, python_version)
File "c:\rez\2.72.0\lib\site-packages\rez\pip.py", line 94, in find_pip
py_exe, found_pip_version, context = find_pip_from_context(
File "c:\rez\2.72.0\lib\site-packages\rez\pip.py", line 209, in find_pip_from_context
proc = context.execute_command(
File "c:\rez\2.72.0\lib\site-packages\rez\resolved_context.py", line 958, in _check
return fn(self, *nargs, **kwargs)
File "c:\rez\2.72.0\lib\site-packages\rez\resolved_context.py", line 1221, in execute_command
return interpreter.subprocess(args, **Popen_args)
File "c:\rez\2.72.0\lib\site-packages\rez\rex.py", line 655, in subprocess
return Popen(args,
File "c:\rez\2.72.0\lib\site-packages\rez\utils\execution.py", line 85, in __init__
super(Popen, self).__init__(args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1356, in _execute_child
args = list2cmdline(args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 561, in list2cmdline
for arg in map(os.fsdecode, seq):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\os.py", line 822, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType
The problem appears to be that find_python_in_context
can return None
which is then unhandled in the calling find_pip_from_context
.
In my case, find_python_in_context
returns None
because shutilwhich.which
is unable to locate the python
executable. While which
is looking for python.exe
(among other path extensions) the python package I created with rez bind
only contains a python
executable (symlink) without an extension.
I've created an additional python.exe
symlink to work around this for the moment.
This looks to be related to #904.
possibly related to #1027