Conda: ImportError: No module named conda.cli

Created on 28 Oct 2016  路  3Comments  路  Source: conda/conda

I updated conda today using the following command:

conda update --all

After the update was finished, I cannot run any conda commands. E.g.

$ conda --version
Traceback (most recent call last):
  File "/content/username/SOFTWARE/anaconda2/bin/conda", line 4, in <module>
    import conda.cli
ImportError: No module named conda.cli
$ jupyter notebook
Traceback (most recent call last):
  File "/content/username/SOFTWARE/anaconda2/bin/jupyter", line 4, in <module>
    import jupyter_core.command
ImportError: No module named jupyter_core.command

It looks like python in anaconda folder cannot load the modules correctly.

$ /content/username/SOFTWARE/anaconda2/bin/python
Python 2.7.3 (default, Jun 21 2016, 18:50:31) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> a = sys.modules.keys()
>>> a
['copy_reg', 'sre_compile', '_sre', 'encodings', 'site', '__builtin__', 'sysconfig', '__main__', 'encodings.encodings', 'abc', 'posixpath', '_weakrefset', 'errno', 'encodings.codecs', 'sre_constants', 're', '_abcoll', 'types', '_codecs', 'encodings.__builtin__', '_warnings', 'genericpath', 'stat', 'zipimport', '_sysconfigdata', 'mpl_toolkits', 'warnings', 'UserDict', 'encodings.utf_8', 'sys', 'codecs', 'readline', '_sysconfigdata_nd', 'os.path', 'sitecustomize', 'signal', 'traceback', 'linecache', 'posix', 'encodings.aliases', 'exceptions', 'sre_parse', 'os', '_weakref']
>>> sys.path
['','/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']

It appears that after the update the python in the conda bin directory is linked to the system python.

I am not sure why this happened. I have tried resourcing my bashrc, but the error persists.

Some additional details:

$ which conda
/content/username/SOFTWARE/anaconda2/bin/conda
$ which python
/content/username/SOFTWARE/anaconda2/bin/python
$ python --version
Python 2.7.3
$ ipython
Traceback (most recent call last):
  File "/content/username/SOFTWARE/anaconda2/bin/ipython", line 6, in <module>
    sys.exit(IPython.start_ipython())
AttributeError: 'module' object has no attribute 'start_ipython'
$ python
Python 2.7.3 (default, Jun 21 2016, 18:50:31) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import conda
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named conda
>>> 

This is the output of the conda update --all command:

$ conda update --all
Fetching package metadata .......
Solving package specifications: ..........

Package plan for installation in environment /content/username/SOFTWARE/anaconda2:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    hdf5-1.8.15.1              |                3         1.9 MB
    ncurses-5.9                |                8         836 KB
    pcre-8.39                  |                0         553 KB
    zeromq-4.1.5               |                0         4.1 MB
    alabaster-0.7.9            |           py27_0          11 KB
    anaconda-custom            |           py27_0           3 KB
    beautifulsoup4-4.5.1       |           py27_0         120 KB
    boto-2.43.0                |           py27_0         1.3 MB
    contextlib2-0.5.3          |           py27_0          12 KB
    cython-0.25.1              |           py27_0         5.6 MB
    dill-0.2.5                 |           py27_0          74 KB
    filelock-2.0.6             |           py27_0           8 KB
    greenlet-0.4.10            |           py27_0          34 KB
    ipaddress-1.0.17           |           py27_0          29 KB
    jdcal-1.3                  |           py27_0           8 KB
    multipledispatch-0.4.9     |           py27_0          12 KB
    pkginfo-1.3.2              |           py27_0          31 KB
    ply-3.9                    |           py27_0          71 KB
    psutil-4.4.2               |           py27_0         232 KB
    pycparser-2.16             |           py27_0         152 KB
    pyflakes-1.3.0             |           py27_0          74 KB
    pymysql-0.7.9              |           py27_0         117 KB
    pyzmq-16.0.0               |           py27_0         743 KB
    qtpy-1.1.2                 |           py27_0          22 KB
    sqlalchemy-1.1.2           |           py27_0         1.4 MB
    werkzeug-0.11.11           |           py27_0         305 KB
    xlsxwriter-0.9.3           |           py27_0         192 KB
    xlwt-1.1.2                 |           py27_0         152 KB
    babel-2.3.4                |           py27_0         4.8 MB
    cffi-1.8.3                 |           py27_0         322 KB
    lxml-3.6.4                 |           py27_0         2.8 MB
    openpyxl-2.4.0             |           py27_0         266 KB
    partd-0.3.6                |           py27_0          24 KB
    pillow-3.4.2               |           py27_0         852 KB
    prompt_toolkit-1.0.8       |           py27_0         308 KB
    pytest-3.0.3               |           py27_0         248 KB
    qtawesome-0.3.3            |           py27_0         153 KB
    anaconda-client-1.5.3      |           py27_0         115 KB
    conda-build-2.0.7          |           py27_0         269 KB
    cryptography-1.5.2         |           py27_0         808 KB
    flask-0.11.1               |           py27_0          96 KB
    sphinx-1.4.8               |           py27_0         1.3 MB
    bokeh-0.12.3               |           py27_0         3.5 MB
    conda-manager-0.4.0        |           py27_0         133 KB
    odo-0.5.0                  |           py27_1         175 KB
    pyopenssl-16.0.0           |           py27_0          66 KB
    dask-0.11.1                |           py27_0         609 KB
    blaze-0.10.1               |           py27_0         577 KB
    qt-4.8.7                   |                4        32.7 MB
    pyqt-4.11.4                |           py27_4         3.3 MB
    anaconda-navigator-1.2.3   |           py27_0         3.0 MB
    scikit-image-0.12.3        |      np110py27_1        26.4 MB
    ------------------------------------------------------------
                                           Total:       100.6 MB

The following NEW packages will be INSTALLED:

    _nb_ext_conf:       0.3.0-py27_0        
    contextlib2:        0.5.3-py27_0        
    filelock:           2.0.6-py27_0        
    nb_anacondacloud:   1.2.0-py27_0        
    nb_conda:           2.0.0-py27_0        
    nb_conda_kernels:   2.0.0-py27_0        
    nbpresent:          3.0.2-py27_0        
    pkginfo:            1.3.2-py27_0        
    prompt_toolkit:     1.0.8-py27_0        
    wcwidth:            0.1.7-py27_0        
    widgetsnbextension: 1.2.6-py27_0        

