mamba-org / gator

Conda environment and package management extension from within Jupyter
Other
259 stars 31 forks source link

No such file or directory: 'conda' #211

Open cgahr opened 4 months ago

cgahr commented 4 months ago

Description

On my system, I have only mamba installed and not conda. When running jupyter notebook, jupyter lab or gator, I get the following error message (sorry for the formatting, I tried to fix it as good as possible):

[E 2024-03-07 16:01:47.247 ServerApp.mamba_gator] Error for task 
{
  'type': 'FileNotFoundError', 
  'error': "[Errno 2] No such file or directory: 'conda'", 
  'message': "FileNotFoundError(2, 'No such file or directory')", 
  'traceback': []}

traceback:

  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/handlers.py", line 96, in execute_task
    result = await f(*args)
             ^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/handlers.py", line 380, in update_available
    answer = await env_manager.list_available()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/envmanager.py", line 595, in list_available
    ans = await self._execute(self.manager, "search", "--json")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/envmanager.py", line 151, in _execute
    process = await current_loop.run_in_executor(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

Furthermore, no environments are shown!

The error itself is not unexpected (at least for me), since I don't have conda installed on my system, I only have mamba!

However, my understanding was that I don't need conda to rungator.

This seems to be a bug to be, but any help is appreciated!

EDIT: I looked through envmanager.py and might have found a possible issue. In line 200, you call which mamba to get the executable of mamba. In my case, I installed mamba via nix, which only provides micromamba. For ease of usage, I aliased mamba to micromamba. In this case however, line 200 return mamba: aliased to micromamba which breaks the command.

EDIT 2: I created a script mamba which correctly resolves to the micromamba executable. Now I get the following error (in the jupyter log):

  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/handlers.py", line 96, in execute_task
    result = await f(*args)
             ^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/handlers.py", line 380, in update_available
    answer = await env_manager.list_available()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/envmanager.py", line 595, in list_available
    ans = await self._execute(self.manager, "search", "--json")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/site-packages/mamba_gator/envmanager.py", line 151, in _execute
    process = await current_loop.run_in_executor(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/cgahr/micromamba/envs/notebook/lib/python3.12/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

Reproduce

  1. Install environment (below)
  2. Run jupyter notebook, jupyter lab or gator
  3. Don't find any mamba environment
# environment.yml
name: notebook
channels:
  - conda-forge
  - defaults
dependencies:
  - python>=3.11
  - jupyterlab
  - notebook
  - mamba_gator
  - pip

Expected behavior

Detect all installed environments:

$ mamba env list
  Name            Active  Path
──────────────────────────────────────────────────────────────────────
  base                    /home/cgahr/micromamba
  notebook        *       /home/cgahr/micromamba/envs/notebook
  qmk                     /home/cgahr/micromamba/envs/qmk

Context

Command Line Output
could not paste the log, I hit the 65k character limit
Browser Output
Paste the output from your browser Javascript console here.