language_tool_python icon indicating copy to clipboard operation
language_tool_python copied to clipboard

Close don't work

Open jegor377 opened this issue 11 months ago • 5 comments

Hi! I'm new to this library. I did exactly this:

>>> import language_tool_python
>>> tool = language_tool_python.LanguageTool('en-US')
>>> text = 'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
>>> matches = tool.check(text)
>>> len(matches)
2
...
>>> tool.close() # Call `close()` to shut off the server when you're done.

but the close method is stuck forever on Windows 11. I use Anaconda, Python 3.11.10.

This is my conda env:

name: ML
channels:
  - pytorch
  - conda-forge
  - nvidia
  - defaults
dependencies:
  - aiohappyeyeballs=2.4.0=py311haa95532_0
  - aiohttp=3.10.5=py311h827c3e9_0
  - aiosignal=1.2.0=pyhd3eb1b0_0
  - anyio=4.2.0=py311haa95532_0
  - argon2-cffi=21.3.0=pyhd3eb1b0_0
  - argon2-cffi-bindings=21.2.0=py311h2bbff1b_0
  - arrow-cpp=16.1.0=h7cd61ee_0
  - asttokens=2.0.5=pyhd3eb1b0_0
  - async-lru=2.0.4=py311haa95532_0
  - attrs=23.1.0=py311haa95532_0
  - aws-c-auth=0.6.19=h2bbff1b_0
  - aws-c-cal=0.5.20=h2bbff1b_0
  - aws-c-common=0.8.5=h2bbff1b_0
  - aws-c-compression=0.2.16=h2bbff1b_0
  - aws-c-event-stream=0.2.15=hd77b12b_0
  - aws-c-http=0.6.25=h2bbff1b_0
  - aws-c-io=0.13.10=h2bbff1b_0
  - aws-c-mqtt=0.7.13=h2bbff1b_0
  - aws-c-s3=0.1.51=h2bbff1b_0
  - aws-c-sdkutils=0.1.6=h2bbff1b_0
  - aws-checksums=0.1.13=h2bbff1b_0
  - aws-crt-cpp=0.18.16=hd77b12b_0
  - aws-sdk-cpp=1.10.55=hd77b12b_0
  - babel=2.11.0=py311haa95532_0
  - beautifulsoup4=4.12.3=py311haa95532_0
  - blas=1.0=mkl
  - bleach=4.1.0=pyhd3eb1b0_0
  - boost-cpp=1.82.0=h59b6b97_2
  - bottleneck=1.3.7=py311hd7041d2_0
  - brotli-python=1.0.9=py311hd77b12b_8
  - bzip2=1.0.8=h2bbff1b_6
  - c-ares=1.19.1=h2bbff1b_0
  - ca-certificates=2024.9.24=haa95532_0
  - cairo=1.16.0=haedb8bc_5
  - certifi=2024.8.30=py311haa95532_0
  - cffi=1.17.1=py311h827c3e9_0
  - charset-normalizer=3.3.2=pyhd3eb1b0_0
  - colorama=0.4.6=py311haa95532_0
  - comm=0.2.1=py311haa95532_0
  - cuda-cccl=12.6.77=0
  - cuda-cccl_win-64=12.6.77=0
  - cuda-cudart=12.4.127=0
  - cuda-cudart-dev=12.4.127=0
  - cuda-cupti=12.4.127=0
  - cuda-libraries=12.4.0=0
  - cuda-libraries-dev=12.4.0=0
  - cuda-nvrtc=12.4.127=0
  - cuda-nvrtc-dev=12.4.127=0
  - cuda-nvtx=12.4.127=0
  - cuda-opencl=12.6.77=0
  - cuda-opencl-dev=12.6.77=0
  - cuda-profiler-api=12.6.77=0
  - cuda-runtime=12.4.0=0
  - cuda-version=12.6=3
  - datasets=2.19.1=py311haa95532_0
  - debugpy=1.6.7=py311hd77b12b_0
  - decorator=5.1.1=pyhd3eb1b0_0
  - defusedxml=0.7.1=pyhd3eb1b0_0
  - eigen=3.4.0=h59b6b97_0
  - executing=0.8.3=pyhd3eb1b0_0
  - expat=2.6.3=h5da7b33_0
  - filelock=3.13.1=py311haa95532_0
  - fontconfig=2.14.1=hb33846d_3
  - freetype=2.12.1=ha860e81_0
  - frozenlist=1.4.0=py311h2bbff1b_0
  - fsspec=2024.3.1=py311haa95532_0
  - gflags=2.2.2=hd77b12b_1
  - glib=2.78.4=hd77b12b_0
  - glib-tools=2.78.4=hd77b12b_0
  - glog=0.5.0=hd77b12b_1
  - gmpy2=2.1.2=py311h7f96b67_0
  - graphite2=1.3.14=hd77b12b_1
  - gst-plugins-base=1.22.3=hfc3ed34_1
  - gstreamer=1.22.3=h1779075_1
  - h11=0.14.0=py311haa95532_0
  - harfbuzz=4.3.0=hb646838_2
  - hdf5=1.12.1=h51c971a_3
  - httpcore=1.0.2=py311haa95532_0
  - httpx=0.27.0=py311haa95532_0
  - huggingface_hub=0.24.6=py311haa95532_0
  - icc_rt=2022.1.0=h6049295_2
  - icu=73.1=h6c2663c_0
  - idna=3.7=py311haa95532_0
  - intel-openmp=2023.1.0=h59b6b97_46320
  - ipykernel=6.28.0=py311haa95532_0
  - ipython=8.27.0=py311haa95532_0
  - jedi=0.19.1=py311haa95532_0
  - jinja2=3.1.4=py311haa95532_0
  - jpeg=9e=h827c3e9_3
  - json5=0.9.6=pyhd3eb1b0_0
  - jsonschema=4.19.2=py311haa95532_0
  - jsonschema-specifications=2023.7.1=py311haa95532_0
  - jupyter-lsp=2.2.0=py311haa95532_0
  - jupyter_client=8.6.0=py311haa95532_0
  - jupyter_core=5.7.2=py311haa95532_0
  - jupyter_events=0.10.0=py311haa95532_0
  - jupyter_server=2.14.1=py311haa95532_0
  - jupyter_server_terminals=0.4.4=py311haa95532_1
  - jupyterlab=4.2.5=py311haa95532_0
  - jupyterlab_pygments=0.1.2=py_0
  - jupyterlab_server=2.27.3=py311haa95532_0
  - krb5=1.20.1=h5b6d351_0
  - lcms2=2.12=h83e58a3_0
  - lerc=3.0=hd77b12b_0
  - libabseil=20240116.2=cxx17_h5da7b33_0
  - libboost=1.82.0=h3399ecb_2
  - libbrotlicommon=1.0.9=h2bbff1b_8
  - libbrotlidec=1.0.9=h2bbff1b_8
  - libbrotlienc=1.0.9=h2bbff1b_8
  - libclang=14.0.6=default_hb5a9fac_1
  - libclang13=14.0.6=default_h8e68704_1
  - libcublas=12.4.2.65=0
  - libcublas-dev=12.4.2.65=0
  - libcufft=11.2.0.44=0
  - libcufft-dev=11.2.0.44=0
  - libcurand=10.3.7.77=0
  - libcurand-dev=10.3.7.77=0
  - libcurl=8.9.1=h0416ee5_0
  - libcusolver=11.6.0.99=0
  - libcusolver-dev=11.6.0.99=0
  - libcusparse=12.3.0.142=0
  - libcusparse-dev=12.3.0.142=0
  - libdeflate=1.17=h2bbff1b_1
  - libevent=2.1.12=h56d1f94_1
  - libffi=3.4.4=hd77b12b_1
  - libglib=2.78.4=ha17d25a_0
  - libgrpc=1.62.2=hf25190f_0
  - libiconv=1.16=h2bbff1b_3
  - libjpeg-turbo=2.0.0=h196d8e1_0
  - libnpp=12.2.5.2=0
  - libnpp-dev=12.2.5.2=0
  - libnvfatbin=12.6.77=0
  - libnvfatbin-dev=12.6.77=0
  - libnvjitlink=12.4.99=0
  - libnvjitlink-dev=12.4.99=0
  - libnvjpeg=12.3.1.89=0
  - libnvjpeg-dev=12.3.1.89=0
  - libogg=1.3.5=h2bbff1b_1
  - libpng=1.6.39=h8cc25b3_0
  - libpq=12.17=h906ac69_0
  - libprotobuf=4.25.3=hf2fb9eb_0
  - libsodium=1.0.18=h62dcd97_0
  - libssh2=1.11.0=h291bd65_0
  - libthrift=0.15.0=h4364b78_2
  - libtiff=4.5.1=hd77b12b_0
  - libuv=1.48.0=h827c3e9_0
  - libvorbis=1.3.7=he774522_0
  - libwebp-base=1.3.2=h2bbff1b_0
  - libxml2=2.13.1=h24da03e_2
  - lz4-c=1.9.4=h2bbff1b_1
  - markupsafe=2.1.3=py311h2bbff1b_0
  - matplotlib-inline=0.1.6=py311haa95532_0
  - mistune=2.0.4=py311haa95532_0
  - mkl=2023.1.0=h6b88ed4_46358
  - mkl-service=2.4.0=py311h2bbff1b_1
  - mkl_fft=1.3.10=py311h827c3e9_0
  - mkl_random=1.2.7=py311hea22821_0
  - mpc=1.1.0=h7edee0f_1
  - mpfr=4.0.2=h62dcd97_1
  - mpir=3.0.0=hec2e145_1
  - mpmath=1.3.0=py311haa95532_0
  - multidict=6.0.4=py311h2bbff1b_0
  - nbclient=0.8.0=py311haa95532_0
  - nbconvert=7.16.4=py311haa95532_0
  - nbformat=5.10.4=py311haa95532_0
  - nest-asyncio=1.6.0=py311haa95532_0
  - networkx=3.2.1=py311haa95532_0
  - notebook=7.2.2=py311haa95532_1
  - notebook-shim=0.2.3=py311haa95532_0
  - numexpr=2.8.7=py311h1fcbade_0
  - numpy=1.26.4=py311hdab7c0b_0
  - numpy-base=1.26.4=py311hd01c5d8_0
  - opencv=4.10.0=py311h66e330a_0
  - openjpeg=2.5.2=hae555c5_0
  - openssl=3.0.15=h827c3e9_0
  - orc=2.0.1=hd8d391b_0
  - overrides=7.4.0=py311haa95532_0
  - packaging=24.1=py311haa95532_0
  - pandas=2.2.2=py311hea22821_0
  - pandocfilters=1.5.0=pyhd3eb1b0_0
  - parso=0.8.3=pyhd3eb1b0_0
  - pcre2=10.42=h0ff8eda_1
  - pillow=10.4.0=py311h827c3e9_0
  - pip=24.2=py311haa95532_0
  - pixman=0.40.0=h2bbff1b_1
  - platformdirs=3.10.0=py311haa95532_0
  - prometheus_client=0.14.1=py311haa95532_0
  - prompt-toolkit=3.0.43=py311haa95532_0
  - prompt_toolkit=3.0.43=hd3eb1b0_0
  - psutil=5.9.0=py311h2bbff1b_0
  - pure_eval=0.2.2=pyhd3eb1b0_0
  - pyarrow=16.1.0=py311hea22821_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pygments=2.15.1=py311haa95532_1
  - pysocks=1.7.1=py311haa95532_0
  - python=3.11.10=h4607a30_0
  - python-dateutil=2.9.0post0=py311haa95532_2
  - python-fastjsonschema=2.16.2=py311haa95532_0
  - python-json-logger=2.0.7=py311haa95532_0
  - python-tzdata=2023.3=pyhd3eb1b0_0
  - python-xxhash=2.0.2=py311h2bbff1b_1
  - python_abi=3.11=2_cp311
  - pytorch=2.4.1=py3.11_cuda12.4_cudnn9_0
  - pytorch-cuda=12.4=h3fd98bf_6
  - pytorch-mutex=1.0=cuda
  - pytz=2024.1=py311haa95532_0
  - pywin32=305=py311h2bbff1b_0
  - pywinpty=2.0.10=py311h5da7b33_0
  - pyyaml=6.0.1=py311h2bbff1b_0
  - pyzmq=25.1.2=py311hd77b12b_0
  - qt-main=5.15.2=h19c9488_10
  - re2=2022.04.01=hd77b12b_0
  - referencing=0.30.2=py311haa95532_0
  - regex=2024.9.11=py311h827c3e9_0
  - requests=2.32.3=py311haa95532_0
  - rfc3339-validator=0.1.4=py311haa95532_0
  - rfc3986-validator=0.1.1=py311haa95532_0
  - rpds-py=0.10.6=py311h062c2fa_0
  - safetensors=0.4.4=py311h3ef4675_0
  - send2trash=1.8.2=py311haa95532_0
  - setuptools=75.1.0=py311haa95532_0
  - six=1.16.0=pyhd3eb1b0_1
  - snappy=1.2.1=hcdb6601_0
  - sniffio=1.3.0=py311haa95532_0
  - soupsieve=2.5=py311haa95532_0
  - sqlite=3.45.3=h2bbff1b_0
  - stack_data=0.2.0=pyhd3eb1b0_0
  - sympy=1.13.2=py311haa95532_0
  - tbb=2021.8.0=h59b6b97_0
  - terminado=0.17.1=py311haa95532_0
  - tinycss2=1.2.1=py311haa95532_0
  - tk=8.6.14=h0416ee5_0
  - tokenizers=0.20.0=py311h49ce162_0
  - tornado=6.4.1=py311h827c3e9_0
  - tqdm=4.66.5=py311h746a85d_0
  - traitlets=5.14.3=py311haa95532_0
  - transformers=4.46.0=pyhd8ed1ab_0
  - typing-extensions=4.11.0=py311haa95532_0
  - typing_extensions=4.11.0=py311haa95532_0
  - tzdata=2024b=h04d1e81_0
  - ucrt=10.0.20348.0=haa95532_0
  - urllib3=2.2.3=py311haa95532_0
  - utf8proc=2.6.1=h2bbff1b_1
  - vc=14.40=h2eaa2aa_1
  - vc14_runtime=14.40.33810=ha82c5b3_21
  - vs2015_runtime=14.40.33810=h3bf8584_21
  - wcwidth=0.2.5=pyhd3eb1b0_0
  - webencodings=0.5.1=py311haa95532_1
  - websocket-client=1.8.0=py311haa95532_0
  - wheel=0.44.0=py311haa95532_0
  - win_inet_pton=1.1.0=py311haa95532_0
  - winpty=0.4.3=4
  - xxhash=0.8.0=h2bbff1b_3
  - xz=5.4.6=h8cc25b3_1
  - yaml=0.2.5=he774522_0
  - yarl=1.11.0=py311h827c3e9_0
  - zeromq=4.3.5=hd77b12b_0
  - zlib=1.2.13=h8cc25b3_1
  - zstd=1.5.5=hd43e919_2
  - pip:
      - accelerate==1.0.0
      - aiofiles==23.2.1
      - aiohttp-retry==2.8.3
      - alembic==1.13.3
      - amqp==5.2.0
      - aniso8601==9.0.1
      - annotated-types==0.7.0
      - antlr4-python3-runtime==4.9.3
      - appdirs==1.4.4
      - asyncssh==2.17.0
      - atpublic==5.0
      - autopep8==2.3.1
      - bcrypt==4.2.0
      - billiard==4.2.1
      - blinker==1.8.2
      - boto3==1.35.40
      - botocore==1.35.40
      - cachetools==5.5.0
      - celery==5.4.0
      - cfgv==3.4.0
      - click==8.1.7
      - click-didyoumean==0.3.1
      - click-plugins==1.1.1
      - click-repl==0.3.0
      - cloudpickle==3.0.0
      - configobj==5.0.9
      - contourpy==1.3.0
      - cryptography==43.0.3
      - cycler==0.12.1
      - databricks-sdk==0.34.0
      - deeplake==3.9.26
      - deprecated==1.2.14
      - dictdiffer==0.9.0
      - dill==0.3.9
      - diskcache==5.6.3
      - distlib==0.3.9
      - distro==1.9.0
      - docker==7.1.0
      - dpath==2.2.0
      - dulwich==0.22.3
      - dvc==3.56.0
      - dvc-data==3.16.6
      - dvc-gdrive==3.0.1
      - dvc-http==2.32.0
      - dvc-objects==5.1.0
      - dvc-render==1.0.2
      - dvc-ssh==4.1.1
      - dvc-studio-client==0.21.0
      - dvc-task==0.40.2
      - entrypoints==0.4
      - evaluate==0.4.3
      - fastapi==0.115.0
      - ffmpy==0.4.0
      - flake8==7.1.1
      - flask==3.0.3
      - flatten-dict==0.4.2
      - flufl-lock==8.1.0
      - fonttools==4.54.1
      - funcy==2.0
      - gitdb==4.0.11
      - gitpython==3.1.43
      - google-api-core==2.21.0
      - google-api-python-client==2.149.0
      - google-auth==2.35.0
      - google-auth-httplib2==0.2.0
      - googleapis-common-protos==1.65.0
      - gradio==5.0.1
      - gradio-client==1.4.0
      - grandalf==0.8
      - graphene==3.3
      - graphql-core==3.2.4
      - graphql-relay==3.2.0
      - greenlet==3.1.1
      - gto==1.7.1
      - httplib2==0.22.0
      - huggingface-hub==0.25.2
      - humbug==0.3.2
      - hydra-core==1.3.2
      - identify==2.6.1
      - importlib-metadata==8.4.0
      - ipywidgets==8.1.5
      - isort==5.13.2
      - iterative-telemetry==0.0.9
      - itsdangerous==2.2.0
      - jmespath==1.0.1
      - joblib==1.4.2
      - jupyterlab-widgets==3.0.13
      - kiwisolver==1.4.7
      - kombu==5.4.2
      - language-tool-python==2.9.0
      - lightning-utilities==0.11.7
      - lz4==4.3.3
      - mako==1.3.5
      - markdown==3.7
      - markdown-it-py==3.0.0
      - matplotlib==3.9.2
      - mccabe==0.7.0
      - mdurl==0.1.2
      - mlflow==2.16.2
      - mlflow-skinny==2.16.2
      - multiprocess==0.70.17
      - mypy==1.13.0
      - mypy-extensions==1.0.0
      - nodeenv==1.9.1
      - oauth2client==4.1.3
      - omegaconf==2.3.0
      - opentelemetry-api==1.27.0
      - opentelemetry-sdk==1.27.0
      - opentelemetry-semantic-conventions==0.48b0
      - orjson==3.10.7
      - pathos==0.3.3
      - pathspec==0.12.1
      - pox==0.3.5
      - ppft==1.7.6.9
      - pre-commit==4.0.1
      - proto-plus==1.24.0
      - protobuf==5.28.2
      - pyasn1==0.6.1
      - pyasn1-modules==0.4.1
      - pycodestyle==2.12.1
      - pydantic==2.9.2
      - pydantic-core==2.23.4
      - pydot==3.0.2
      - pydrive2==1.20.0
      - pydub==0.25.1
      - pyflakes==3.2.0
      - pygit2==1.16.0
      - pygtrie==2.5.0
      - pyjwt==2.9.0
      - pyopenssl==24.2.1
      - pyparsing==3.1.4
      - python-multipart==0.0.12
      - rich==13.9.2
      - rsa==4.9
      - ruamel-yaml==0.18.6
      - ruamel-yaml-clib==0.2.12
      - ruff==0.6.9
      - s3transfer==0.10.3
      - scikit-learn==1.5.2
      - scipy==1.14.1
      - scmrepo==3.3.8
      - semantic-version==2.10.0
      - semver==3.0.2
      - shellingham==1.5.4
      - shortuuid==1.0.13
      - shtab==1.7.1
      - smmap==5.0.1
      - sqlalchemy==2.0.35
      - sqlparse==0.5.1
      - sqltrie==0.11.1
      - sshfs==2024.9.0
      - starlette==0.38.6
      - tabulate==0.9.0
      - threadpoolctl==3.5.0
      - toml==0.10.2
      - tomlkit==0.12.0
      - torchaudio==2.4.1
      - torchinfo==1.8.0
      - torchmetrics==1.4.2
      - torchvision==0.19.1
      - typer==0.12.5
      - uritemplate==4.1.1
      - uvicorn==0.31.1
      - vine==5.1.0
      - virtualenv==20.27.0
      - voluptuous==0.15.2
      - waitress==3.0.0
      - websockets==12.0
      - werkzeug==3.0.4
      - widgetsnbextension==4.0.13
      - wrapt==1.16.0
      - zc-lockfile==3.0.post1
      - zipp==3.20.2

