Home > Enterprise >  Cannot run python from conda env
Cannot run python from conda env

Time:10-09

I installed mamba (can be seen as conda) in Ubuntu 22.04 LTS. The Ubuntu is run in the Termux app in my Android mobil phone.

After I created and activated a new environment mamba create -n general python=3.9 && mamba activate general, and run python, I got zsh: command not found: python. If I run pip, I got zsh: /home/ssy/mambaforge/envs/general/bin/pip: bad interpreter: /home/ssy/mambaforge/envs/general/bin/python3.9: no such file or directory

I checked the environment path echo $PATH and found no problem: /home/ssy/mambaforge/envs/general/bin:/home/ssy/mambaforge/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin.

However, the python in /home/ssy/mambaforge/envs/general/bin is red in terminal. Like the figure below. I think this should be problem. But I don't know how to fix it.

ls -lh in /home/ssy/mambaforge/envs/general/bin

I post the display below, if you can't see the figure. The red part displayed in my terminal is start with [red] in the codes below.

-rwxrwxr-x 2 ssy ssy 147K Aug 12 23:43 opj_decompress
-rwxrwxr-x 2 ssy ssy 130K Aug 12 23:43 opj_dump
-rwxrwxr-x 2 ssy ssy  19K Sep 11 16:38 pal2rgb
-rwxrwxr-x 1 ssy ssy  255 Oct  3 07:34 pip
-rwxrwxr-x 1 ssy ssy  255 Oct  3 07:34 pip3
-rwxrwxr-x 2 ssy ssy  14K Sep 16 18:26 png-fix-itxt
-rwxrwxr-x 2 ssy ssy  57K Sep 16 18:26 pngfix
-rwxrwxr-x 2 ssy ssy  19K Sep 11 16:38 ppm2tiff
-rwxrwxr-x 2 ssy ssy  25K Feb  6  2021 psicc
[red]lrwxrwxrwx 1 ssy ssy   18 Oct  3 07:34 pydoc -> pydoc3.9
[red]lrwxrwxrwx 1 ssy ssy   18 Oct  3 07:34 pydoc3 -> pydoc3.9
[red]lrwxrwxrwx 1 ssy ssy  170 Oct  3 07:34 pydoc3.9 -> /home/ssy/mambaforge/envs/general/.condatmp/.l2s.b4b598da-901e-4a51-92f8-f365d232b1870001
[red]lrwxrwxrwx 1 ssy ssy  170 Oct  3 07:39 pyftmerge -> /home/ssy/mambaforge/envs/general/.condatmp/.l2s.ef6942e7-20e1-4cd4-ab45-3d4698eb9d050001
[red]lrwxrwxrwx 1 ssy ssy  170 Oct  3 07:39 pyftsubset -> /home/ssy/mambaforge/envs/general/.condatmp/.l2s.27f3e951-238c-4e0d-ab8b-0327731af9450001
[red]lrwxrwxrwx 1 ssy ssy   18 Oct  3 07:34 python -> python3.9
[red]lrwxrwxrwx 1 ssy ssy   18 Oct  3 07:34 python3 -> python3.9
[red]lrwxrwxrwx 1 ssy ssy   18 Oct  3 07:34 python3-config -> python3.9-config
[red]lrwxrwxrwx 1 ssy ssy  170 Oct  3 07:34 python3.9 -> /home/ssy/mambaforge/envs/general/.condatmp/.l2s.8500ff74-3bb0-449b-86b4-b7f4072f5f520001
[red]lrwxrwxrwx 1 ssy ssy  170 Oct  3 07:34 python3.9-config -> /home/ssy/mambaforge/envs/general/.condatmp/.l2s.8a47f509-b22b-4961-b99c-1bfd67e7c6c30001
-rwxrwxr-x 2 ssy ssy  23K Sep 11 16:38 raw2tiff

CodePudding user response:

Conda is designed to minimize redundant files by using hardlinking with a fallback to softlinking when working across volumes. One possibility is that the terminal emulation doesn’t support some of these operations. One can configure Conda not to use them by setting it to copy-only mode.

conda config --set always_copy true

Note that this means Conda will no longer be disk space efficient. You might want to spend time identifying what operations are not working in the emulation. That is, try using the ln function in the shell to create hard and soft links to see if they work. That would be helpful information to pass along to the emulator developers so they can work on supporting it.

  • Related