The following packages will be UPDATED:

    alabaster:          0.7.7-py27_0         --> 0.7.9-py27_0      
    anaconda:           4.0.0-np110py27_0    --> custom-py27_0     
    anaconda-client:    1.4.0-py27_0         --> 1.5.3-py27_0      
    anaconda-navigator: 1.1.0-py27_0         --> 1.2.3-py27_0      
    babel:              2.2.0-py27_0         --> 2.3.4-py27_0      
    beautifulsoup4:     4.4.1-py27_0         --> 4.5.1-py27_0      
    blaze:              0.9.1-py27_0         --> 0.10.1-py27_0     
    bokeh:              0.11.1-py27_0        --> 0.12.3-py27_0     
    boto:               2.39.0-py27_0        --> 2.43.0-py27_0     
    bottleneck:         1.0.0-np110py27_0    --> 1.0.0-np110py27_1 
    cdecimal:           2.3-py27_0           --> 2.3-py27_2        
    cffi:               1.5.2-py27_0         --> 1.8.3-py27_0      
    cloudpickle:        0.1.1-py27_0         --> 0.2.1-py27_0      
    clyent:             1.2.1-py27_0         --> 1.2.2-py27_0      
    conda-build:        1.20.3-py27_0        --> 2.0.7-py27_0      
    conda-manager:      0.3.1-py27_0         --> 0.4.0-py27_0      
    configparser:       3.5.0b2-py27_1       --> 3.5.0-py27_0      
    cryptography:       1.3-py27_0           --> 1.5.2-py27_0      
    cython:             0.23.4-py27_0        --> 0.25.1-py27_0     
    cytoolz:            0.7.5-py27_0         --> 0.8.0-py27_0      
    dask:               0.8.1-py27_0         --> 0.11.1-py27_0     
    datashape:          0.5.1-py27_0         --> 0.5.2-py27_0      
    decorator:          4.0.9-py27_0         --> 4.0.10-py27_0     
    dill:               0.2.4-py27_0         --> 0.2.5-py27_0      
    docutils:           0.12-py27_0          --> 0.12-py27_2       
    entrypoints:        0.2-py27_1           --> 0.2.2-py27_0      
    enum34:             1.1.2-py27_0         --> 1.1.6-py27_0      
    fastcache:          1.0.2-py27_0         --> 1.0.2-py27_1      
    flask:              0.10.1-py27_1        --> 0.11.1-py27_0     
    fontconfig:         2.11.1-5             --> 2.11.1-6          
    freetype:           2.5.5-0              --> 2.5.5-1           
    funcsigs:           0.4-py27_0           --> 1.0.2-py27_0      
    futures:            3.0.3-py27_0         --> 3.0.5-py27_0      
    greenlet:           0.4.9-py27_0         --> 0.4.10-py27_0     
    grin:               1.2.1-py27_1         --> 1.2.1-py27_3      
    h5py:               2.5.0-np110py27_4    --> 2.6.0-np110py27_0 
    harfbuzz:           0.9.39-0             --> 0.9.39-1          
    hdf5:               1.8.15.1-2           --> 1.8.15.1-3        
    heapdict:           1.0.0-py27_0         --> 1.0.0-py27_1      
    idna:               2.0-py27_0           --> 2.1-py27_0        
    ipaddress:          1.0.14-py27_0        --> 1.0.17-py27_0     
    ipykernel:          4.3.1-py27_0         --> 4.5.0-py27_0      
    ipython:            4.1.2-py27_1         --> 5.1.0-py27_0      
    ipywidgets:         4.1.1-py27_0         --> 5.2.2-py27_0      
    jdcal:              1.2-py27_0           --> 1.3-py27_0        
    jedi:               0.9.0-py27_0         --> 0.9.0-py27_1      
    jinja2:             2.8-py27_0           --> 2.8-py27_1        
    jpeg:               8d-0                 --> 8d-2              
    jsonschema:         2.4.0-py27_0         --> 2.5.1-py27_0      
    jupyter:            1.0.0-py27_2         --> 1.0.0-py27_3      
    jupyter_client:     4.2.2-py27_0         --> 4.4.0-py27_0      
    jupyter_console:    4.1.1-py27_0         --> 5.0.0-py27_0      
    jupyter_core:       4.1.0-py27_0         --> 4.2.0-py27_0      
    libffi:             3.0.13-0             --> 3.2.1-0           
    libpng:             1.6.17-0             --> 1.6.22-0          
    libsodium:          1.0.3-0              --> 1.0.10-0          
    libtiff:            4.0.6-1              --> 4.0.6-2           
    locket:             0.2.0-py27_0         --> 0.2.0-py27_1      
    lxml:               3.6.0-py27_0         --> 3.6.4-py27_0      
    markupsafe:         0.23-py27_0          --> 0.23-py27_2       
    mistune:            0.7.2-py27_0         --> 0.7.3-py27_0      
    mkl-service:        1.1.2-py27_1         --> 1.1.2-py27_2      
    mpmath:             0.19-py27_0          --> 0.19-py27_1       
    multipledispatch:   0.4.8-py27_0         --> 0.4.9-py27_0      
    nbconvert:          4.1.0-py27_0         --> 4.2.0-py27_0      
    nbformat:           4.0.1-py27_0         --> 4.1.0-py27_0      
    ncurses:            5.9-4              r --> 5.9-8             
    nltk:               3.2-py27_0           --> 3.2.1-py27_0      
    nose:               1.3.7-py27_0         --> 1.3.7-py27_1      
    notebook:           4.1.0-py27_1         --> 4.2.3-py27_0      
    odo:                0.4.2-py27_0         --> 0.5.0-py27_1      
    openpyxl:           2.3.2-py27_0         --> 2.4.0-py27_0      
    openssl:            1.0.2g-0             --> 1.0.2j-0          
    pandas:             0.18.0-np110py27_0   --> 0.18.1-np110py27_0
    pango:              1.39.0-0             --> 1.39.0-1          
    partd:              0.3.2-py27_1         --> 0.3.6-py27_0      
    patchelf:           0.8-0                --> 0.9-0             
    path.py:            8.1.2-py27_1         --> 8.2.1-py27_0      
    patsy:              0.4.0-np110py27_0    --> 0.4.1-py27_0      
    pcre:               8.31-0               --> 8.39-0            
    pickleshare:        0.5-py27_0           --> 0.7.4-py27_0      
    pillow:             3.1.1-py27_0         --> 3.4.2-py27_0      
    pip:                8.1.1-py27_1         --> 8.1.2-py27_0      
    ply:                3.8-py27_0           --> 3.9-py27_0        
    psutil:             4.1.0-py27_0         --> 4.4.2-py27_0      
    ptyprocess:         0.5-py27_0           --> 0.5.1-py27_0      
    pycosat:            0.6.1-py27_0         --> 0.6.1-py27_1      
    pycparser:          2.14-py27_0          --> 2.16-py27_0       
    pycrypto:           2.6.1-py27_0         --> 2.6.1-py27_4      
    pyflakes:           1.1.0-py27_0         --> 1.3.0-py27_0      
    pygments:           2.1.1-py27_0         --> 2.1.3-py27_0      
    pymysql:            0.6.7-py27_0         --> 0.7.9-py27_0      
    pyopenssl:          0.15.1-py27_2        --> 16.0.0-py27_0     
    pyqt:               4.11.4-py27_1        --> 4.11.4-py27_4     
    pytest:             2.8.5-py27_0         --> 3.0.3-py27_0      
    python-dateutil:    2.5.1-py27_0         --> 2.5.3-py27_0      
    pytz:               2016.2-py27_0        --> 2016.7-py27_0     
    pyyaml:             3.11-py27_1          --> 3.12-py27_0       
    pyzmq:              15.2.0-py27_0        --> 16.0.0-py27_0     
    qt:                 4.8.7-1              --> 4.8.7-4           
    qtawesome:          0.3.2-py27_0         --> 0.3.3-py27_0      
    qtconsole:          4.2.0-py27_0         --> 4.2.1-py27_0      
    qtpy:               1.0-py27_0           --> 1.1.2-py27_0      
    redis:              2.6.9-0              --> 3.2.0-0           
    redis-py:           2.10.3-py27_0        --> 2.10.5-py27_0     
    requests:           2.9.1-py27_0         --> 2.11.1-py27_0     
    scikit-image:       0.12.3-np110py27_0   --> 0.12.3-np110py27_1
    seaborn:            0.7.0-py27_0         --> 0.7.1-py27_0      
    setuptools:         20.3-py27_0          --> 27.2.0-py27_0     
    simplegeneric:      0.8.1-py27_0         --> 0.8.1-py27_1      
    sip:                4.16.9-py27_0        --> 4.18-py27_0       
    sockjs-tornado:     1.0.1-py27_0         --> 1.0.3-py27_0      
    sphinx:             1.3.5-py27_0         --> 1.4.8-py27_0      
    sqlalchemy:         1.0.12-py27_0        --> 1.1.2-py27_0      
    ssl_match_hostname: 3.4.0.2-py27_0       --> 3.4.0.2-py27_1    
    statsmodels:        0.6.1-np110py27_0    --> 0.6.1-np110py27_1 
    terminado:          0.5-py27_1           --> 0.6-py27_0        
    toolz:              0.7.4-py27_0         --> 0.8.0-py27_0      
    tornado:            4.3-py27_0           --> 4.4.2-py27_0      
    traitlets:          4.2.1-py27_0         --> 4.3.1-py27_0      
    werkzeug:           0.11.4-py27_0        --> 0.11.11-py27_0    
    xlrd:               0.9.4-py27_0         --> 1.0.0-py27_0      
    xlsxwriter:         0.8.4-py27_0         --> 0.9.3-py27_0      
    xlwt:               1.0.0-py27_0         --> 1.1.2-py27_0      
    xz:                 5.0.5-1              --> 5.2.2-0           
    zeromq:             4.1.3-0              --> 4.1.5-0           
    zlib:               1.2.8-0              --> 1.2.8-3           

