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

7.1.2 Update to asyncclick breaks github install of python-kasa #106

Closed
BuongiornoTexas opened this issue Oct 3, 2020 · 7 comments
Closed

Comments

@BuongiornoTexas
Copy link
Contributor

I've just installed the latest master python-kasa in clean environment on Windows using pip install git+https://github.com/python-kasa/python-kasa.git, which installs asyncclick 7.1.2 (consistent with pyproject.toml (^7), but not poetry.lock (7.0.9)).

When I run kasa, I get the following import error:

    from ._winconsole import _get_windows_console_stream, _wrap_std_stream
ImportError: cannot import name '_wrap_std_stream' from 'asyncclick._winconsole' (d:\python envs\kasatest\lib\site-packages\asyncclick\_winconsole.py)

As a short term fix, I've reverted to 7.0.9 by using pip install asyncclick==7.0.9.

Isssue #8 for asyncclick covers the same problem - I'm not sure that the fix is relevant though.

I presume this is due to pyproject.toml taking precedence over poetry.lock - as I haven't got to grips with recent changes to installation methods, I don't have any useful suggestions for a proper fix (unless it is as simple as updating pyproject.toml?).

@BuongiornoTexas BuongiornoTexas changed the title 7.1.2 Update to asyncclick breaks github install of python 7.1.2 Update to asyncclick breaks github install of python-kasa Oct 3, 2020
@rytilahti
Copy link
Member

Could you please add the complete stack trace to the description?

The poetry.lock should actually take precedence over pyproject.toml, that's the reason for the locking after all.

@BuongiornoTexas
Copy link
Contributor Author

Here is trace from running kasa at the command line:

Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\Python Envs\kasatest\Scripts\kasa.exe\__main__.py", line 4, in <module>
  File "d:\python envs\kasatest\lib\site-packages\kasa\cli.py", line 8, in <module>
    import asyncclick as click
  File "d:\python envs\kasatest\lib\site-packages\asyncclick\__init__.py", line 7, in <module>
    from .core import Argument
  File "d:\python envs\kasatest\lib\site-packages\asyncclick\core.py", line 18, in <module>
    from ._compat import isidentifier
  File "d:\python envs\kasatest\lib\site-packages\asyncclick\_compat.py", line 540, in <module>
    from ._winconsole import _get_windows_console_stream, _wrap_std_stream
ImportError: cannot import name '_wrap_std_stream' from 'asyncclick._winconsole' (d:\python envs\kasatest\lib\site-packages\asyncclick\_winconsole.py)

@BuongiornoTexas
Copy link
Contributor Author

And here is information provided during the python-kasa install, which installs asyncclick 7.1.2.1. This is where the problem seems to arise (and may be down to my misunderstanding how to use pip to do a git install).

Collecting git+https://github.com/python-kasa/python-kasa.git
  Cloning https://github.com/python-kasa/python-kasa.git to c:\users\XXXX\appdata\local\temp\pip-req-build-ybptqbjt
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting importlib-metadata
  Using cached importlib_metadata-2.0.0-py2.py3-none-any.whl (31 kB)
Collecting asyncclick<8,>=7
  Using cached asyncclick-7.1.2.1.tar.gz (371 kB)
Collecting zipp>=0.5
  Using cached zipp-3.3.0-py3-none-any.whl (5.3 kB)
Collecting anyio>=2
  Using cached anyio-2.0.2-py3-none-any.whl (62 kB)
Collecting sniffio>=1.1
  Using cached sniffio-1.1.0-py3-none-any.whl (4.5 kB)
Collecting typing-extensions; python_version < "3.8"
  Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting idna>=2.8
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Using legacy 'setup.py install' for asyncclick, since package 'wheel' is not installed.
Building wheels for collected packages: python-kasa
  Building wheel for python-kasa (PEP 517) ... done
  Created wheel for python-kasa: filename=python_kasa-0.4.0.dev1-py3-none-any.whl size=77650 sha256=0acc146ef1dbebd313ced051bb78ec9e82e22069e42fcfe08f253c3f375f5aa7
  Stored in directory: C:\Users\XXXX\AppData\Local\Temp\pip-ephem-wheel-cache-kpksn47w\wheels\0e\3a\f5\cd5d8bb570b9859a2bc2494399225fdd4b5d8402b9ac5d1238
Successfully built python-kasa
Installing collected packages: zipp, importlib-metadata, sniffio, typing-extensions, idna, anyio, asyncclick, python-kasa
    Running setup.py install for asyncclick ... done
Successfully installed anyio-2.0.2 asyncclick-7.1.2.1 idna-2.10 importlib-metadata-2.0.0 python-kasa-0.4.0.dev1 sniffio-1.1.0 typing-extensions-3.7.4.3 zipp-3.3.0

@rytilahti
Copy link
Member

Considering that it works with 7.0.9, it feels like this were a regression in asyncclick. I tried to do some git log analysis to see what could have caused it, but couldn't find anything useful. https://github.com/python-trio/asyncclick/blob/master/src/click/_winconsole.py is the file and it has no _wrap_std_stream nor any "glob imports" (from X import *), so I have no idea what's wrong.

Anyway, this is not really something we can handle in this repository, so could you please open a new issue in asyncclick's repository describing what you described here, and let's hope it'll get fixed at some point?

@BuongiornoTexas
Copy link
Contributor Author

Will do - I'll close this when I file the new issue.

@smurfix
Copy link

smurfix commented Oct 10, 2020

Solved, please upgrade asyncclick to 7.1.2.2.

@BuongiornoTexas
Copy link
Contributor Author

Closed by python-trio/asyncclick#8.

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

3 participants