-
Notifications
You must be signed in to change notification settings - Fork 337
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
rez-pip not working ? #904
Comments
Hello,
This command creates basic package including python package. The error is due to this symlink and rez pip search for a real python.exe. For the devs, I don't wanna change your code but the problem come from : REZ_INSTALL\Lib\site-packages\rez\pip.py Hope it's help |
thank you, I find another way to fix this...After install rez and bind rez default packages, download a web enabled python version from python web side, put it into python package same folder, change a little of package,py, and it worked... |
Hi, this is still an issue in Rez 2.72.0 for Windows. The problem is that # -*- coding: utf-8 -*-
__author__ = "Daniel Roy Greenfeld"
__email__ = "pydanny@gmail.com"
__version__ = "0.6.1"
import os
import sys
try: # Forced testing
from shutil import which
except ImportError: # Forced testing
# Versions prior to Python 3.3 don't have shutil.which
def which(cmd, mode=os.F_OK | os.X_OK, path=None, env=None):
"""Given a command, mode, and a PATH string, return the path which
conforms to the given mode on the PATH, or None if there is no such
file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.get("PATH"), or can be overridden with a custom search
path.
Note: This function was backported from the Python 3 source code.
"""
# Check that a given file can be accessed with the correct mode.
# Additionally check that `file` is not a directory, as on Windows
# directories pass the os.access check.
def _access_check(fn, mode):
return os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)
# If we're given a path with a directory part, look it up directly
# rather than referring to PATH directories. This includes checking
# relative to the current directory, e.g. ./script
if os.path.dirname(cmd):
if _access_check(cmd, mode):
return cmd
return None
if env is None:
env = os.environ
if path is None:
path = env.get("PATH", os.defpath)
if not path:
return None
path = path.split(os.pathsep)
if sys.platform == "win32":
# The current directory takes precedence on Windows.
if os.curdir not in path:
path.insert(0, os.curdir)
# PATHEXT is necessary to check on Windows.
pathext = env.get("PATHEXT", "").split(os.pathsep)
# See if the given file matches any of the expected path
# extensions. This will allow us to short circuit when given
# "python.exe". If it does match, only test that one, otherwise we
# have to try others.
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
files = [cmd]
else:
files = [cmd + ext for ext in pathext]
else:
# On other platforms you don't have things like PATHEXT to tell you
# what file suffixes are executable, so just pass on cmd as-is.
files = [cmd]
seen = set()
for dir in path:
normdir = os.path.normcase(dir)
if normdir not in seen:
seen.add(normdir)
for thefile in files:
name = os.path.join(dir, thefile)
if _access_check(name, mode):
return name
return None @nerdvegas do you mind if I make a PR with this change, assuming tests pass on Linux? |
This is still an issue on Windows with Python 3.9.7. I've tweaked my local rez with similar changes of @ColinKennedy 's proposal. Here's the correct link to whichcraft. |
I used
rez-pip -i xlrd
to install packages, but it not working, It working well on 2.58.110:20:33 INFO Trying to use pip from python package
Traceback (most recent call last):
File "C:\Python27\Lib\runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Python27\Lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\rez\2.61.1\Scripts\rez\rez-pip.exe_main.py", line 7, in
File "c:\rez\2.61.1\lib\site-packages\rez\cli_entry_points.py", line 187, in run_rez_pip
return run("pip")
File "c:\rez\2.61.1\lib\site-packages\rez\cli_main.py", line 160, in run
returncode = run_cmd()
File "c:\rez\2.61.1\lib\site-packages\rez\cli_main.py", line 152, in run_cmd
return func(opts, opts.parser, extra_arg_groups)
File "c:\rez\2.61.1\lib\site-packages\rez\cli\pip.py", line 76, in command
extra_args=opts.extra)
File "c:\rez\2.61.1\lib\site-packages\rez\pip.py", line 261, in pip_install_package
py_exe, context = find_pip(pip_version, python_version)
File "c:\rez\2.61.1\lib\site-packages\rez\pip.py", line 95, in find_pip
python_version, pip_version=version
File "c:\rez\2.61.1\lib\site-packages\rez\pip.py", line 212, in find_pip_from_context
text=True
File "c:\rez\2.61.1\lib\site-packages\rez\resolved_context.py", line 920, in _check
return fn(self, *nargs, **kwargs)
File "c:\rez\2.61.1\lib\site-packages\rez\resolved_context.py", line 1172, in execute_command
return interpreter.subprocess(args, **Popen_args)
File "c:\rez\2.61.1\lib\site-packages\rez\rex.py", line 658, in subprocess
**subproc_kwargs)
File "c:\rez\2.61.1\lib\site-packages\rez\utils\execution.py", line 79, in init
super(Popen, self).init(args, **kwargs)
File "C:\Python27\Lib\subprocess.py", line 394, in init
errread, errwrite)
File "C:\Python27\Lib\subprocess.py", line 599, in _execute_child
args = list2cmdline(args)
File "C:\Python27\Lib\subprocess.py", line 266, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'NoneType' is not iterable
The text was updated successfully, but these errors were encountered: