You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On certain installations using rez-pip, I get an AttributeError exception citing "'NoneType' object has no attribute 'lower'". The stacktrace is this:
Traceback (most recent call last):
File "/rel/third_party/rez/2.4.1/bin/rez/rez-pip", line 4, in <module>
run('pip')
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/cli/_main.py", line 117, in run
returncode = run_cmd()
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/cli/_main.py", line 109, in run_cmd
return opts.func(opts, opts.parser, arg_groups[1:])
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/cli/pip.py", line 46, in command
release=opts.release)
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/pip.py", line 262, in pip_install_package
requirements.extend(_get_dependencies(requirement, distributions))
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/pip.py", line 74, in _get_dependencies
name = get_distrubution_name(name)
File "/rel/third_party/rez/2.4.1/lib/python2.7/site-packages/rez-2.4.1-py2.7.egg/rez/pip.py", line 47, in get_distrubution_name
pip_to_rez_name = pip_name.lower().replace("-", "_")
AttributeError: 'NoneType' object has no attribute 'lower'
Here's what I've been able to observe. The InstallMode._get_dependencies method in rez/pip.py is called with requirement=u'six (>=1.5)' and distributions=[<EggInfoDistribution u'python-dateutil' 2.6.0>]. On line #62, the local "name" variable is set to None because get_distribution_name never gets a match on line #50 because "six" != "python-dateutil" and hence that return line on #51 isn't executed. When get_distribution_name is called again on line #74, that function tries to call the lower() method on that None object and fails.
Some ideas on how to fix this, but take them with a grain of salt since I'm new to this codebase:
If a match between the distribution name and the requirement name isn't found in get_distribution_name, instead of returning None, just pass through the pip_to_rez_name value.
Maybe the distributions list is incomplete. If there should be an EggInfoDistribution object in the distributions list for each requirement, we need to figure out why that isn't happening in some cases.
The text was updated successfully, but these errors were encountered:
I'm guessing this is likely being caused by some legacy idiosyncrasies in how PyPi indexes its python packages. There are many cases where the "PyPi package name" doesn't match the actual installed "package name" (especially for any package that contains a dash ("-") in the name). In this case, it's likely trying to match the python-dateutil package and can't find it because it's been installed as python_dateutil or just dateutil.
I ran into the same problem and ended up writing my own pip rez package maker script. It uses a python library called pipdeptree to get dependencies and match up installed package names to the PyPi index name.
If I get some time, I'll try to merge it into the official rez pip and submit a Pull Request.
First the basics:
On certain installations using rez-pip, I get an AttributeError exception citing "'NoneType' object has no attribute 'lower'". The stacktrace is this:
Here's what I've been able to observe. The InstallMode._get_dependencies method in rez/pip.py is called with requirement=u'six (>=1.5)' and distributions=[<EggInfoDistribution u'python-dateutil' 2.6.0>]. On line #62, the local "name" variable is set to None because get_distribution_name never gets a match on line #50 because "six" != "python-dateutil" and hence that return line on #51 isn't executed. When get_distribution_name is called again on line #74, that function tries to call the lower() method on that None object and fails.
Some ideas on how to fix this, but take them with a grain of salt since I'm new to this codebase:
The text was updated successfully, but these errors were encountered: