jupyterlab-contrib / jupyterlab_code_formatter

A JupyterLab plugin to facilitate invocation of code formatters.
https://jupyterlab-code-formatter.readthedocs.io/
MIT License
855 stars 55 forks source link

Jupyterlab Code Formatter generates errors at Jupyterlab start: "Uncaught exception" and "FileNotFoundError" #281

Closed pililac closed 2 years ago

pililac commented 2 years ago

After starting JupyterLab a error is generated by Jupyterlab Code Formatter.

What does the "uncaught exception" and "FileNotFoundError" mean? I cannot identify a file that should be found.

See following log:

NumExpr defaulting to 8 threads.
[I 2022-08-02 11:51:37.023 ServerApp] dask_labextension | extension was successfully linked.
[I 2022-08-02 11:51:37.024 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2022-08-02 11:51:37.029 ServerApp] jupyter_server_mathjax | extension was successfully linked.
[I 2022-08-02 11:51:37.030 ServerApp] jupyter_server_proxy | extension was successfully linked.
[I 2022-08-02 11:51:37.038 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-08-02 11:51:37.038 ServerApp] jupyterlab_code_formatter | extension was successfully linked.
[I 2022-08-02 11:51:37.045 ServerApp] nbclassic | extension was successfully linked.
[I 2022-08-02 11:51:37.045 ServerApp] nbdime | extension was successfully linked.
[I 2022-08-02 11:51:37.471 ServerApp] notebook_shim | extension was successfully linked.
[I 2022-08-02 11:51:37.471 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2022-08-02 11:51:37.471 ServerApp] voila.server_extension | extension was successfully linked.
[I 2022-08-02 11:51:37.503 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-08-02 11:51:37.504 ServerApp] dask_labextension | extension was successfully loaded.
[I 2022-08-02 11:51:37.574 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2022-08-02 11:51:37.773 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2022-08-02 11:51:37.774 ServerApp] jupyter_server_mathjax | extension was successfully loaded.
[I 2022-08-02 11:51:37.809 ServerApp] jupyter_server_proxy | extension was successfully loaded.
[I 2022-08-02 11:51:37.810 LabApp] JupyterLab extension loaded from C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\site-packages\jupyterlab
[I 2022-08-02 11:51:37.810 LabApp] JupyterLab application directory is C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\share\jupyter\lab
[I 2022-08-02 11:51:37.814 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-08-02 11:51:37.814 ServerApp] jupyterlab_code_formatter | extension was successfully loaded.
[I 2022-08-02 11:51:37.821 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-08-02 11:51:37.887 ServerApp] nbdime | extension was successfully loaded.
/panel-preview/ /panel-preview
[I 2022-08-02 11:51:37.888 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2022-08-02 11:51:37.890 ServerApp] voila.server_extension | extension was successfully loaded.
[I 2022-08-02 11:51:37.892 ServerApp] Serving notebooks from local directory: C:\Users\userp1\OneDrive\Documents\Python\notebooks
[I 2022-08-02 11:51:37.892 ServerApp] Jupyter Server 1.17.0 is running at:
[I 2022-08-02 11:51:37.892 ServerApp] http://localhost:8888/lab?token=5496a09d8050494b3fce2139805fd86068a20d5b51d6b305
[I 2022-08-02 11:51:37.892 ServerApp]  or http://127.0.0.1:8888/lab?token=5496a09d8050494b3fce2139805fd86068a20d5b51d6b305
[I 2022-08-02 11:51:37.893 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-08-02 11:51:37.920 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/other_software/Winpython64-3.10.4.0/WPy64-31040/settings/runtime/jpserver-3820-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=5496a09d8050494b3fce2139805fd86068a20d5b51d6b305
     or http://127.0.0.1:8888/lab?token=5496a09d8050494b3fce2139805fd86068a20d5b51d6b305
[I 2022-08-02 11:51:41.776 LabApp] Build is up to date
2022-08-02 11:51:45,478 - ServerApp - ERROR - Uncaught exception GET /jupyterlab_code_formatter/formatters?1659433902058 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/jupyterlab_code_formatter/formatters?1659433902058', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\site-packages\tornado\web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\site-packages\jupyterlab_code_formatter\handlers.py", line 76, in get
    "formatters": {
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\site-packages\jupyterlab_code_formatter\handlers.py", line 78, in <dictcomp>
    "enabled": formatter.importable,
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\site-packages\jupyterlab_code_formatter\formatters.py", line 474, in importable
    proc = subprocess.run(["which", "rustfmt"], stdout=subprocess.PIPE)
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system can't find the specified file
[W 2022-08-02 11:51:45.480 ServerApp] Unhandled error
[E 2022-08-02 11:51:45.482 ServerApp] {
      "Host": "localhost:8888",
      "Accept": "*/*",
      "Referer": "http://localhost:8888/lab",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
    }
[E 2022-08-02 11:51:45.482 ServerApp] 500 GET /jupyterlab_code_formatter/formatters?1659433902058 (::1) 3414.59ms referer=http://localhost:8888/lab
[W 2022-08-02 11:51:45.870 ServerApp] Notebook Projects/P1112/Test01.ipynb is not trusted
[I 2022-08-02 11:51:46.640 ServerApp] Kernel started: e1ad0f37-fddb-455f-8320-8c7bee3fa26f
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 1759558d-898e-4048-bfcc-ac4e1b2a03d3

Diagnostic commands

Output of >pip freeze ``` >pip freeze adodbapi==2.6.1.3 affine==2.3.1 aiofiles==0.8.0 aiohttp==3.8.1 aiosignal==1.2.0 aiosqlite==0.17.0 alabaster==0.7.12 alembic==1.7.7 algopy==0.5.7 altair==4.2.0 altair-data-server==0.4.1 altair-transform==0.2.0 altair-widgets==0.2.2 altgraph==0.17.2 amply==0.1.5 aniso8601==9.0.1 ansiwrap==0.8.4 anyio==3.5.0 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.2 asciitree==0.3.3 asgi-csrf==0.9 asgiref==3.5.0 asn1crypto==1.4.0 asteval==0.9.26 astor==0.8.1 astroid==2.11.3 astroML==1.0.2.post1 astropy==5.0.4 async-generator==1.10 async-timeout==4.0.2 atomicwrites==1.4.0 attrs==21.4.0 autopep8==1.6.0 Babel==2.10.1 backcall==0.2.0 backports-abc==0.5 baresql==0.7.6 base58==2.1.1 bcrypt==3.2.0 beautifulsoup4==4.11.1 binaryornot==0.4.4 black==22.3.0 bleach==5.0.0 blinker==1.4 blis==0.7.7 blosc==1.10.6 bokeh==2.4.2 botorch==0.4.0 Bottleneck==1.3.4 bqplot==0.12.33 branca==0.5.0 brewer2mpl==1.4.1 Brotli==1.0.9 cachelib==0.6.0 cachetools==5.0.0 Cartopy==0.20.2 catalogue==2.0.7 certifi==2021.10.8 cffi==1.15.0 cftime==1.6.0 chardet==4.0.0 charset-normalizer==2.0.12 click==8.0.4 click-default-group==1.2.2 click-plugins==1.1.1 cligj==0.7.2 cloudpickle==2.0.0 clr-loader==0.1.7 clrmagic==0.0.1a2 colorama==0.4.4 colorcet==3.0.0 commonmark==0.9.1 cookiecutter==1.7.3 coverage==6.3.2 cramjam==2.5.0 cryptography==3.4.7 csvs-to-sqlite==1.3.1a0 cvxopt==1.3.0 cvxpy==1.2.0 cx-Freeze==6.10 cx-Logging==3.0 cycler==0.11.0 cymem==2.0.6 Cython==0.29.28 cytoolz==0.11.2 dash==2.3.0 dash-core-components==2.0.0 dash-html-components==2.0.0 dash-table==5.0.0 dask==2022.4.2 dask-glm==0.2.0 dask-image==2021.12.0 dask-labextension==5.2.0 dask-ml==2022.1.22 dask-searchcv==0.2.0 databases==0.5.5 datasette==0.61.1 datasette-graphql==2.0.1 datashader==0.14.0 datashape==0.5.2 dateparser==1.1.0 db.py==0.5.4b1 deap==1.3.1 debugpy==1.6.0 decorator==4.4.2 defusedxml==0.7.1 Deprecated==1.2.13 deprecation==2.1.0 diff-match-patch==20200713 dill==0.3.3 distlib==0.3.4 distributed==2022.4.2 docopt==0.6.2 docrepr==0.1.1 docutils==0.17.1 ecos==2.0.10 emcee==3.1.1 entrypoints==0.4 et-xmlfile==1.1.0 fast-histogram==0.10 fastai==2.6.3 fastapi==0.75.2 fastcore==1.3.27 fastdownload==0.0.5 fasteners==0.17.3 fastjsonschema==2.15.3 fastparquet==0.8.0 fastprogress==1.0.0 feather-format==0.4.1 filelock==3.6.0 Fiona==1.8.21 flake8==4.0.1 Flask==2.1.2 flask-accepts==0.18.4 Flask-Compress==1.12 Flask-Mail==0.9.1 flask-restx==0.5.1 Flask-Session==0.4.0 Flask-SQLAlchemy==2.5.1 flaskerize==0.14.0 flit==3.7.1 flit_core==3.7.1 folium==0.12.1 fonttools==4.31.2 formlayout==1.2.1a1 frozenlist==1.3.0 fs==2.4.15 fsspec==2022.3.0 future==0.18.2 fuzzywuzzy==0.18.0 GDAL==3.4.2 geographiclib==1.52 geopandas==0.10.2 geopy==2.2.0 geoviews==1.9.5 gitdb==4.0.9 GitPython==3.1.26 gmpy2==2.1.2 gpytorch==1.5.1 graphene==3.0 graphql-core==3.1.7 graphql-relay==3.1.5 great-expectations==0.14.11 greenlet==1.1.2 guidata==2.1.1 guiqwt==4.1.0 h11==0.12.0 h2==4.1.0 h5py==3.6.0 HeapDict==1.0.1 holoviews==1.14.8 hpack==4.0.0 html5lib==1.1 httpcore==0.14.7 httpie==3.1.0 httptools==0.4.0 httpx==0.22.0 hupper==1.10.3 husl==4.0.3 hvplot==0.7.3 hypercorn==0.13.2 hyperframe==6.0.1 hypothesis==6.45.1 idlex==1.22 idna==3.1 imageio==2.17.0 imageio-ffmpeg==0.4.2 imagesize==1.3.0 imbalanced-learn==0.9.0 importlib-metadata==4.11.3 inflection==0.5.1 iniconfig==1.1.1 intake==0.6.4 intervaltree==3.0.2 ipycanvas==0.11.0 ipykernel==6.13.0 ipyleaflet==0.14.0 ipympl==0.9.1 ipython==7.32.0 ipython-genutils==0.2.0 ipython-sql==0.4.1b1 ipywidgets==7.7.0 isort==5.10.1 itsdangerous==2.1.2 janus==1.0.0 jedi==0.18.1 jellyfish==0.9.0 Jinja2==3.0.3 jinja2-time==0.2.0 joblib==1.1.0 json5==0.9.6 jsonpatch==1.32 jsonpointer==2.3 jsonschema==4.4.0 julia==0.5.7 jupyter==1.0.0 jupyter-bokeh==3.0.4 jupyter-client==7.3.0 jupyter-console==6.4.3 jupyter-core==4.10.0 jupyter-lsp==1.5.1 jupyter-packaging==0.12.0 jupyter-server==1.17.0 jupyter-server-mathjax==0.2.5 jupyter-server-proxy==3.2.1 jupyter-sphinx==0.3.2 jupyterlab==3.3.4 jupyterlab-code-formatter==1.5.1 jupyterlab-launcher==0.13.1 jupyterlab-lsp==3.10.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.13.0 jupyterlab-widgets==1.1.0 keyring==23.5.0 kiwisolver==1.4.2 langcodes==3.3.0 lazy-object-proxy==1.7.1 llvmlite==0.38.0 lmfit==1.0.3 locket==1.0.0 loky==3.1.0 lxml==4.8.0 lz4==4.0.0 Mako==1.2.0 Markdown==3.3.6 MarkupSafe==2.1.1 marshmallow==3.12.1 matplotlib==3.5.1 matplotlib-inline==0.1.3 maturin==0.12.14 mccabe==0.6.1 mercantile==1.2.1 mergedeep==1.3.4 metakernel==0.28.2 mistune==0.8.4 mizani==0.7.4 mkl-service==2.4.0 mlxtend==0.18.0 moviepy==1.0.3 mpl-scatter-density==0.7 mpld3==0.5.7 mpldatacursor==0.7.1 mpmath==1.2.1 msgpack==1.0.3 msvc-runtime==14.29.30133 multidict==6.0.2 multipledispatch==0.6.0 munch==2.5.0 murmurhash==1.0.6 mypy==0.942 mypy-extensions==0.4.3 mysql-connector-python==8.0.21 nbclassic==0.3.7 nbclient==0.5.13 nbconvert==6.5.0 nbconvert_reportlab==0.2 nbdime==3.1.1 nbformat==5.3.0 nbval==0.9.6 nest-asyncio==1.5.5 netCDF4==1.5.8 networkx==2.8 NLopt==2.7.0 nltk==3.7 notebook==6.4.11 notebook-shim==0.1.0 numba==0.55.1 numcodecs==0.9.1 numdifftools==0.9.40 numexpr==2.8.1 numpy==1.21.5+mkl numpydoc==1.2.1 oct2py==5.4.3 octave-kernel==0.34.1 openpyxl==3.0.9 orjson==3.6.7 osqp==0.6.2.post4 outcome==1.1.0 packaging==21.3 palettable==3.3.0 pandas==1.4.2 pandas-datareader==0.10.0 pandocfilters==1.5.0 panel==0.13.0 papermill==2.3.4 param==1.12.1 parambokeh==0.2.3 paramiko==2.8.0 paramnb==2.0.4 parso==0.8.3 partd==1.2.0 pathspec==0.9.0 pathy==0.6.1 patsy==0.5.2 pdfrw==0.4.post2 pdvega==0.2.1.dev0 pefile==2021.9.3 pep8==1.7.1 pexpect==4.8.0 pg8000==1.23.0 pickleshare==0.7.5 Pillow==9.1.0 PIMS==0.5 Pint==0.19.2 pipdeptree==2.2.1 pkginfo==1.8.2 platformdirs==2.5.2 plotly==5.7.0 plotnine==0.8.1.dev0 pluggy==1.0.0 ply==3.11 portpicker==1.5.0 poyo==0.5.0 ppci==0.5.8 preshed==3.0.6 prettytable==3.2.0 priority==2.0.0 proglog==0.1.9 prometheus-client==0.14.1 prompt-toolkit==3.0.29 protobuf==4.0.0rc1 psutil==5.9.0 ptpython==3.0.20 ptyprocess==0.7.0 PuLP==2.3 py==1.11.0 py-lru-cache==0.1.4 pyaml==20.4.0 pyarrow==7.0.0 PyAudio==0.2.11 pybars3==0.9.7 pybind11==2.9.2 pycodestyle==2.8.0 pycosat==0.6.3 pycparser==2.21 pyct==0.4.8 pydantic==1.8.2 pydeck==0.7.1 pydocstyle==6.1.1 pyepsg==0.4.0 pyerfa==2.0.0.1 pyflakes==2.4.0 pyflux==0.4.17 pygad==2.16.3 pygame==2.1.2 pygbm==0.1.0 Pygments==2.11.2 pyhdf==0.10.3 pyinstaller==5.0.1 pyinstaller-hooks-contrib==2022.4 pylint==2.13.7 pyls-spyder==0.4.0 pymc==2.3.8 PyMeta3==0.5.1 pymongo==4.1.1 Pympler==1.0.1 PyNaCl==1.5.0 pynndescent==0.5.6 pyodbc==4.0.32 PyOpenGL==3.1.6 pypandoc==1.5 pyparsing==2.4.7 pyproj==3.3.1 PyQt5==5.15.6 PyQt5-Qt5==5.15.2 PyQt5-sip==12.9.1 pyqtgraph==0.12.4 PyQtWebEngine==5.15.5 PyQtWebEngine-Qt5==5.15.2 pyrsistent==0.18.1 pyserial==3.5 pyshp==2.2.0 PySocks==1.7.1 pystache==0.5.4 pytest==7.1.1 python-baseconv==1.2.2 python-dateutil==2.8.2 python-dotenv==0.19.2 python-hdf4==0.10.0+dummy python-Levenshtein==0.12.2 python-lsp-black==1.2.1 python-lsp-jsonrpc==1.0.0 python-lsp-server==1.4.1 python-multipart==0.0.5 python-picard==0.7 python-slugify==6.1.2 python-snappy==0.6.1 pythonnet==3.0.0a2 PythonQwt==0.10.1 pytz==2022.1 pytz-deprecation-shim==0.1.0.post0 pyviz-comms==2.2.0 PyWavelets==1.3.0 pywin32==303 pywin32-ctypes==0.2.0 pywinpty==2.0.5 pywinusb==0.4.2 PyYAML==6.0 pyzmq==22.3.0 pyzo==4.12.3 pyzstd==0.15.2 QDarkStyle==3.0.3 qdldl==0.1.5.post2 qpsolvers==1.8.0 qstylizer==0.2.1 QtAwesome==1.1.1 qtconsole==5.3.0 QtPy==2.1.0 quadprog==0.1.8 quantecon==0.5.3 quart==0.17.0 rasterio==1.2.10 readme-renderer==35.0 redis==4.2.2 regex==2022.3.15 reportlab==3.6.9 requests==2.27.1 requests-toolbelt==0.9.1 rfc3986==1.5.0 rich==12.3.0 rise==5.7.1 rope==1.0.0 Rtree==1.0.0 ruamel.yaml==0.17.17 Rx==3.1.1 scikit-fuzzy==0.4.1 scikit-image==0.19.2 scikit-learn==1.0.2 scikit-optimize==0.9.0 scilab2py==0.6.2 scipy==1.8.0 scramp==1.4.1 scs==3.2.0 seaborn==0.11.2 Send2Trash==1.8.0 shap==0.40.0 Shapely==1.8.1.post1 simpervisor==0.4 simplegeneric==0.8.1 simplejson==3.17.6 simpy==4.0.1 six==1.16.0 sklearn-contrib-lightning==0.6.2.post0 slicer==0.0.7 slicerator==1.1.0 smart-open==5.2.1 smmap==5.0.0 snakeviz==2.1.0 sniffio==1.2.0 snowballstemmer==2.2.0 snuggs==1.4.7 sortedcontainers==2.4.0 sounddevice==0.4.4 soupsieve==2.3.2.post1 spacy==3.2.4 spacy-legacy==3.0.9 spacy-loggers==1.0.2 Sphinx==4.5.0 sphinx-rtd-theme==1.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 spyder==5.3.0 spyder-kernels==2.3.0 SQLAlchemy==1.4.35 sqlite-bro==0.12.2 sqlite-fts4==1.0.1 sqlite-utils==3.26 sqlparse==0.4.2 srsly==2.4.2 starlette==0.17.1 statsmodels==0.13.2 streamlit==1.4.0 streamz==0.6.3 supersmoother==0.4 swifter==1.0.9 sympy==1.10.1 tables==3.7.0 tabulate==0.8.9 tblib==1.7.0 tenacity==8.0.1 termcolor==1.1.0 terminado==0.13.3 text-unidecode==1.3 textdistance==4.2.2 textwrap3==0.9.2 thinc==8.0.15 threadpoolctl==3.1.0 three-merge==0.1.1 tifffile==2022.4.22 tinycss2==1.1.1 toml==0.10.2 tomli==2.0.1 tomli_w==1.0.0 tomlkit==0.10.2 toolz==0.11.2 torch==1.11.0 torchaudio==0.11.0 torchvision==0.12.0 tornado==6.1 tqdm==4.64.0 traitlets==5.1.1 traittypes==0.2.1 trio==0.20.0 trio-asyncio==0.12.0 twine==4.0.0 twitter==1.19.2 typer==0.4.1 typing_extensions==4.2.0 tzdata==2022.1 tzlocal==4.2 ujson==5.2.0 umap-learn==0.5.1 uncertainties==3.1.6 urllib3==1.26.9 uvicorn==0.17.6 validators==0.18.2 vega==3.6.0 vega-datasets==0.9.0 virtualenv==20.14.1 ViTables==3.0.2 voila==0.3.5 wasabi==0.9.1 wasmer==1.1.0 wasmer_compiler_cranelift==1.1.0 wasmer_compiler_singlepass==1.1.0 watchdog==2.1.7 watchgod==0.8.2 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.3.2 websockets==10.3 Werkzeug==2.1.2 widgetsnbextension==3.6.0 winpython==4.6.20220501 wordcloud==1.8.1 wrapt==1.14.0 wsproto==1.1.0 xarray==2022.3.0 XlsxWriter==3.0.3 xlwings==0.24.7 yapf==0.32.0 yarl==1.7.2 zarr==2.11.3 zict==2.2.0 zipp==3.8.0 zstandard==0.17.0 ```
Output of >jupyter labextension list ``` >jupyter labextension list JupyterLab v3.3.4 C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\share\jupyter\labextensions bqplot v0.5.34 enabled ok (python, bqplot) dask-labextension v5.2.0 enabled ok (python, dask_labextension) ipycanvas v0.11.0 enabled ok jupyter-leaflet v0.14.0 enabled ok jupyter-matplotlib v0.11.1 enabled ok jupyterlab-plotly v5.7.0 enabled ok jupyterlab_pygments v0.2.2 enabled ok (python, jupyterlab_pygments) nbdime-jupyterlab v2.1.1 enabled ok @bokeh/jupyter_bokeh v3.0.4 enabled ok (python, jupyter_bokeh) @jupyter-widgets/jupyterlab-manager v3.1.0 enabled ok (python, jupyterlab_widgets) @jupyterlab/server-proxy v3.2.1 enabled ok @krassowski/jupyterlab-lsp v3.10.1 enabled ok (python, jupyterlab-lsp) @pyviz/jupyterlab_pyviz v2.2.0 enabled ok (python, pyviz_comms) @ryantam626/jupyterlab_code_formatter v1.5.1 enabled ok (python, jupyterlab-code-formatter) @voila-dashboards/jupyterlab-preview v2.1.5 enabled ok (python, voila) Other labextensions (built into JupyterLab) app dir: C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\share\jupyter\lab ```
Output of >jupyter serverextension list ``` >jupyter serverextension list config dir: C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\etc\jupyter dask_labextension enabled - Validating... dask_labextension 5.2.0 ok jupyter_lsp enabled - Validating... jupyter_lsp 1.5.1 ok jupyter_server_proxy enabled - Validating... jupyter_server_proxy ok jupyterlab enabled - Validating... jupyterlab 3.3.4 ok jupyterlab_code_formatter enabled - Validating... jupyterlab_code_formatter 1.5.1 ok nbdime enabled - Validating... nbdime 3.1.1 ok voila.server_extension enabled - Validating... voila.server_extension ok ```

Additional context

ryantam626 commented 2 years ago

Hello, I don't use Windows so I can't really test things out.

Can you in a WinPython interpreter try using subprocess.Popen? I have a feeling WinPython has implemented subprocess.Popen in way that breaks this plugin.

pililac commented 2 years ago

Hi @ryantam626,

I tried the example from the first note under the definition of subprocess.Popen in a WinPython interpreter. It failed. Here is the output.

>>> import shlex, subprocess
>>> command_line = input()
/bin/vikings -input eggs.txt -output "spam spam.txt" -cmd "echo '$MONEY'"
>>> args = shlex.split(command_line)
>>> print(args)
['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', "echo '$MONEY'"]
>>> p = subprocess.Popen(args)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

[WinError 2] The system cannot find the file specified

I did the same within JupyterLab and gained a little more detailed error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_1088\3814503411.py in <cell line: 7>()
      5 print(args)
      6 
----> 7 p = subprocess.Popen(args) # Success!

C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize)
    964                             encoding=encoding, errors=errors)
    965 
--> 966             self._execute_child(args, executable, preexec_fn, close_fds,
    967                                 pass_fds, cwd, env,
    968                                 startupinfo, creationflags, shell,

C:\other_software\Winpython64-3.10.4.0\WPy64-31040\python-3.10.4.amd64\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1433             # Start the process
   1434             try:
-> 1435                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1436                                          # no special security
   1437                                          None, None,

FileNotFoundError: [WinError 2] The system cannot find the file specified
pililac commented 2 years ago

I set up a new python on my computer, the same error occurs when using miniforge python. Here is the log. Any ideas?

(test_env) C:\Users\user01>jupyter lab
[I 2022-08-09 10:26:21.212 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2022-08-09 10:26:21.223 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-08-09 10:26:21.223 ServerApp] jupyterlab_code_formatter | extension was successfully linked.
[I 2022-08-09 10:26:21.231 ServerApp] nbclassic | extension was successfully linked.
[I 2022-08-09 10:26:21.564 ServerApp] notebook_shim | extension was successfully linked.
[I 2022-08-09 10:26:21.597 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-08-09 10:26:21.641 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2022-08-09 10:26:21.733 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2022-08-09 10:26:21.734 LabApp] JupyterLab extension loaded from C:\miniforge3\envs\test_env\lib\site-packages\jupyterlab
[I 2022-08-09 10:26:21.734 LabApp] JupyterLab application directory is C:\miniforge3\envs\test_env\share\jupyter\lab
[I 2022-08-09 10:26:21.737 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-08-09 10:26:21.737 ServerApp] jupyterlab_code_formatter | extension was successfully loaded.
[I 2022-08-09 10:26:21.745 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-08-09 10:26:21.746 ServerApp] Serving notebooks from local directory: C:\Users\user01\OneDrive\Documents\Python\notebooks
[I 2022-08-09 10:26:21.746 ServerApp] Jupyter Server 1.18.1 is running at:
[I 2022-08-09 10:26:21.746 ServerApp] http://localhost:8888/lab?token=1b79510d11309a218f7aed3982732f871521633554fee388
[I 2022-08-09 10:26:21.746 ServerApp]  or http://127.0.0.1:8888/lab?token=1b79510d11309a218f7aed3982732f871521633554fee388
[I 2022-08-09 10:26:21.746 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-08-09 10:26:21.774 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/user01/AppData/Roaming/jupyter/runtime/jpserver-16856-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=1b79510d11309a218f7aed3982732f871521633554fee388
     or http://127.0.0.1:8888/lab?token=1b79510d11309a218f7aed3982732f871521633554fee388
[I 2022-08-09 10:26:25.348 LabApp] Build is up to date
[E 2022-08-09 10:26:26.733 ServerApp] Uncaught exception GET /jupyterlab_code_formatter/formatters?1660033585656 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/jupyterlab_code_formatter/formatters?1660033585656', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\miniforge3\envs\test_env\lib\site-packages\tornado\web.py", line 1711, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\miniforge3\envs\test_env\lib\site-packages\jupyterlab_code_formatter\handlers.py", line 76, in get
        "formatters": {
      File "C:\miniforge3\envs\test_env\lib\site-packages\jupyterlab_code_formatter\handlers.py", line 78, in <dictcomp>
        "enabled": formatter.importable,
      File "C:\miniforge3\envs\test_env\lib\site-packages\jupyterlab_code_formatter\formatters.py", line 447, in importable
        proc = subprocess.run(["which", self.command[0]], stdout=subprocess.PIPE)
      File "C:\miniforge3\envs\test_env\lib\subprocess.py", line 505, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\miniforge3\envs\test_env\lib\subprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\miniforge3\envs\test_env\lib\subprocess.py", line 1420, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
[W 2022-08-09 10:26:26.736 ServerApp] Unhandled error
[E 2022-08-09 10:26:26.738 ServerApp] {
      "Host": "localhost:8888",
      "Accept": "*/*",
      "Referer": "http://localhost:8888/lab",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
    }
[E 2022-08-09 10:26:26.738 ServerApp] 500 GET /jupyterlab_code_formatter/formatters?1660033585656 (::1) 983.24ms referer=http://localhost:8888/lab
\
ryantam626 commented 2 years ago

Hi! Can you try it with the latest version of the plugin (1.5.3)? It includes a change that should fix this issue.

pililac commented 2 years ago

Yea, it worked. The error is gone. Thanks!

ryantam626 commented 2 years ago

Great to hear!