bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.23k stars 54 forks source link

[BUG] pip install hangs on windows. #25

Closed Klupamos closed 2 years ago

Klupamos commented 2 years ago

Describe the bug As the title says, when Installing on windows with python3.exe -m pip -vv install pytermgui the installation hangs.

To Reproduce

  1. run python3.exe -m pip -vv install pytermgui
  2. wait

Expected behavior pytermgui to be installed.

Screenshots

Collecting pytermgui
  Created temporary directory: C:\Users\MyUser\AppData\Local\Temp\pip-unpack-ijudf3ut
  Looking up "https://files.pythonhosted.org/packages/c9/ce/2e249bae470c52429b1c93b5013db52f6c7105a82054ce7e88df08494bd8/pytermgui-2.0.0.tar.gz" in the cache
  Current age based on date: 2986
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 2986
  Using cached pytermgui-2.0.0.tar.gz (62 kB)
  Added pytermgui from https://files.pythonhosted.org/packages/c9/ce/2e249bae470c52429b1c93b5013db52f6c7105a82054ce7e88df08494bd8/pytermgui-2.0.0.tar.gz#sha256=6cdd4636278bf8ef008508a9327576726f2caaaf19f694a855e3b475b1681dc3 to build tracker 'C:\\Users\\MyUser\\AppData\\Local\\Temp\\pip-req-tracker-eznv_81d'
  Running setup.py (path:C:\Users\MyUser\AppData\Local\Temp\pip-install-a8zu6svx\pytermgui_981a92d1aa834d8086c13fa048af84be\setup.py) egg_info for package pytermgui
  Created temporary directory: C:\Users\MyUser\AppData\Local\Temp\pip-pip-egg-info-4hm9lmls
  Running command python setup.py egg_info

System information

Possible cause After force closing the installation (Ctrl + C) the traceback indicates the installation is waiting for userinteraction str = proc.stdout.readline()


