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

after install tornado, pip command didn't worked anymore , even run "pip --version" #3034

Closed
jieYM opened this issue May 26, 2021 · 7 comments

Comments

@jieYM
Copy link

jieYM commented May 26, 2021

$ python3 -m pip --version
Traceback (most recent call last):
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/configuration.py", line 27, in <module>
    from pip._internal.utils.misc import ensure_dir, enum
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 38, in <module>
    from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_vendor/tenacity/__init__.py", line 523, in <module>
    from pip._vendor.tenacity.tornadoweb import TornadoRetrying
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_vendor/tenacity/tornadoweb.py", line 26, in <module>
    class TornadoRetrying(BaseRetrying):
  File "/home/hadoop/miniconda3/envs/py37/lib/python3.7/site-packages/pip/_vendor/tenacity/tornadoweb.py", line 27, in TornadoRetrying
    def __init__(self, sleep=gen.sleep, **kwargs):
AttributeError: module 'tornado.gen' has no attribute 'sleep'
@bdarnell
Copy link
Member

That's very strange. tornado.gen definitely does have an attribute sleep. This is partly a bug in pip - their vendoring is incomplete because this pip._vendor.tenacity package is affected by packages outside of pip (they should either vendor tornado too or more likely edit the vendored copy of tenacity to no longer opportunistically import tornado).

However, that's not the whole story - even though the vendoring is leaky, the sleep attribute should be there and so this error should not occur. Maybe pip is doing something else funny with an import hook? Or maybe it's related to anaconda - I don't use it, but my understanding is that it's a bad idea to mix anaconda/miniconda and pip in the same environment.

@bdarnell
Copy link
Member

Which version of tornado did you install?

@jieYM
Copy link
Author

jieYM commented May 27, 2021

Which version of tornado did you install?

(py37) [hadoop:~]$ python
Python 3.7.0 (default, Oct 9 2018, 10:31:47)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import tornado
tornado.version
'3.2.1'

@bdarnell
Copy link
Member

Ah, that'll do it. Tornado 3.2.1 is quite old and predates the introduction of the tornado.gen.sleep function. This is a bug in pip, which I've filed as pypa/pip#10020. Please upgrade to a more recent version of Tornado if you can; if not you'll have to downgrade to an older version of pip in until this can be fixed.

@jieYM
Copy link
Author

jieYM commented May 27, 2021

Ah, that'll do it. Tornado 3.2.1 is quite old and predates the introduction of the tornado.gen.sleep function. This is a bug in pip, which I've filed as pypa/pip#10020. Please upgrade to a more recent version of Tornado if you can; if not you'll have to downgrade to an older version of pip in until this can be fixed.

Yeah, solve it by remove pip manual and install pip 21.0 by source.

@pertetotale
Copy link

no need to reinstall py3.8 if you got a 3.9 version locally
pip reinstall, or manual install didn't work, jupyter was also death,
so I copied my pip 3.9 folder, and after that I only had to reinstall some modules...

Now jup notebook and lab works again

@Eeyhan
Copy link

Eeyhan commented Jun 22, 2021

I just solve,If you want to solve this problem quickly,pull down the git source code for Tornado>=4.0 and above and install it with the command:
python setup.py install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants