I have a problem with LFortran installation

I have installed the LFORTRAN on WSL2 and I used conda environment to do that. Thus, after following all steps, when I tried to use these commands:

cmake \
    -DCMAKE_BUILD_TYPE=Debug \
    -DWITH_LLVM=yes \
    -DWITH_XEUS=yes \
    -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
    -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
    .
cmake --build . -j4 --target install

I got this:

rg@JDP6JR9I:/mnt/c/Users/RG/lfortran-0.14.0$  cmake \
>     -DCMAKE_BUILD_TYPE=Debug \
>     -DWITH_LLVM=yes \
>     -DWITH_XEUS=yes \
>     -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
>     -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
>     .

-- Found LLVM 11.1.0
-- Using LLVMConfig.cmake in: /home/rg/miniconda3/envs/lf/lib/cmake/llvm


Configuration results
---------------------
LFORTRAN_VERSION: 0.14.0
CPACK_PACKAGE_FILE_NAME: lfortran-0.14.0-Linux
C compiler      : /usr/bin/cc
C++ compiler    : /usr/bin/c++
Build type: Debug
C compiler flags      : -g
C++ compiler flags    : -Wall -Wextra -g -ggdb
Installation prefix: /home/rg/miniconda3
WITH_LFORTRAN_ASSERT: no
LFORTRAN_STATIC_BIN: no
WITH_STACKTRACE: no
WITH_UNWIND: no
WITH_BFD: no
WITH_DWARFDUMP: no
WITH_LINKH: no
WITH_MACHO: no
HAVE_LFORTRAN_DEMANGLE: yes
WITH_LLVM: yes
WITH_XEUS: yes
WITH_JSON: no
WITH_FMT: no
WITH_LFORTRAN_BINARY_MODFILES: YES
WITH_RUNTIME_LIBRARY: YES
WITH_TARGET_AARCH64: no
WITH_TARGET_X86: yes
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/c/Users/RG/lfortran-0.14.0
(base) rg@-JDP6JR9I:/mnt/c/Users/RG/lfortran-0.14.0$ cmake --build . -j4 --target install
[  4%] Built target lfortran_runtime_static
[  4%] Built target lfortran_runtime
[  6%] Built target doctest
[  8%] Building CXX object src/lfortran/CMakeFiles/lfortran_lib.dir/fortran_kernel.cpp.o
/mnt/c/Users/RG/lfortran-0.14.0/src/lfortran/fortran_kernel.cpp: In function ‘int LFortran::run_kernel(const string&)’:
/mnt/c/Users/RG/lfortran-0.14.0/src/lfortran/fortran_kernel.cpp:419:83: error: no matching function for call to ‘xeus::xkernel::xkernel(xeus::xconfiguration&, std::string, std::remove_reference<std::unique_ptr<LFortran::custom_interpreter>&>::type)’
  419 |         xeus::xkernel kernel(config, xeus::get_user_name(), std::move(interpreter));
      |                                                                                   ^