jegor377 avatar Feb 16 '25 19:02 jegor377

@jegor377 Hey, did you manage to fix your problem? Normally the close bug on Windows has been fixed since the last version (2.9), that's strange. I have just retested your snippet on Windows 11, with python 3.13.1 and it works without any problems.

mdevolde avatar Feb 23 '25 19:02 mdevolde

Hi, I figured out that if I don't use close function then program works fine and closes normally.

jegor377 avatar Mar 01 '25 07:03 jegor377

The program closes correctly but the local web server probably does not close correctly.

mdevolde avatar Mar 01 '25 15:03 mdevolde

I think that it's closing properly because when the program start, in the task manager there is some Java process that takes 2GBs of RAM and terminates as the program terminates.

Image

jegor377 avatar Mar 03 '25 00:03 jegor377

Yes, that's just weird. I've just tried again on Windows 11 with python 3.11.11 and the close method works. I'm just wondering what makes the difference on your system.

mdevolde avatar Mar 07 '25 08:03 mdevolde

I can also confirm that the tool.close() does not work properly. When calling it, it just hangs. I am using Python 3.11.4 with venv. Is there anything I can provide to help this bug report?

dkuncik avatar Sep 25 '25 12:09 dkuncik

Hello, please provide as much context as possible (the contents of your venv, your operating system and its version, Python version, how you close). This will enable us to try to reproduce your bug.

mdevolde avatar Sep 26 '25 08:09 mdevolde

I am closing this issue due to inactivity. If you want to resolve your issue, please reopen a new issue.

mdevolde avatar Nov 09 '25 23:11 mdevolde