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

Old version of Setuptools #4309

Closed
MinchinWeb opened this issue Feb 28, 2017 · 4 comments
Closed

Old version of Setuptools #4309

MinchinWeb opened this issue Feb 28, 2017 · 4 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@MinchinWeb
Copy link

  • Pip version: 9.0.1
  • Python version: 3.6.0
  • Operating system: Windows 10 x64

Description:

See pypa/setuptools#885

I think I've run into this issue. I've installed two package from the same namespace, and it breaks many things, throwing an error "_NamespacePath object has no attribute sort".

Setuptools was throwing this error (on version 28), so I upgraded it to the current version (34.3.0), but now Pip is throwing the same error. I think upgrading the vendored version of Setuptools will fix the problem.

What I've run:

> pip list

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "S:\Documents\Code\minchin.releaser\env\env-mine-0.4.0\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3018, in <module>
    @_call_aside
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3004, in _call_aside
    f(*args, **kwargs)
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3046, in _initialize_master_working_set
    dist.activate(replace=False)
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2578, in activate
    declare_namespace(pkg)
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2152, in declare_namespace
    _handle_ns(packageName, path_item)
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2092, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "s:\documents\code\minchin.releaser\env\env-mine-0.4.0\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2121, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
@MinchinWeb
Copy link
Author

I can confirm that updating the vendored version of setuptools fixes this problem (see https://github.com/MinchinWeb/pip/commit/32bbbc92e7fdc172300240e2de0d32d8251cdb10).

However, I uncovered a couple of issues in the vendoring script on Windows:

  • the script does not apply an encoding when opening the files to vendor, and so it chocks on Unicode characters. This is because without an encoding specified, Python tries to open the file in the default codepage for the system (codepage 1252 in my case), which doesn't have enough spaces for all the Unicode characters. Specifying an encoding when opening and then writing the file seems to work (see L61 and L75)
  • the script broke trying to delete a folder that didn't exist. Bypassing this error seems to fix this (see L20-23)
  • the script wouldn't apply the patches. The message displayed complained of trailing whitespace. This seems to relay on the system's git command, so this may be a git configuration issue or a line ending issue. I applied the patches I needed manually.

Because of these errors, I won't submit a PR, but it should be as simple as updating setuptools to v34.3.0 or newer.

@jaraco
Copy link
Member

jaraco commented Mar 3, 2017

I'm pretty sure this is a duplicate of #4216

@MinchinWeb
Copy link
Author

MinchinWeb commented Mar 5, 2017

@jaraco Yes, the two look similar. However, in this case, I am trying to install a namespace-d package (minchin.releaser) which depends on another namespace-d package in the same namespace (minchin.text).

@xavfernandez
Copy link
Member

Closing this one as duplicate, no need to keep both open.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

3 participants