In file included from /mnt/c/Users/RG/lfortran-0.14.0/src/lfortran/fortran_kernel.cpp:18:
/home/rg/miniconda3/envs/lf/include/xeus/xkernel.hpp:62:9: note: candidate: ‘xeus::xkernel::xkernel(const string&, xeus::xkernel::context_ptr, xeus::xkernel::interpreter_ptr, xeus::xkernel::server_builder, xeus::xkernel::history_manager_ptr, xeus::xkernel::logger_ptr, xeus::xkernel::debugger_builder, nlohmann::json, nlohmann::basic_json<>::error_handler_t)’
   62 |         xkernel(const std::string& user_name,
      |         ^~~~~~~
/home/rg/miniconda3/envs/lf/include/xeus/xkernel.hpp:62:9: note:   candidate expects 9 arguments, 3 provided
/home/rg/miniconda3/envs/lf/include/xeus/xkernel.hpp:51:9: note: candidate: ‘xeus::xkernel::xkernel(const xeus::xconfiguration&, const string&, xeus::xkernel::context_ptr, xeus::xkernel::interpreter_ptr, xeus::xkernel::server_builder, xeus::xkernel::history_manager_ptr, xeus::xkernel::logger_ptr, xeus::xkernel::debugger_builder, nlohmann::json, nlohmann::basic_json<>::error_handler_t)’
   51 |         xkernel(const xconfiguration& config,
      |         ^~~~~~~
/home/rg/miniconda3/envs/lf/include/xeus/xkernel.hpp:51:9: note:   candidate expects 10 arguments, 3 provided
make[2]: *** [src/lfortran/CMakeFiles/lfortran_lib.dir/build.make:531: src/lfortran/CMakeFiles/lfortran_lib.dir/fortran_kernel.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:334: src/lfortran/CMakeFiles/lfortran_lib.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

and with this command:

jupyter kernelspec list --json

I got this:


{
  "kernelspecs": {
    "python3": {
      "resource_dir": "/home/rg/.local/share/jupyter/kernels/python3",
      "spec": {
        "argv": [
          "python",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3 (ipykernel)",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {
          "debugger": true
        }
      }
    }
  }
}

I would appreciate it if anyone could help me with this. I am quite a beginner in these environments.

1 Like

Hi @Reza, welcome to the forum!

We have to update our documentation (Installation - LFortran Documentation) to specify the exact versions of the dependencies. Can you do this:

conda install xeus=1.0.1

This should downgrade the xeus package from version 2 to version 1. Then LFortran should build and the other commands will also work.

Thank you very much. I downgraded the xeus to version 1.0.1 and this time the cmake command worked well.

Install the project...
-- Install configuration: "Debug"
-- Up-to-date: /home/rg/miniconda3/envs/lf/share/jupyter/kernels
-- Up-to-date: /home/rg/miniconda3/envs/lf/share/jupyter/kernels/fortran
-- Up-to-date: /home/rg/miniconda3/envs/lf/share/jupyter/kernels/fortran/kernel.json
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_array.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_kind.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_iso_fortran_env.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_iso_c_binding.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_math2.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_math.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_trig.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_sin.mod
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/lfortran_intrinsic_string.mod
-- Installing: /home/rg/miniconda3/envs/lf/bin/lfortran
-- Set runtime path of "/home/rg/miniconda3/envs/lf/bin/lfortran" to "/home/rg/miniconda3/envs/lf/lib"
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/liblfortran_runtime.so
-- Installing: /home/rg/miniconda3/envs/lf/share/lfortran/lib/liblfortran_runtime_static.a

and now I have:

(lf) rg@a:/mnt/c/Users/RG/lfortran-0.14.0$ jupyter kernelspec list --json
{
  "kernelspecs": {
    "python3": {
      "resource_dir": "/home/rg/.local/share/jupyter/kernels/python3",
      "spec": {
        "argv": [
          "python",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3 (ipykernel)",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {
          "debugger": true
        }
      }
    },
    "fortran": {
      "resource_dir": "/home/rg/miniconda3/envs/lf/share/jupyter/kernels/fortran",
      "spec": {
        "argv": [
          "/home/rg/miniconda3/envs/lf/bin/lfortran",
          "kernel",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Fortran",
        "language": "fortran",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    }
  }

However, when I run the Jupyter lab, there is no IFORTRAN Kernel in it. Also, when I run the following command:

jupyter console --kernel=fortran

I get this:


rg@I:/mnt/c/Users/RG$ jupyter console --kernel=fortran
Run with XEUS 1.0.1
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for FortranTraceback (most recent call last):
  File "/home/rg/miniconda3/envs/lf/bin/jupyter-console", line 10, in <module>
    sys.exit(main())
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_console/app.py", line 148, in start
    self.shell.mainloop()
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_console/ptshell.py", line 664, in mainloop
    main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED)
TypeError: wait() got an unexpected keyword argument 'loop'
sys:1: RuntimeWarning: coroutine 'ZMQTerminalInteractiveShell.interact' was never awaited

I don’t know whether it is a problem with jupyter or anything else.

It seems LFortran installed correctly and you can see the fortran kernel in the JSON kernelspec.

The Python exception that you see also seems unrelated to LFortran. Can you try:

jupyter console --kernel=python3

and see if it works?

It returns same error :

jupyter console --kernel=python3


Python 3.10.1 | packaged by conda-forge | (main, Dec 22 2021, 01:39:05) [GCC 9.4.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.
Traceback (most recent call last):
  File "/home/rg/miniconda3/envs/lf/bin/jupyter-console", line 10, in <module>
    sys.exit(main())
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_console/app.py", line 148, in start
    self.shell.mainloop()
  File "/home/rg/miniconda3/envs/lf/lib/python3.10/site-packages/jupyter_console/ptshell.py", line 664, in mainloop
    main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED)
TypeError: wait() got an unexpected keyword argument 'loop'
sys:1: RuntimeWarning: coroutine 'ZMQTerminalInteractiveShell.interact' was never awaited

However, I already have ipython3 kernel on my jupyter and it works fine.

The error looks like is due to this: python - What are all these deprecated "loop" parameters in asyncio? - Stack Overflow.

Can you downgrade Python to 3.9? That should fix it.

Update: here is the upstream issue for this bug: asyncio.wait() no longer accepts the loop keyword in Python 3.10 · Issue #245 · jupyter/jupyter_console · GitHub

Note: it’s surprising that Python is backwards incompatible like this. They removed the loop argument because it simplifies the API or becomes redundant or something, but it breaks people’s codes…

So after testing everything, here are the results:
I was successful in installing and running LFORTRAN using the following commands:
First of all, I removed Jupyter and all dependencies from both -conda env- and Linux root.
Then, I installed the LFORTRAN by the document on the website.

wget https://lfortran.github.io/tarballs/dev/lfortran-0.14.0.tar.gz
tar xzf lfortran-0.14.0.tar.gz
cd lfortran-0.14.0

And build:

cmake -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .
make -j8
make install

and then run it by:

./src/bin/lfortran

It worked fine and I was able to do some coding with Fortran.
Then I decided to enable Jupyter kernel. So I installed it using conda-forge and I run this command:

cmake \
    -DCMAKE_BUILD_TYPE=Debug \
    -DWITH_LLVM=yes \
    -DWITH_XEUS=yes \
    -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
    -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
    .
cmake --build . -j4 --target install

In order to do that I had to go to the lfortran-0.14.0 directory since it needs a CMakeLists.
Finaly, I installed Jupyter lab. At this point by runing this commad:

jupyter console --kernel=fortran

I got:

(base) rg@9I:/mnt/c/Users/RG$ jupyter console --kernel=fortran
/home/rg/miniconda3/bin/lfortran: /home/rg/miniconda3/lib/libtinfo.so.6: no version information available (required by /home/rg/miniconda3/bin/lfortran)
Run with XEUS 1.0.1
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for Fortran
In [1]:

and the following error:

In [1]: print /home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/home/rg/miniconda3/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
    self.key_processor.process_keys()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

At this point, I was not able to use ./src/bin/lfortran anymore.
I also tried to downgrade the python but it didn’t change anything.

All in all, it is good to have an Interactive Fortran. But as an engineer it is a bit complicated to even install it :sweat_smile: :sweat_smile: .
I hope someday we could have it as convenient as python on all platforms or even on VSCOD.
Thank you very much for what you are doing and also for your help.

1 Like

The error that you are getting (Exception 'coroutine' object is not subscriptable) seems to be coming from Jupyter. Unfortunately that has been my experience with Python that you get these runtime errors if some package or Python versions do not align and it’s incredibly frustrating, at least to me. I can’t tell if this is somehow caused by the LFortran kernel or not.

At this point, I was not able to use ./src/bin/lfortran anymore.

What error do you get?

I’ll be happy to fix this if you give me more information.

I was able to reproduce your Python error with this on my Apple M1:

conda create -n lf2 -c conda-forge lfortran jupyter python=3.9
conda activate lf2
jupyter console --kernel="fortran"

and then in the Jupyter console:

In [1]: 4+4/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
    self.key_processor.process_keys()
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/Users/ondrej/mambaforge/envs/lf2/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable

That seems to be the same problem. I haven’t seen this error before, thanks for reporting it. I reported it upstream at: jupyter's python3 kernel seems to fail with Python 3.9 and 3.10 (Exception 'coroutine' object is not subscriptable) · Issue #23 · conda-forge/jupyter-feedstock · GitHub

1 Like

@Reza can you please try this:

conda create -n lf3 -c conda-forge lfortran jupyter python=3.8
conda activate lf3
jupyter console --kernel="fortran"

That works for me. There seems to be a bug in Jupyter with Python 3.8 and 3.9 in Conda, see my previous message where I reported it upstream.

For:

 ./src/bin/lfortran 

I am getting:

-bash: ./src/bin/lfortran: No such file or directory

That I believe, the reason is that at the first step, I installed LFORTRAN from a (Source Tarball)
and then I used this command in the LFORTRAN-0.14.0 directory:

cmake \
    -DCMAKE_BUILD_TYPE=Debug \
    -DWITH_LLVM=yes \
    -DWITH_XEUS=yes \
    -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
    -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
    .
cmake --build . -j4 --target install

So now, if I run conda_list_command I get:

(base) rg@JR9I:/mnt/c/Users/RG$ conda list
# packages in environment at /home/rg/miniconda3:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                      1_llvm    conda-forge
argon2-cffi               21.1.0           py39h3811e60_2    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
blas                      1.0                         mkl
bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py39h27cfd23_1003
bzip2                     1.0.8                h7b6447c_0
c-ares                    1.17.1               h27cfd23_0
ca-certificates           2021.10.26           h06a4308_2
certifi                   2021.10.8        py39h06a4308_0
cffi                      1.14.6           py39h400218f_0
charset-normalizer        2.0.4              pyhd3eb1b0_0
conda                     4.11.0           py39h06a4308_0
conda-package-handling    1.7.3            py39h27cfd23_1
cppzmq                    4.7.1                hf7cf922_2    conda-forge
cryptography              36.0.0           py39h9ce1e76_0
dbus                      1.13.6               he372182_0    conda-forge
debugpy                   1.5.1            py39he80948d_0    conda-forge
decorator                 5.1.0              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
expat                     2.4.2                h9c3ff4c_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
glib                      2.69.1               h5202010_0
gst-plugins-base          1.14.0               hbbd80ab_1
gstreamer                 1.14.0               h28cd5cc_2
icu                       58.2                 he6710b0_3
idna                      3.3                pyhd3eb1b0_0
importlib-metadata        4.10.0           py39hf3d152e_0    conda-forge
importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
intel-openmp              2021.4.0          h06a4308_3561
ipykernel                 6.6.0            py39hef51801_0    conda-forge
ipython                   7.30.1           py39hf3d152e_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.6.5              pyhd8ed1ab_0    conda-forge
jdatetime                 3.7.0              pyhd8ed1ab_0    conda-forge
jedi                      0.18.1           py39hf3d152e_0    conda-forge
jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
jsonschema                4.3.2              pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0            py39hf3d152e_7    conda-forge
jupyter_client            7.1.0              pyhd8ed1ab_0    conda-forge
jupyter_console           6.4.0              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.1            py39hf3d152e_1    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_widgets        1.0.2              pyhd8ed1ab_0    conda-forge
krb5                      1.19.2               hac12032_0
ld_impl_linux-64          2.35.1               h7274673_9
libarchive                3.5.2                hccf745f_1    conda-forge
libcurl                   7.80.0               h0b77cf5_0
libedit                   3.1.20210910         h7f8727e_0
libev                     4.33                 h7f8727e_1
libffi                    3.3                  he6710b0_2
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libllvm11                 11.1.0               h3826bc1_0
libmamba                  0.19.1               h3985d26_0    conda-forge
libmambapy                0.19.1           py39h8bfa403_0    conda-forge
libnghttp2                1.46.0               hce63b2e_0
libpng                    1.6.37               h21135ba_2    conda-forge
libsodium                 1.0.18               h7b6447c_0
libsolv                   0.7.19               h780b84a_5    conda-forge
libssh2                   1.9.0                h1ba5d50_1
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxml2                   2.9.12               h03d6c58_0
llvm                      11.1.0               h06a4308_0
llvm-openmp               12.0.1               h4bd325d_1    conda-forge
lz4-c                     1.9.3                h295c915_1
lzo                       2.10                 h7b6447c_2
mamba                     0.19.1           py39hfa8f2c8_0    conda-forge
markupsafe                2.0.1            py39h3811e60_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mistune                   0.8.4           py39h3811e60_1005    conda-forge
mkl                       2021.4.0           h06a4308_640
mkl-service               2.4.0            py39h7f8727e_0
mkl_fft                   1.3.1            py39hd3c417c_0
mkl_random                1.2.2            py39h51133e4_0
nbclient                  0.5.9              pyhd8ed1ab_0    conda-forge
nbconvert                 6.3.0            py39hf3d152e_1    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h7f8727e_2
nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
nlohmann_json             3.9.1                h9c3ff4c_1    conda-forge
notebook                  6.4.6              pyha770c72_0    conda-forge
numpy                     1.21.2           py39h20f2e39_0
numpy-base                1.21.2           py39h79a1101_0
openssl                   1.1.1l               h7f8727e_0
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandoc                    2.16.2               h7f98852_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.2.4           py39h06a4308_0
pip-autoremove            0.10.0                   pypi_0    pypi
prometheus_client         0.12.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.24             pyha770c72_0    conda-forge
prompt_toolkit            3.0.24               hd8ed1ab_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.3            py39h27cfd23_0
pycparser                 2.21               pyhd3eb1b0_0
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyopenssl                 21.0.0             pyhd3eb1b0_1
pyparsing                 3.0.6              pyhd8ed1ab_0    conda-forge
pyqt                      5.9.2            py39h2531618_6
pyrsistent                0.18.0           py39h3811e60_0    conda-forge
pysocks                   1.7.1            py39h06a4308_0
python                    3.9.7                h12debd9_1
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pyzmq                     22.3.0           py39h37b5a0c_1    conda-forge
qt                        5.9.7                h5867ecd_1
qtconsole                 5.2.2              pyhd8ed1ab_0    conda-forge
qtpy                      2.0.0              pyhd8ed1ab_0    conda-forge
readline                  8.1                  h27cfd23_0
reproc                    14.2.3               h7f98852_0    conda-forge
reproc-cpp                14.2.3               h9c3ff4c_0    conda-forge
requests                  2.26.0             pyhd3eb1b0_0
ruamel_yaml               0.15.100         py39h27cfd23_0
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                58.0.4           py39h06a4308_0
sip                       4.19.13          py39h2531618_0
six                       1.16.0             pyhd3eb1b0_0
sqlite                    3.36.0               hc218d9a_0
terminado                 0.12.1           py39hf3d152e_1    conda-forge
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.11               h1ccaba5_0
tornado                   6.1              py39h3811e60_2    conda-forge
tqdm                      4.62.3             pyhd3eb1b0_1
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
tzdata                    2021e                hda174b7_0
urllib3                   1.26.7             pyhd3eb1b0_0
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.0             pyhd3eb1b0_1
widgetsnbextension        3.5.2            py39hf3d152e_1    conda-forge
xeus                      1.0.1                h7d0c39e_2    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xtl                       0.7.4                h4bd325d_0    conda-forge
xz                        5.2.5                h7b6447c_0
yaml                      0.2.5                h7b6447c_0
yaml-cpp                  0.6.3                he1b5a44_4    conda-forge
zeromq                    4.3.4                h2531618_0
zipp                      3.6.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11               h7f8727e_4
zstd                      1.5.0                ha4553b6_1

and I can’t find LFORTRAN among packages. Meanwhile by running:

 jupyter kernelspec list --json

I have:


{
  "kernelspecs": {
    "python3": {
      "resource_dir": "/home/rg/.local/share/jupyter/kernels/python3",
      "spec": {
        "argv": [
          "python",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3 (ipykernel)",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {
          "debugger": true
        }
      }
    },
    "fortran": {
      "resource_dir": "/home/rg/miniconda3/share/jupyter/kernels/fortran",
      "spec": {
        "argv": [
          "/home/rg/miniconda3/bin/lfortran",
          "kernel",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Fortran",
        "language": "fortran",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    }
  }

and by:

jupyter console --kernel=fortran

I have:

 jupyter console --kernel=fortran
/home/rg/miniconda3/bin/lfortran: /home/rg/miniconda3/lib/libtinfo.so.6: no version information available (required by /home/rg/miniconda3/bin/lfortran)
Run with XEUS 1.0.1
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for Fortran
In [1]:

and same error:

In [1]: print*,('reza'/home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/home/rg/miniconda3/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
    self.key_processor.process_keys()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/home/rg/miniconda3/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

and any command leads to a terminal crash.
So I think everything is corrupted now.

I tested it, and it does not solve anything. Maybe I have to remove everything and start from scratch.

(lf3) rg@9I:/mnt/c/Users/RG$ conda list
# packages in environment at /home/rg/miniconda3/envs/lf3:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
alsa-lib                  1.2.3                h516909a_0    conda-forge
argon2-cffi               21.1.0           py38h497a2fe_2    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
cffi                      1.15.0           py38h3931269_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
debugpy                   1.5.1            py38h709712a_0    conda-forge
decorator                 5.1.0              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
expat                     2.4.2                h9c3ff4c_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
gst-plugins-base          1.18.5               hf529b03_2    conda-forge
gstreamer                 1.18.5               h9f60fe5_2    conda-forge
icu                       68.2                 h9c3ff4c_0    conda-forge
importlib-metadata        4.10.0           py38h578d9bd_0    conda-forge
importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.6.0            py38he5a9106_0    conda-forge
ipython                   7.30.1           py38h578d9bd_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.6.5              pyhd8ed1ab_0    conda-forge
jedi                      0.18.1           py38h578d9bd_0    conda-forge
jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
jsonschema                4.3.2              pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0            py38h578d9bd_7    conda-forge
jupyter_client            7.1.0              pyhd8ed1ab_0    conda-forge
jupyter_console           6.4.0              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.1            py38h578d9bd_1    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_widgets        1.0.2              pyhd8ed1ab_0    conda-forge
krb5                      1.19.2               hcc1bbae_3    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lfortran                  0.14.0               h780b84a_0    conda-forge
libclang                  11.1.0          default_ha53f305_1    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libglib                   2.70.2               h174f98d_0    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libllvm11                 11.1.0               hf817b99_2    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     13.5                 hd57d9b9_1    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
markupsafe                2.0.1            py38h497a2fe_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mistune                   0.8.4           py38h497a2fe_1005    conda-forge
mysql-common              8.0.27               ha770c72_3    conda-forge
mysql-libs                8.0.27               hfa10184_3    conda-forge
nbclient                  0.5.9              pyhd8ed1ab_0    conda-forge
nbconvert                 6.3.0            py38h578d9bd_1    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
notebook                  6.4.6              pyha770c72_0    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.73                 hb5efdd6_0    conda-forge
openssl                   1.1.1l               h7f98852_0    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandoc                    2.16.2               h7f98852_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.3.1             pyhd8ed1ab_0    conda-forge
prometheus_client         0.12.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.24             pyha770c72_0    conda-forge
prompt_toolkit            3.0.24               hd8ed1ab_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.6              pyhd8ed1ab_0    conda-forge
pyqt                      5.12.3           py38h578d9bd_8    conda-forge
pyqt-impl                 5.12.3           py38h0ffb2e6_8    conda-forge
pyqt5-sip                 4.19.18          py38h709712a_8    conda-forge
pyqtchart                 5.12             py38h7400c14_8    conda-forge
pyqtwebengine             5.12.1           py38h7400c14_8    conda-forge
pyrsistent                0.18.0           py38h497a2fe_0    conda-forge
python                    3.8.12          hb7a2778_2_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pyzmq                     22.3.0           py38h2035c66_1    conda-forge
qt                        5.12.9               hda022c4_4    conda-forge
qtconsole                 5.2.2              pyhd8ed1ab_0    conda-forge
qtpy                      2.0.0              pyhd8ed1ab_0    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                60.0.4           py38h578d9bd_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.37.0               h9cd32fc_0    conda-forge
terminado                 0.12.1           py38h578d9bd_1    conda-forge
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
tornado                   6.1              py38h497a2fe_2    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
widgetsnbextension        3.5.2            py38h578d9bd_1    conda-forge
xeus                      1.0.4                h7d0c39e_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.6.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.0                ha95c52a_0    conda-forge
(lf3) rg@9I:/mnt/c/Users/RG$ jupyter console --kernel="fortran"
Run with XEUS 1.0.4
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for Fortran
In [1]: real :: a/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
    self.key_processor.process_keys()
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

The reason you are getting the error is because you have Python 3.9 installed in the Conda environment, due to this bug in Jupyter: jupyter's python3 kernel seems to fail with Python 3.9 and 3.10 (Exception 'coroutine' object is not subscriptable) · Issue #23 · conda-forge/jupyter-feedstock · GitHub

Can you please try this:

conda create -n lf3 -c conda-forge lfortran jupyter python=3.8
conda activate lf3
jupyter console --kernel="fortran"

That should fix it.

I did this. At the moment, the python version is 3.8.12. Nothing happened.

Thanks for trying it. Can you send me your terminal session? Here is how it should look like:

$ conda create -n lf3 -c conda-forge lfortran jupyter python=3.8
...
$ conda activate lf3
$ jupyter console --kernel="fortran"
Run with XEUS 1.0.4
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for Fortran
In [1]: 4+4
Out[1]: 8

In [2]: integer :: x

In [3]: x = 5

In [4]: x-2
Out[4]: 3

Hello,

I apologize for the late response.
I tried it again, and after using CONDA as the installer I was able to get LFortran to run in the terminal.
I have tried to fix the Jupyter console problem, but it seems that it is related to xeus and the CMakeLists.txt file which is missing.
Therefore, I cannot run this command.

cmake \
    -DCMAKE_BUILD_TYPE=Debug \
    -DWITH_LLVM=yes \
    -DWITH_XEUS=yes \
    -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
    -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
    .
cmake --build . -j4 --target install

and I get this:

cmake \
>     -DCMAKE_BUILD_TYPE=Debug \
>     -DWITH_LLVM=yes \
>     -DWITH_XEUS=yes \
>     -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
>     -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
>     .
 --build . -j4 --target install
CMake Error: The source directory "/mnt/c/Users/RG" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

So I searched and I didn’t find the solution. I tried to make CMakeLists.txt. and I found this :
[https://github.com/jupyter-xeus/xeus/blob/master/CMakeLists.txt]
which led to something weird.
So this is the problem.
It is worth noting that the Fortran kernel specifications are already included in the Jupyter kernel specification list.
I also tried this
[https://anaconda.org/conda-forge/fortran_kernel](Fortran Kernel :: Anaconda.org)
but it didnt work.

So I tried this:
[https://xeus-python.readthedocs.io/en/stable/installation.html](Installation — xeus-python documentation)
using this command :

conda install xeus-python jupyterlab -c conda-forge

It leads to finally having Fortran kernels in Jupyter lab as well as Jupyter notebook
BUT it won’t execute the code that is not unexpected :sweat_smile:

Hi @Reza, thanks for the note. Can you try executing exactly what is in here: I have a problem with LFortran installation - #14 by certik ? That should work for you.

The approach you are taking is compiling from source, which is a little more challenging — I am happy to get you up and running there too, but let’s first get the Conda way working for you, which is the recommended way unless you are developing LFortran.

This is the result:

conda activate lf3
(lf3) rg@ : /mnt/c/Users/RG$  jupyter console --kernel="fortran"
Run with XEUS 1.0.4
Jupyter console 6.4.0

LFortran 0.14.0
Jupyter kernel for Fortran
In [1]: 4+4/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
  while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py", line 170, in callback_wrapper
    callback()
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 690, in read_from_input
    self.key_processor.process_keys()
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 271, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/home/rg/.local/lib/python3.8/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py", line 475, in _
    self.handle_iopub()
  File "/home/rg/miniconda3/envs/lf3/lib/python3.8/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
    msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

Thanks! Based on the traceback, it seems it is picking up libraries from your local ~/.local/ Python environment which it shouldn’t. You can try temporarily moving your local directory like this:

mv ~/.local ~/.local_old

And try again. It should hopefully work then. You can move it back by:

mv ~/.local_old ~/.local

That didn’t solve the problem. But it seems the problem was related to the version of Jupyter-client. The issue is described here:
RuntimeWarning: coroutine ‘ZMQSocketChannel.msg_ready’ was never awaited #241

I downgraded the jupyter-client (conda install jupyter_client=6.1) and now the problem is solved and it works very well.

1 Like

I’m not sure if it’s working properly.


specifically for 2/3 in line 2.

1 Like