Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoneType Error When Using rez pip on Windows #1024

Open
mstreatfield opened this issue Feb 12, 2021 · 2 comments
Open

NoneType Error When Using rez pip on Windows #1024

mstreatfield opened this issue Feb 12, 2021 · 2 comments
Labels
bug rez-pip ingesting py pkgs into rez (pip, wheels, etc)

Comments

@mstreatfield
Copy link
Contributor

mstreatfield commented Feb 12, 2021

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.

@mstreatfield
Copy link
Contributor Author

This looks to be related to #904.

@herronelou
Copy link
Contributor

possibly related to #1027

@JeanChristopheMorinPerso JeanChristopheMorinPerso added bug rez-pip ingesting py pkgs into rez (pip, wheels, etc) labels Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rez-pip ingesting py pkgs into rez (pip, wheels, etc)
Projects
None yet
Development

No branches or pull requests

3 participants