Mohammad Kasra Habib
Mohammad Kasra Habib

Reputation: 82

All Conda command either get killed by zsh or no output

I have been using Conda Miniforge for almost few months to accomplish my ML tasks on Apple Silicon Chip (a.k.a M1). However, yesterday I was trying to install a package with conda (i.e., conda install conda-forge name-of-package) and the moment I executed the command, the terminal returns (without any error or output) to accept new command as everything executed normally. After a while, I switched into my virtual environment and then open python shell to import Tensorflow then zsh killed the python as you can see below:

(mlm1-engine) mohammadkasrahabib@iste Downloads % python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 15:50:57) 
[Clang 11.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
zsh: killed     python
(mlm1-engine) mohammadkasrahabib@iste Downloads % 

Importing any package related to ML (sklearn, Matplotlib or etc.) will kill the python, but it works fine I import the ordinary python packages, e.g. math.

Another thing is non of the conda commands work except conda --version; terminal shows that command runs without any error, but no output. You can see it bellow:

(mlm1-engine) mohammadkasrahabib@iste ~ % conda list
(mlm1-engine) mohammadkasrahabib@iste ~ %   
(mlm1-engine) mohammadkasrahabib@iste ~ % conda info
(mlm1-engine) mohammadkasrahabib@iste ~ %          
(mlm1-engine) mohammadkasrahabib@iste ~ % conda env list
(mlm1-engine) mohammadkasrahabib@iste ~ % 
(mlm1-engine) mohammadkasrahabib@iste ~ % conda --version
conda 4.10.0
(mlm1-engine) mohammadkasrahabib@iste ~ % 

And also running the commands with sudo will output that the command is killed by zsh. As you can see it bellow:

(mlm1-engine) mohammadkasrahabib@iste ~ % sudo conda env list
Password:
zsh: killed     sudo conda env list
(mlm1-engine) mohammadkasrahabib@iste ~ % 

Any help would be much appreciated! Thanks in Advance!

Upvotes: 4

Views: 4800

Answers (2)

Krzysztof Malicki
Krzysztof Malicki

Reputation: 11

Check your python3 version. I upgraded to 3.9.12 and had the same problem. I returned back to 3.9.10 and that solved the problem.

Upvotes: 1

qmeeus
qmeeus

Reputation: 2412

The questions you should ask yourself:

  • Did you change something with conda? eg: update it, delete some files, etc.?
  • What is the last package that you (successfully) installed? Is there a reason to believe that this one (or one of its dependencies) is responsible for your problem?
  • Do you have different results when the environment is (de)activated?
  • Does it work with bash (rather than zsh)?*

If you answer no to all of the above, your best course of actions is to reinstall conda all together, simple as that.

[EDIT]

* To check whether it works with bash:

  1. Open a terminal (with bash NOT zsh, check with echo $SHELL. You might have to edit your .bashrc or terminal emulator settings)
  2. Run eval "$(<PATH_TO_ANACONDA>/bin/conda shell.bash hook)"
  3. Run conda update -n base conda

[UPDATE]

None of the approaches worked, I re-installed it. Everything works fine! But still, that was weird!

Upvotes: 0

Related Questions