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

_NamespacePath object has no attribute sort (31.0.0) #885

Closed
jkbbwr opened this Issue Dec 12, 2016 · 72 comments

Comments

Projects
None yet
@jkbbwr

jkbbwr commented Dec 12, 2016

When pip installing a package that shares a namespace it fails out on 31.0.0 but installs fine on 28.8.0

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.5/site-packages/setuptools/__init__.py", line 10, in <module>
        from setuptools.extern.six.moves import filter, filterfalse, map
      File "/usr/lib/python3.5/site-packages/setuptools/extern/__init__.py", line 1, in <module>
        from pkg_resources.extern import VendorImporter
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3015, in <module>
        @_call_aside
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2999, in _call_aside
        f(*args, **kwargs)
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3043, in _initialize_master_working_set
        for dist in working_set
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3043, in <genexpr>
        for dist in working_set
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2573, in activate
        declare_namespace(pkg)
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2147, in declare_namespace
        _handle_ns(packageName, path_item)
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2087, in _handle_ns
        _rebuild_mod_path(path, packageName, module)
      File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2116, in _rebuild_mod_path
        orig_path.sort(key=position_in_sys_path)
    AttributeError: '_NamespacePath' object has no attribute 'sort'
@tseaver

This comment has been minimized.

Contributor

tseaver commented Dec 12, 2016

From what I can tell, this is a 3.5-only failure.

@hciudad

This comment has been minimized.

hciudad commented Dec 12, 2016

I can trigger the error just by importing setuptools. However, when I do it a second time, it imports fine. So, if I do something like this, the install succeeds.

try:
    from setuptools import setup, find_packages
except AttributeError:
    from setuptools import setup, find_packages

jaraco added a commit that referenced this issue Dec 13, 2016

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 13, 2016

I tried adding a test to capture the failure, but the test is passing. So to some extent it's working. Why is the test working but your package not?

@tseaver

This comment has been minimized.

Contributor

tseaver commented Dec 13, 2016

@jaraco The bug happens trying to import setuptools/pkg_resources in an environment where a namespace package is installed, but where there is more than one directory in the path of the namespace package (e.g., one package in a "development install" vs. dependencies installed into site-packages).

In @jkbbwr's case above, what would cause zope.__path__ to be an instance of _NamespacePath rather than the plain list that the code in pkg_resources._rebuild_mod_path clearly expects? That class appears only to be instantiated by the stdlib's import machinery under Python 3.5+:

  • importlib._bootstrap_external._NamespaceLoader.__init__
  • importlib._bootstrap_external.PathFinder.find_spec.

As a hackaround, one might add monkeypatch a sort method onto importlib._bootstrap_external._NamespacePath. ;)

jaraco added a commit that referenced this issue Dec 13, 2016

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 13, 2016

I've just pushed another commit, this one in the test_develop module. This test does as you describe, installs one package into a simulated site-packages (myns.pkgA) and another using develop (myns.pkgB). Both packages are importable and pkg_resources can still be imported as well.

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 13, 2016

what would cause zope.__path__ to be an instance of _NamespacePath rather than the plain list that the code in pkg_resources._rebuild_mod_path clearly expects?

It's almost certainly the fact that the new -nspkg.pth files are using importlib.util.module_from_spec to initialize the module (and thus setting __path__).

I continue to be unable to replicate the error indicated. Here's one such attempt:

$ python -m venv ~/.envs/issue885                      
$ ~/.envs/issue885/bin/pip install -U setuptools       
Collecting setuptools
  Using cached setuptools-31.0.0-py2.py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
      Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-31.0.0
$ ~/.envs/issue885/bin/pip install -U zope.component
Collecting zope.component
  Using cached zope.component-4.3.0.tar.gz
Requirement already up-to-date: setuptools in /Users/jaraco/.envs/issue885/lib/python3.6/site-packages (from zope.component)
Collecting zope.interface>=4.1.0 (from zope.component)
  Using cached zope.interface-4.3.2.tar.gz
Collecting zope.event (from zope.component)
  Using cached zope.event-4.2.0.tar.gz
