AcademySoftwareFoundation / rez

An integrated package configuration, build and deployment system for software
https://rez.readthedocs.io
Apache License 2.0
939 stars 332 forks source link

rez-pip AttributeError: 'NoneType' object has no attribute 'lower' error #419

Open est77 opened 7 years ago

est77 commented 7 years ago

rez 2.13.0, linux centos7 rez-pip -i reportlab fails with an AttributeError:

~/packages/pip/9.0.1/platform-linux/arch-x86_64/os-CentOS-7.3.1611/python-2.7/python/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdoptions.check_install_build_global(options) Collecting reportlab Using cached reportlab-3.4.0.tar.gz Collecting pillow>=2.4.0 (from reportlab) Using cached Pillow-4.1.0.tar.gz Requirement already satisfied: pip>=1.4.1 in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from reportlab) Requirement already satisfied: setuptools>=2.2 in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from reportlab) Collecting olefile (from pillow>=2.4.0->reportlab) Using cached olefile-0.44.zip Requirement already satisfied: six>=1.6.0 in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from setuptools>=2.2->reportlab) Requirement already satisfied: appdirs>=1.4.0 in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from setuptools>=2.2->reportlab) Requirement already satisfied: packaging>=16.8 in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from setuptools>=2.2->reportlab) Requirement already satisfied: pyparsing in ~/packages/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7.3.1611/lib/python2.7/site-packages (from packaging>=16.8->setuptools>=2.2->reportlab) Skipping bdist_wheel for reportlab, due to binaries being disabled for it. Skipping bdist_wheel for pillow, due to binaries being disabled for it. Skipping bdist_wheel for olefile, due to binaries being disabled for it. Installing collected packages: olefile, pillow, reportlab Running setup.py install for olefile ... done Running setup.py install for pillow ... done Running setup.py install for reportlab ... done Successfully installed olefile pillow reportlab 12:01:49 DEBUG Found /tmp/pip-tx01MG-rez/rez_staging/python/Pillow-4.1.0-py2.7.egg-info 12:01:49 DEBUG Found /tmp/pip-tx01MG-rez/rez_staging/python/olefile-0.44-py2.7.egg-info 12:01:49 DEBUG Found /tmp/pip-tx01MG-rez/rez_staging/python/reportlab-3.4.0-py2.7.egg-info 12:01:49 WARNING Skipping installation: Package variant already exists: ~/packages/Pillow/4.1.0/package.py[0] Traceback (most recent call last): File "/usr/local/rez/bin/rez/rez-pip", line 4, in run('pip') File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/cli/_main.py", line 118, in run returncode = run_cmd() File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/cli/_main.py", line 110, in run_cmd return opts.func(opts, opts.parser, arg_groups[1:]) File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/cli/pip.py", line 46, in command release=opts.release) File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/pip.py", line 262, in pip_install_package requirements.extend(_get_dependencies(requirement, distributions)) File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/pip.py", line 74, in _get_dependencies name = get_distrubution_name(name) File "/usr/local/rez/lib/python2.7/site-packages/rez-2.13.0-py2.7.egg/rez/pip.py", line 47, in get_distrubution_name pip_to_rez_name = pipname.lower().replace("-", "") AttributeError: 'NoneType' object has no attribute 'lower'

zachlewis commented 7 years ago

I've noticed this as well (osx-10.12.3 / rez-2.13.0)... this is one of those things I very nearly opened a ticket for, but couldn't reliably reproduce -- it seems like a symptom of something else, but certain packages that begin with capitalized names throws this exception -- in this case, I guess it's Pillow, but I've had the same problem with Flask, Babel (exactly the same as seen in the first half of the "rez-pip Sphinx failure" ticket), and Jinja2 (I'm 80% sure).

But it's not a problem with, say, Jinja, or BeautifulSoup (I think).

Pip is batshit insane, and I've been too fearful / lazy / busy to investigate much further, but I've noticed that "NoneType object has no attribute 'lower'" business more than a few times.

[but this is me being a 'power user' in a non-production environment on a hackintosh, so take everything i say with salt grains]

instinct-vfx commented 7 years ago

I am not sure i will find time to look into this a bit nor that i can reproduce it on windows. Rest assured things are way more crazy even on windows. That being said in my own implementation of rez-pip i ran into a lot of issues due to the gazillion of different packages formats (which are not rez's fault btw :smile: ).

My guess would be that the detection of the name fails for package of a specific type (e.g. egg vs. whl, source vs. binary) or following a specific package standard (the amount of relevant PEPs is daunting at best).

est77 commented 7 years ago

Thanks for the information. I'll try to debug this when I have some free time.

bpabel commented 7 years ago

I'm pretty sure it's a problem for packages on PyPi that use a different PyPi package name than the package name they're actually installed with. PyPi was designed before stuff like pip came along, so it still allows all sorts of nonsense (like dashes in package names) that aren't allowed in installations. Pillow gets installed as Pil, but BeautifulSoup actually gets installed as BeautifulSoup.

I've been using a separate script I made to create rez packages with pip using a library called pipdeptree, which is able to make the connection between installed package and the name on PyPi. It's fairly tailored to the way we create and install rez-packages at the moment. Hopefully I can generalize it so it might be able to be applied in the rez-pip command.

nerdvegas commented 7 years ago

Sorry I don't have the bandwidth to go further down this road guys. Would love to see a robust rez pip ingestion solution at some point! It is indeed a messy problem.

Thx A

On Sat, Apr 29, 2017 at 5:07 AM, Brendan Abel notifications@github.com wrote:

I'm pretty sure it's a problem for packages on PyPi that use a different PyPi package name than the package name they're actually installed with. PyPi was designed before stuff like pip came along, so it still allows all sorts of nonsense (like dashes in package names) that aren't allowed in installations. Pillow gets installed as Pil, but BeautifulSoup actually gets installed as BeautifulSoup.

I've been using a separate script I made to create rez packages with pip using a library called pipdeptree, which is able to make the connection between installed package and the name on PyPi. It's fairly tailored to the way we create and install rez-packages at the moment. Hopefully I can generalize it so it might be able to be applied in the rez-pip command.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nerdvegas/rez/issues/419#issuecomment-298082126, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjqSikWHXVCFhE03DMz--lxK1At7R6dks5r0jkJgaJpZM4NKAh6 .