Exception information:
Traceback (most recent call last):
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 164, in exc_logging_wrapper
    status = run_func(*args)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\commands\install.py", line 338, in run
    requirement_set = resolver.resolve(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 482, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 349, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates:
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
    return bool(self._sequence)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
    return any(self)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
    candidate = func()
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 201, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 281, in __init__
    super().__init__(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
    self.dist = self._prepare()
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 225, in _prepare
    dist = self._prepare_distribution()
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 292, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 482, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 546, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 58, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\distributions\sdist.py", line 49, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\req\req_install.py", line 561, in prepare_metadata
    self.metadata_directory = generate_metadata_legacy(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\operations\build\metadata_legacy.py", line 59, in generate_metadata
    call_subprocess(
  File "c:\users\MyUser\pycharmprojects\tui_project\venv\lib\site-packages\pip\_internal\utils\subprocess.py", line 204, in call_subprocess
    line: str = proc.stdout.readline()
  File "S:\Programs\Python310\lib\encodings\cp1252.py", line 22, in decode
    def decode(self, input, final=False):
KeyboardInterrupt
Removed pytermgui from https://files.pythonhosted.org/packages/c9/ce/2e249bae470c52429b1c93b5013db52f6c7105a82054ce7e88df08494bd8/pytermgui-2.0.0.tar.gz#sha256=6cdd4636278bf8ef008508a9327576726f2caaaf19f694a855e3b475b1681dc3 from build tracker 'C:\\Users\\MyUser\\AppData\\Local\\Temp\\pip-req-tracker-eznv_81d'
Removed build tracker: 'C:\\Users\\MyUser\\AppData\\Local\\Temp\\pip-req-tracker-eznv_81d''```
bczsalba commented 2 years ago

Does this occur for other programs too? None of the code i the traceback is PyTermGUI related as far as I can see. Everything seems to be within pip internals. Other users have confirmed the project to work just fine on Windows, so I don't see what the issue could be.

Klupamos commented 2 years ago

Other programs install just fine. Including pytermgui==1.1.0. just fails on pytermgui==2.0.0

javad94 commented 2 years ago

I too experienced this issue on windows and installing just hanging. image

bczsalba commented 2 years ago

That's really weird. I have no clue what piece of code could've cause this issue between the versions, since there was no code in the traceback from the library. I don't have a Windows machine with me until late next week, so I can't really test it myself for the time being. Until then, I'll put this into Help needed mode, and hope someone can figure it out.

Sorry for the inconvenience!

AntonEvmenenko commented 2 years ago

Just faced exactly the same problem as the topic starter.

bczsalba commented 2 years ago

I've now narrowed it down to #19, but I am still looking into ways to get around it.

bczsalba commented 2 years ago

So for the time being PyTermGUI won't support window resize events. It is possible to do using the Windows API, but since I don't really have a development machine I won't be able to include it for now.

javad94 commented 2 years ago

@bczsalba, can you publish a new release?

bczsalba commented 2 years ago

I will either today or tomorrow, depends on how much time I end up having.

javad94 commented 2 years ago

@bczsalba, no problem, thank you.

bczsalba commented 2 years ago

@javad94 Just pushed it!

javad94 commented 2 years ago

@bczsalba Thanks man. Not available in PyPI yet to test it.

bczsalba commented 2 years ago

Yeah, had some issues with twine, but it should be up now. Apologies!

javad94 commented 2 years ago

Yeah, had some issues with twine, but it should be up now. Apologies!

No problem, Thank you. I installed it and got this error: image

bczsalba commented 2 years ago

Yeah, just realized those keys are missing. Will fix soon, either by silencing the key error or figuring out what the keys are.

bczsalba commented 2 years ago

That part should be fixed with the newest commit. I didn't get the error on my machine when I was messing around yesterday, so I really don't know if other things will also break.

javad94 commented 2 years ago

That part should be fixed with the newest commit. I didn't get the error on my machine when I was messing around yesterday, so I really don't know if other things will also break.

haven't been released on PyPI yet to check it. You don't have unit tests for such issues?

bczsalba commented 2 years ago

It is one of the weaknesses of the library that we do not have unit tests. It is something I am planning on doing in the hopefully near future, but I am kind of bogged down with other things at the moment so I can't do it now.

haven't been released on PyPI yet to check it.

I am not at home at the moment so I can't do a release. If you're interested, you can install the project using pip install git+https://github.com/bczsalba/PyTermGUI, or if that doesn't work by cloning the repo and running pip install ..

javad94 commented 2 years ago

It is one of the weaknesses of the library that we do not have unit tests. It is something I am planning on doing in the hopefully near future, but I am kind of bogged down with other things at the moment so I can't do it now.

I see. Hope you can do it in the near future.

I am not at home at the moment so I can't do a release. If you're interested, you can install the project using pip install git+https://github.com/bczsalba/PyTermGUI, or if that doesn't work by cloning the repo and running pip install ..

I got an error with: pip install git+https://github.com/bczsalba/PyTermGUI image But it was installed with git clone --depth 1 --branch master https://github.com/bczsalba/PyTermGUI. But now I got an error when running an example code: The code:

import pytermgui as ptg

demo = ptg.Window(
   ptg.Label("[210 bold]Hello world!"),
   ptg.Label(),
   ptg.InputField(prompt="Who are you?"),
   ptg.Label(),
   ptg.Button("Submit!")
)

The error: image

bczsalba commented 2 years ago

Could you check it with the latest commit? Will publish release if it works, just don't really want to have two different versions for the same issue.

javad94 commented 2 years ago

Could you check it with the latest commit? Will publish release if it works, just don't really want to have two different versions for the same issue.

Thanks. It's working now. The only issue I have is that I can't exit the program using ctrl+c.

bczsalba commented 2 years ago

Will try to look into that one as well. Regardless of whether I can fix it I will release a package sometime later today.

bczsalba commented 2 years ago

Alright, version 2.1.1 was just pushed out. It fixed all of the issues you talked about here.

If you run into anything else it would be a bit easier to follow if you raised a new issue.

Thank you for letting me know of these problems!

javad94 commented 2 years ago

Alright, version 2.1.1 was just pushed out. It fixed all of the issues you talked about here.

If you run into anything else it would be a bit easier to follow if you raised a new issue.

Thank you for letting me know of these problems!

Thank you very much. it works exactly as expected right now.