Installing collected packages: zope.interface, zope.event, zope.component
  Running setup.py install for zope.interface ... done
  Running setup.py install for zope.event ... done
  Running setup.py install for zope.component ... done
Successfully installed zope.component-4.3.0 zope.event-4.2.0 zope.interface-4.3.2
$ pwd
/Users/jaraco/zope.interface
$ ~/.envs/issue885/bin/pip install -e .             
Obtaining file:///Users/jaraco/zope.interface
Requirement already satisfied: setuptools in /Users/jaraco/.envs/issue885/lib/python3.6/site-packages (from zope.interface==4.3.3.dev0)
Installing collected packages: zope.interface
  Found existing installation: zope.interface 4.3.2
    Uninstalling zope.interface-4.3.2:
      Successfully uninstalled zope.interface-4.3.2
  Running setup.py develop for zope.interface
Successfully installed zope.interface
$ cd ~
$ ~/.envs/issue885/bin/python
Python 3.6.0rc1 (v3.6.0rc1:29a273eee9a5, Dec  6 2016, 16:24:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> import zope.interface
>>> zope.interface.__file__
'/Users/jaraco/zope.interface/src/zope/interface/__init__.py'
>>> zope.__path__
_NamespacePath(['/Users/jaraco/.envs/issue885/lib/python3.6/site-packages/zope', '/Users/jaraco/zope.interface/src/zope'])

What steps do you have to invoke to get a virtual environment that replicates this issue?

@theacodes

This comment has been minimized.

Member

theacodes commented Dec 13, 2016

This is also occurring consistently over at https://github.com/GoogleCloudPlatform/google-auth-library-python in our lint tox (sample failure).

It'll also occur in other tox environment if you run them twice. The first time tox creates the environment from scratch, but when it tries to re-use an existing environment it 'splodes.

Let me know if I can do anything else to help reproduce/fix this.

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 13, 2016

Excellent. That does help. I simply checked out GoogleCloudPlatform/google-auth-library-python and ran tox -e lint and that replicated the failure. I should be able to distill the issue from there. Thanks.

@theacodes

This comment has been minimized.

Member

theacodes commented Dec 13, 2016

Awesome. 👍

@warsaw

This comment has been minimized.

warsaw commented Dec 13, 2016

I just hit this same problem. I can craft a reproducer if you need it. I see it when running tox on a py35 environment with flufl.i18n, which uses flufl.testing, both of which are namespace packages. I need to commit and push a fix to the latter for you to reproduce it. Let me know if you need it, but it would be really great to get a quick fix released for this bug.

@warsaw

This comment has been minimized.

warsaw commented Dec 13, 2016

FWIW, it affects Python 3.6 also; I can't test 3.4.

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 14, 2016

Working with the google-auth library, I find that if I set usedevelop = True in the tox settings, the issue doesn't occur. This behavior indicates to me that the issue lies in part with a package which is duplicately installed. In any case, I was able to use it to create a test case that captures the error.

@warsaw

This comment has been minimized.

warsaw commented Dec 14, 2016

@jaraco That's interesting because I have usedevelop=True and it happens for me. But at least you ahve a reproducer. :)

@theacodes

This comment has been minimized.

Member

theacodes commented Dec 14, 2016

jaraco added a commit that referenced this issue Dec 14, 2016

@jaraco jaraco closed this in d9125bc Dec 14, 2016

jaraco added a commit that referenced this issue Dec 14, 2016

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 14, 2016

@jonparrott: The whole point of v31.0.0 and the fix for #250 is that 'develop' and namespace packages should work well together now, so I hope you can drop that assumption soon.

@warsaw: The fix is in place. Can you update setuptools in your test environment to git+https://github.com/pypa/setuptools@3943cf4 and see if that addresses the manifestation you encountered?

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 14, 2016

Well hell. The fix works for Python 3.6 but not for Python 3.5. Thanks to Travis for catching that.

jaraco added a commit that referenced this issue Dec 14, 2016

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 14, 2016

Okay. Yet another version to test against, this one passes on Python 3.5. git+https://github.com/pypa/setuptools@7c0c39ef. I'm not happy with the fix, but it passes the tests.

@warsaw

This comment has been minimized.

warsaw commented Dec 14, 2016

@jaraco I get another bug now:

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from setuptools import setup, find_packages
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/setuptools/__init__.py", line 10, in <module>
    from setuptools.extern.six.moves import filter, filterfalse, map
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/setuptools/extern/__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3015, in <module>
    @_call_aside
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2999, in _call_aside
    f(*args, **kwargs)
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3043, in _initialize_master_working_set
    for dist in working_set
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3043, in <genexpr>
    for dist in working_set
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2573, in activate
    declare_namespace(pkg)
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2147, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2087, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/home/barry/projects/flufl/i18n/.tox/py35-nocov/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2116, in _rebuild_mod_path
    orig_path[:] = sorted(orig_path, key=position_in_sys_path)
TypeError: '_NamespacePath' object does not support item assignment

@jaraco jaraco changed the title from 31.0.0 Fails with namespace packages to _NamespacePath object has no attribute sort (31.0.0) Dec 14, 2016

@jkbbwr

This comment has been minimized.

jkbbwr commented Feb 2, 2018

How is this still a problem after over a year later.

@serfaniane

This comment has been minimized.

serfaniane commented Feb 13, 2018

I just encountered the same problem. I've tried all the solutions given on this page, but the problem still persists. This is what I see:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.5/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python3.5/dist-packages/stevedore/__init__.py", line 11, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python3.5/dist-packages/stevedore/extension.py", line 17, in <module>
    import pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
    callback(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.5/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
    from stevedore import ExtensionManager
  File "/usr/local/lib/python3.5/dist-packages/stevedore/__init__.py", line 11, in <module>
    from .extension import ExtensionManager
  File "/usr/local/lib/python3.5/dist-packages/stevedore/extension.py", line 17, in <module>
    import pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
    callback(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
@jaraco

This comment has been minimized.

Member

jaraco commented Feb 13, 2018

You probably have an older setuptools installed to /usr/lib/python3/dist-packages. You'll want to remove all traces of setuptools and pkg_resources from there and then reinstall a late version of setuptools with pip.

@lechatthecat

This comment has been minimized.

lechatthecat commented Feb 23, 2018

Same issue. I am using python3.5

@jaraco

This comment has been minimized.

Member

jaraco commented Feb 23, 2018

I'm locking the discussion on this issue. The code was changed such that this error won't occur on setuptools 31.0.1 and later. If it's happening, it's because you have an old setuptools somewhere (possibly vendored in pip or maybe latent from another cause). There's nothing more this project can do about it at this time.

@jaraco

This comment has been minimized.

Member

jaraco commented Apr 14, 2018

I've unlocked the conversation here. Others have pointed out that there are other ways users can encounter this issue, so might as well make this issue a wiki about the ways people can encounter the issue and how they worked around it.

@dimon777

This comment has been minimized.

dimon777 commented Apr 22, 2018

It is still a problem on Ubuntu 16.04. It is easy to simulate it with
apt install python3-pip
apt install glances
then trying to run glances gives above error. After reading all these long threads it is not clear how this has to be fixed. I also noticed apt, pip and pip3 all install packages into different locations. So far I have:

/usr/lib/python/python2.7/
/usr/lib/python/python3/
/usr/lib/python/python3.5/

/usr/local/lib/python2.7/
/usr/local/lib/python3.5/

Why is there such a mess after one is using standard routines to install packages (either apt or pip) ?!

@jaraco

This comment has been minimized.

Member

jaraco commented Apr 22, 2018

I'm unable to replicate your findings:

$ echo "from ubuntu:xenial\nrun apt update\nrun apt install -y python3-pip\nrun apt install -y glances\nRUN glances -V" | docker build -
Sending build context to Docker daemon  2.048kB
Step 1/5 : from ubuntu:xenial
 ---> c9d990395902
Step 2/5 : run apt update
 ---> Using cache
 ---> 0dd53993e06c
Step 3/5 : run apt install -y python3-pip
 ---> Using cache
 ---> ead4e3396444
Step 4/5 : run apt install -y glances
 ---> Using cache
 ---> 705a7a53d0ee
Step 5/5 : RUN glances -V
 ---> Running in 1c737e6faf2d
Glances v2.3 with psutil v3.4.2
Removing intermediate container 1c737e6faf2d
 ---> d46ab038485d
Successfully built d46ab038485d

(also running simply glances in an interactive terminal works).

Why is there such a mess?

Setuptools fixed this in 31.0.1. Pip incorporated the fix in 10.0.0b1. venv still pulls in older setuptools versions. Downstream package managers may not have pulled in these fixes.

@rafis

This comment has been minimized.

rafis commented May 1, 2018

Maybe this another kind of this issue:

$ pip3 install --upgrade setuptools
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
    __import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
    from pip.exceptions import InstallationError, CommandError, PipError
  File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
    from pip._vendor.six import iteritems
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2927, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2913, in _call_aside
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 956, in subscribe
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in <lambda>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2515, in activate
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2097, in declare_namespace
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2047, in _handle_ns
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'
@function1983

This comment has been minimized.

function1983 commented May 9, 2018

Upgrade doesn't help but uninstall setuptools then reinstall fixed it for me.

I am using Ubuntu 16.04.03 in virtualenv.
What doesn't work:

pip3 install --upgrade setuptools
Requirement already up-to-date: setuptools in ./lib/python3.5/site-packages (39.1.0)

pip install 'package'
.............
AttributeError: '_NamespacePath' object has no attribute 'sort'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fukuqph1/googleapis-common-protos/

What works:

pip uninstall setuptools
Uninstalling setuptools-39.1.0:
Would remove:
~/bin/easy_install
~/bin/easy_install-3.5
~/bin/easy_install-3.6
~/lib/python3.5/site-packages/easy_install.py
~/lib/python3.5/site-packages/pkg_resources/*
~/lib/python3.5/site-packages/setuptools-39.1.0.dist-info/*
~/lib/python3.5/site-packages/setuptools/*
Proceed (y/n)? y
Successfully uninstalled setuptools-39.1.0

pip install setuptools
Requirement already satisfied: setuptools in ./lib/python3.5/site-packages/setuptools-39.1.0-py3.5.egg (39.1.0

pip install 'package'
.....
Successfully installed cachecontrol-0.12.4 cachetools-2.0.1....

Hope it helps someone else!
Thanks.

@Belval

This comment has been minimized.

Belval commented May 28, 2018

Still experiencing this issue, fresh virtualenv and setuptools reinstallation did not help.

@AswinVasudevan21

This comment has been minimized.

AswinVasudevan21 commented Jun 18, 2018

@Belval you have a fix for this ? setuptools -39.2.0

@mylons

This comment has been minimized.

mylons commented Jul 19, 2018

I was running into the same issue, when I went to recreate the virtualenv the version of python I was using, 3.5 but it's irrelevant, it was no longer on my system at all! after recreating the virtualenv with a version of python that exists, it works.

lgarithm added a commit to tensorlayer/tensorlayer that referenced this issue Jul 24, 2018

lgarithm added a commit to tensorlayer/tensorlayer that referenced this issue Jul 24, 2018

Transparent distributed model training through TensorLayer GPU Trainer (
#700)

* Add hovorod trainer.

* fix

* working on the mnist tutorial.

* fix build error

* first working demo

* is_fix=True

* working on fixing hao comments

* Fix more hao comments.

* fix

* fix

* add todos

* fix

* fix runtime error

* fix lints

* fix

* Deprecated old distributed APIs.

* check in the script to help users install distributed runner environment.

* wip: validation.

* minor

* fix

* fix

* Add validation

* wip: validation loss.

* validatioin works

* minor

* clean code

* simplify

* improve the APIs

* fix codacy

* install libopenmpi-dev before building docs

* run apt as root

* fix API

* revert openmpi and horovod installation

* format code

* more API tuning.

* more API refine

* rename

* fix lints

* simplify code

* fix code.

* we must guard the use of session after should stop is set.

* fix bug

* test validation.

* Add documentation.

* add more comments.

* minor

* install openmpi and horovod when build doc

* fix yapf errors.

* yapf

* fix installing horovod

* requirements_distributed.txt

* add distributed tp extras_require

* install openmpi when READTHEDOCS=True

* custom_build_ext

* simplify

* fix cmdclass

* try fix

* try fix

* fix import

* fix

* use setup_py_install

* disable codacy for scripts

* disable bandit engine

* add Trainer to autosummary

* autofunction:: Trainer

* fix

* disable codacy for setup.py

* remove Trainer from doc

* add Dockerfile for building docs locally

* disable crazy codary for docker files!

* check in a script to help install cuda 9 and cuDNN 7

* fix

* minor fix

* add cifar10 example for distributed trainer

* change default parameters

* add a log storage option for tensor db.

* add comments

* tensordb

* remove the tensordb example.

* add changelog

* update scripts

* remove tensordb option

* add option for learning rate.

* more comments.

* add an option

* fix logging

* fix .travis.yml

* fix format

* build doc with python 3.6 (pypa/setuptools#885)

* use latest RTD builder

* try fix rtd

* try fix rtd

* use absolute path

* fix SCRIPT_DIR
@gabycperezdias

This comment has been minimized.

gabycperezdias commented Aug 16, 2018

Hi, is there a fix/workaround for this? I am getting the "sort" error even when I try pip3 --version, I also can't uninstall setuptools and/or update it (as some of you suggested).

I am using a mac High Sierra.

@lechatthecat

This comment has been minimized.

lechatthecat commented Aug 16, 2018

Try this workaround:
https://stackoverflow.com/questions/47955397/pip3-error-namespacepath-object-has-no-attribute-sort

Edit line #2121~2122 of this file:
"sudo vim /usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/init.py"

#orig_path.sort(key=position_in_sys_path)
#module.__path__[:] = [_normalize_cached(p) for p in orig_path]
orig_path_t = list(orig_path)
orig_path_t.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]
@gabycperezdias

This comment has been minimized.

gabycperezdias commented Aug 16, 2018

@lechatthecat <3 thank you very much it worked

luomai added a commit to tensorlayer/tensorlayer that referenced this issue Nov 21, 2018

Transparent distributed model training through TensorLayer GPU Trainer (
#700)

* Add hovorod trainer.

* fix

* working on the mnist tutorial.

* fix build error

* first working demo

* is_fix=True

* working on fixing hao comments

* Fix more hao comments.

* fix

* fix

* add todos

* fix

* fix runtime error

* fix lints

* fix

* Deprecated old distributed APIs.

* check in the script to help users install distributed runner environment.

* wip: validation.

* minor

* fix

* fix

* Add validation

* wip: validation loss.

* validatioin works

* minor

* clean code

* simplify

* improve the APIs

* fix codacy

* install libopenmpi-dev before building docs

* run apt as root

* fix API

* revert openmpi and horovod installation

* format code

* more API tuning.

* more API refine

* rename

* fix lints

* simplify code

* fix code.

* we must guard the use of session after should stop is set.

* fix bug

* test validation.

* Add documentation.

* add more comments.

* minor

* install openmpi and horovod when build doc

* fix yapf errors.

* yapf

* fix installing horovod

* requirements_distributed.txt

* add distributed tp extras_require

* install openmpi when READTHEDOCS=True

* custom_build_ext

* simplify

* fix cmdclass

* try fix

* try fix

* fix import

* fix

* use setup_py_install

* disable codacy for scripts

* disable bandit engine

* add Trainer to autosummary

* autofunction:: Trainer

* fix

* disable codacy for setup.py

* remove Trainer from doc

* add Dockerfile for building docs locally

* disable crazy codary for docker files!

* check in a script to help install cuda 9 and cuDNN 7

* fix

* minor fix

* add cifar10 example for distributed trainer

* change default parameters

* add a log storage option for tensor db.

* add comments

* tensordb

* remove the tensordb example.

* add changelog

* update scripts

* remove tensordb option

* add option for learning rate.

* more comments.

* add an option

* fix logging

* fix .travis.yml

* fix format

* build doc with python 3.6 (pypa/setuptools#885)

* use latest RTD builder

* try fix rtd

* try fix rtd

* use absolute path

* fix SCRIPT_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment