Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conda ImportError: No module named conda.cli

I installed conda, not anaconda, directly onto a server I am working on using the following instructions

wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
install to $HOME/.miniconda2
edit ~/.bashrc
Add this line:
export PATH="$HOME/.miniconda2/bin:$PATH"
source ~/.bashrc
conda install pip

When the conda installer asked me if I want to add the path to my .bashrc file I said yes and it added export PATH="/home/r/rhlozek/binesh/miniconda2/bin:$PATH"

However whenever I try to do conda install pip I get

Traceback (most recent call last): File "/home/r/rhlozek/binesh/miniconda2/bin/conda", line 4, in <module> import conda.cli ImportError: No module named conda.cli

When other people have this issue is when they say "No" to when the conda installer asks them to edit their .bashrc file, but i say Yes to it so now I don't know why I'm running into this problem.

like image 874
Ali Binesh Avatar asked Jun 27 '17 15:06

Ali Binesh


1 Answers

Looks like your PYTHONPATH is not properly set. Check it with:

python
...
>>> import sys
>>> sys.path

It should have a bunch of paths in there. Something like 6 to 10 entries seem sensible. The actual number depends on your own settings. I don't have Linux available right now to test it. If this list is empty, very short, or contains only paths with prefixes other than /home/r/rhlozek/binesh/miniconda2, you have problem.

Try:

  1. to start a new terminal window and see if the problem goes away and the PYTHONPATH gets longer
  2. add paths manually with:

    export PYTHONPATH="$HOME/.miniconda2/lib/python2.7:$HOME/.miniconda2/lib/python2.7/site-packages:$PYTHONPATH"
    

    (Check for the actual path on your system)

    source ~/.bashrc
    
like image 193
Mike Müller Avatar answered Sep 22 '22 05:09

Mike Müller