[Python] Conda install package ModuleNotFoundError: No module named 'conda'

Discussão em 'Python' iniciado por Stack, Maio 20, 2025.

  1. Stack

    Stack Membro Participativo

    I installed Conda using the scripts from bootstrap-conda.sh and install-conda-env.sh

    Conda was installed successfully. When I install the first package,

    e.g., conda install --yes lxml=4.3.0

    it worked fine. The log can be found here. But when I tried to install the second package,

    e.g., conda install --yes numpy=1.15.4

    it throws this error:

    Traceback (most recent call last):
    File "/opt/conda/default/bin/conda", line 12, in <module>
    from conda.cli import main
    ModuleNotFoundError: No module named 'conda'


    Tried every possible solution I could find, it did not help.

    Before package installation, when I type python, it takes me to Python 3.6.7

    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.


    python default import path:

    /opt/conda/default/lib/python36.zip
    /opt/conda/default/lib/python3.6
    /opt/conda/default/lib/python3.6/lib-dynload
    /opt/conda/default/lib/python3.6/site-packages
    /usr/lib/spark/python


    After package installation, when I type python, it takes me to Python 3.7.3

    Python 3.7.3 (default, Mar 27 2019, 22:11:17)
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.


    python default import path:

    /opt/conda/default/lib/python37.zip
    /opt/conda/default/lib/python3.7
    /opt/conda/default/lib/python3.7/lib-dynload
    /opt/conda/default/lib/python3.7/site-packages


    I re-installed Conda. The same problem still persists.

    Conda Version:

    conda --version


    conda 4.6.14
    ​

    When I install the first package, the following log caught my attention. It upgraded python from 3.6 to 3.7. I am not sure if this is what causes the problem.

    The following packages will be UPDATED:

    certifi conda-forge::certifi-2019.3.9-py36_0 --> pkgs/main::certifi-2019.6.16-py37_0
    libedit 3.1.20170329-h6b74fdf_2 --> 3.1.20181209-hc058e9b_0
    ncurses 6.1-hf484d3e_0 --> 6.1-he6710b0_1
    openssl conda-forge::eek:penssl-1.1.1b-h14c3975_1 --> pkgs/main::eek:penssl-1.1.1c-h7b6447c_1
    pip 10.0.1-py36_0 --> 19.1.1-py37_0
    python conda-forge::python-3.6.7-h381d211_10~ --> pkgs/main::python-3.7.3-h0371630_0
    readline 7.0-ha6073c6_4 --> 7.0-h7b6447c_5
    setuptools 39.2.0-py36_0 --> 41.0.1-py37_0
    wheel 0.31.1-py36_0 --> 0.33.4-py37_0
    zlib 1.2.11-ha838bed_2 --> 1.2.11-h7b6447c_3

    Continue reading...

Compartilhe esta Página