Cannot invoke "com.jetbrains.python.sdk.flavors.conda.CondaInfoJson.getEnvs()" because "info" is null
adrinjalali opened this issue · 11 comments
Please paste the logs from ~/.cache/micromamba-pycharm.log
Here's the log. It seems it thinks micromamba
is not in my PATH
? It is for my zsh
, should it be in my bashrc
instead?
$ cat ~/.cache/micromamba-pycharm.log
Attempting to run: ['self-check']
Attempting to run: ['self-check']
Attempting to run: ['info', '--envs', '--json']
Traceback (most recent call last):
File "/usr/bin/conda", line 105, in <module>
sys.exit(main(args))
^^^^^^^^^^
File "/usr/bin/conda", line 54, in main
base_env = micromamba_json(["info"])["base environment"]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/conda", line 30, in micromamba_json
return json.loads(micromamba(cmd + ["--json"]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/conda", line 25, in micromamba
out = subprocess.check_output(["micromamba"] + cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'micromamba'
Attempting to run: ['info', '--envs', '--json']
Traceback (most recent call last):
File "/home/adrin/opt/micromamba-pycharm/conda", line 105, in <module>
sys.exit(main(args))
^^^^^^^^^^
File "/home/adrin/opt/micromamba-pycharm/conda", line 54, in main
base_env = micromamba_json(["info"])["base environment"]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adrin/opt/micromamba-pycharm/conda", line 30, in micromamba_json
return json.loads(micromamba(cmd + ["--json"]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adrin/opt/micromamba-pycharm/conda", line 25, in micromamba
out = subprocess.check_output(["micromamba"] + cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'micromamba'
Added to PATH
in my .bashrc
as well, same result.
I wonder how you were able to run self-check
successfully but then it fails when called from PyCharm. Does PyCharm call Micromamba through bash maybe?
self-check passes cause micromamba
is in my PATH, both in zshrc
and bashrc
. It was only in my zsh
, but I put it in my bash as well and still same result. Hmm...
Wonder how I can get the info on which shell pycharm is running this script
You could log os.environ
in the Python script
Or put a looong sleep in the script and check htop
/pstree
/ps aux
I found a different solution (using a conda executable I already have available). So closing this one for now. I think it'd be nice for the conda
executable in this repo to be able to read the path to micromamba
from a config file maybe?
@jonashaag I'm having the same issue. Here is a minimal example to reproduce it.
Dockerfile
FROM mambaorg/micromamba
ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN micromamba install -y -n base -c conda-forge \
git \
python && \
micromamba clean --all --yes
RUN git clone https://github.com/jonashaag/micromamba-pycharm.git /home/micromamba-pycharm
RUN /home/micromamba-pycharm/conda self-check
Steps to reproduce:
- Create a project in PyCharm with this Dockerfile.
- Go to Settings -> Project ... -> Python interpreter -> Add interpreter -> On Docker.
- At the window "1/3 Create a new Docker target" leave everything default and press Next.
- Wait for the image to be built and press Next.
- At the last window, select Conda environment and in the Conda Executable type in
/home/micromamba-pycharm/conda
. - Press Load Environments. Here you should see the same error.
I'm not sure if I'm getting the logs correctly, though.
If I copy the image id that is printed on the step "2/3. Building Docker image..." (for example, at the line "Successfully built 5175f82d2c76") and launch a container by running docker run -it --rm 5175f82d2c76 bash
, then cat ~/.cache/micromamba-pycharm.log
gives me only:
Attempting to run: ['self-check']
PyCharm version:
PyCharm 2023.3.3 (Professional Edition)
Build #PY-233.13763.11, built on January 25, 2024
I can reproduce but I don't know how to get the logs out of this short running container :( And the IDE logs don't show anything interesting
if you run
import os
print(os.environ['PATH'])
you might get the some paths that tells your operating system where to look for executable programs. However, micromamba
cannot be found in these paths. So you can add a soft link to one of the paths, such as sudo ln -s /YOU PATH/micromamba /usr/bin/micromamba