The following packages will be SUPERCEDED by a higher-priority channel:

    glib:               2.43.0-2           r --> 2.43.0-1          

The following packages will be DOWNGRADED due to dependency conflicts:

    llvmlite:           0.9.0-py27_0         --> 0.8.0-py27_0      
    mkl:                11.3.3-0             --> 11.3.1-0          
    numba:              0.24.0-np110py27_0   --> 0.23.1-np110py27_0
    numexpr:            2.5.2-np110py27_1    --> 2.5.2-np110py27_0 
    numpy:              1.10.4-py27_2        --> 1.10.4-py27_1     
    pyparsing:          2.0.3-py27_0         --> 1.5.6-py27_0      
    scikit-learn:       0.17.1-np110py27_1   --> 0.17.1-np110py27_0
    scipy:              0.17.0-np110py27_4   --> 0.17.0-np110py27_3

Proceed ([y]/n)? y

Fetching packages ...
hdf5-1.8.15.1- 100% |################################################################################################################################################| Time: 0:00:00   4.03 MB/s
ncurses-5.9-8. 100% |################################################################################################################################################| Time: 0:00:00   2.51 MB/s
pcre-8.39-0.ta 100% |################################################################################################################################################| Time: 0:00:00   2.24 MB/s
zeromq-4.1.5-0 100% |################################################################################################################################################| Time: 0:00:00   6.91 MB/s
alabaster-0.7. 100% |################################################################################################################################################| Time: 0:00:00  13.93 MB/s
anaconda-custo 100% |################################################################################################################################################| Time: 0:00:00   3.27 MB/s
beautifulsoup4 100% |################################################################################################################################################| Time: 0:00:00   1.16 MB/s
boto-2.43.0-py 100% |################################################################################################################################################| Time: 0:00:00   3.27 MB/s
contextlib2-0. 100% |################################################################################################################################################| Time: 0:00:00 590.28 kB/s
cython-0.25.1- 100% |################################################################################################################################################| Time: 0:00:00   8.78 MB/s
dill-0.2.5-py2 100% |################################################################################################################################################| Time: 0:00:00 852.88 kB/s
filelock-2.0.6 100% |################################################################################################################################################| Time: 0:00:00  11.98 MB/s
greenlet-0.4.1 100% |################################################################################################################################################| Time: 0:00:00 840.59 kB/s
ipaddress-1.0. 100% |################################################################################################################################################| Time: 0:00:00 700.31 kB/s
jdcal-1.3-py27 100% |################################################################################################################################################| Time: 0:00:00   9.61 MB/s
multipledispat 100% |################################################################################################################################################| Time: 0:00:00  15.75 MB/s
pkginfo-1.3.2- 100% |################################################################################################################################################| Time: 0:00:00 731.80 kB/s
ply-3.9-py27_0 100% |################################################################################################################################################| Time: 0:00:00   1.13 MB/s
psutil-4.4.2-p 100% |################################################################################################################################################| Time: 0:00:00   1.58 MB/s
pycparser-2.16 100% |################################################################################################################################################| Time: 0:00:00   1.04 MB/s
pyflakes-1.3.0 100% |################################################################################################################################################| Time: 0:00:00 882.52 kB/s
pymysql-0.7.9- 100% |################################################################################################################################################| Time: 0:00:00   1.11 MB/s
pyzmq-16.0.0-p 100% |################################################################################################################################################| Time: 0:00:00   2.34 MB/s
qtpy-1.1.2-py2 100% |################################################################################################################################################| Time: 0:00:00  22.99 MB/s
sqlalchemy-1.1 100% |################################################################################################################################################| Time: 0:00:00   3.52 MB/s
werkzeug-0.11. 100% |################################################################################################################################################| Time: 0:00:00   1.64 MB/s
xlsxwriter-0.9 100% |################################################################################################################################################| Time: 0:00:00   1.30 MB/s
xlwt-1.1.2-py2 100% |################################################################################################################################################| Time: 0:00:00   1.05 MB/s
babel-2.3.4-py 100% |################################################################################################################################################| Time: 0:00:00   8.44 MB/s
cffi-1.8.3-py2 100% |################################################################################################################################################| Time: 0:00:00   1.66 MB/s
lxml-3.6.4-py2 100% |################################################################################################################################################| Time: 0:00:00   6.54 MB/s
openpyxl-2.4.0 100% |################################################################################################################################################| Time: 0:00:00   1.61 MB/s
partd-0.3.6-py 100% |################################################################################################################################################| Time: 0:00:00   1.15 MB/s
pillow-3.4.2-p 100% |################################################################################################################################################| Time: 0:00:00   2.91 MB/s
prompt_toolkit 100% |################################################################################################################################################| Time: 0:00:00   1.45 MB/s
pytest-3.0.3-p 100% |################################################################################################################################################| Time: 0:00:00   1.31 MB/s
qtawesome-0.3. 100% |################################################################################################################################################| Time: 0:00:00   1.43 MB/s
anaconda-clien 100% |################################################################################################################################################| Time: 0:00:00 905.37 kB/s
conda-build-2. 100% |################################################################################################################################################| Time: 0:00:00   1.58 MB/s
cryptography-1 100% |################################################################################################################################################| Time: 0:00:00   2.78 MB/s
flask-0.11.1-p 100% |################################################################################################################################################| Time: 0:00:00 909.66 kB/s
sphinx-1.4.8-p 100% |################################################################################################################################################| Time: 0:00:00   3.59 MB/s
bokeh-0.12.3-p 100% |################################################################################################################################################| Time: 0:00:00   5.88 MB/s
conda-manager- 100% |################################################################################################################################################| Time: 0:00:00   1.04 MB/s
odo-0.5.0-py27 100% |################################################################################################################################################| Time: 0:00:00   1.40 MB/s
pyopenssl-16.0 100% |################################################################################################################################################| Time: 0:00:00 777.68 kB/s
dask-0.11.1-py 100% |################################################################################################################################################| Time: 0:00:00   2.46 MB/s
blaze-0.10.1-p 100% |################################################################################################################################################| Time: 0:00:00   2.32 MB/s
qt-4.8.7-4.tar 100% |################################################################################################################################################| Time: 0:00:01  24.39 MB/s
pyqt-4.11.4-py 100% |################################################################################################################################################| Time: 0:00:00   6.72 MB/s
anaconda-navig 100% |################################################################################################################################################| Time: 0:00:00   7.01 MB/s
scikit-image-0 100% |################################################################################################################################################| Time: 0:00:01  25.49 MB/s
Extracting packages ...
[      COMPLETE      ]|###################################################################################################################################################################| 100%
Unlinking packages ...
[      COMPLETE      ]|###################################################################################################################################################################| 100%
Linking packages ...
[      COMPLETE      ]|###################################################################################################################################################################| 100%

All 3 comments

I am having this same issue. Has this been resolved?

After the update was finished, I cannot run any conda commands. E.g.

$ conda --version
Traceback (most recent call last):
  File "/content/username/SOFTWARE/anaconda2/bin/conda", line 4, in <module>
    import conda.cli
ImportError: No module named conda.cli

Transactions were introduced in conda 4.3 to make sure this never happens again.

I have the similar issues after update conda via pip...

$pip intall update conda 
$ conda 
Traceback (most recent call last):
  File "//anaconda/bin/conda", line 7, in <module>
    from conda.cli.pip_warning import main
ImportError: No module named 'conda'
$ 
Was this page helpful?
0 / 5 - 0 ratings