Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build failed "No module named 'conda'"

See original GitHub issue


build failed


  • no custom environnement variables
  • Docker version 20.10.5, build 55c4c88
  • docker-compose version 1.29.2, build 5becea4c

how to reproduce

  1. git clone
  2. mkdir secrets
  3. echo -e admin admin > secrets/userlist
  4. generate self signed key/cert:
    • openssl genrsa 2048 > server.key
    • chmod 400 server.key
    • openssl req -new -x509 -nodes -sha256 -days 365 -key server.key -out server.crt
  5. make build


> make build
Generating postgres password in secrets/postgres.env
docker-compose build
hub-db uses an image, skipping
Building hub
Sending build context to Docker daemon  295.4kB
Step 2/9 : FROM jupyterhub/jupyterhub-onbuild:$JUPYTERHUB_VERSION
0.9.2: Pulling from jupyterhub/jupyterhub-onbuild
c64513b74145: Pull complete
01b8b12bad90: Pull complete
c5d85cf7a05f: Pull complete
b6b268720157: Pull complete
e12192999ff1: Pull complete
256ccce151e7: Pull complete
f0d04906c48f: Pull complete
3f8d9ed60d29: Pull complete
9a4e3ab6e62d: Pull complete
39d4f72bd19a: Pull complete
Digest: sha256:c44611b52a3a64494ba51cf4f2abb2cbc17ceba325e5fe172be80c6e6c3a5be8
Status: Downloaded newer image for jupyterhub/jupyterhub-onbuild:0.9.2
# Executing 1 build trigger
 ---> 119c8c9149d7
Step 3/9 : RUN /opt/conda/bin/conda install -yq psycopg2=2.7 &&     /opt/conda/bin/conda clean -tipsy &&     /opt/conda/bin/pip install --no-cache-dir         jupyterhub-dummyauthenticator         dockerspawner==12.0.*
 ---> Running in 65a57f248a0d
Solving environment: ...working... done

## Package Plan ##

  environment location: /opt/conda

  added / updated specs:
    - psycopg2=2.7

The following packages will be downloaded:

    package                    |            build
    libstdcxx-ng-9.3.0         |      hd4cf53a_17         4.0 MB
    ca-certificates-2021.5.25  |       h06a4308_1         118 KB
    libffi-3.2.1               |    hf484d3e_1007          52 KB
    openssl-1.1.1k             |       h27cfd23_0         3.8 MB
    ncurses-6.2                |       he6710b0_1         1.1 MB
    libgomp-9.3.0              |      h5101ec6_17         378 KB
    psycopg2-           |   py37h1ba5d50_0         308 KB
    readline-7.0               |       h7b6447c_5         392 KB
    wheel-0.36.2               |     pyhd3eb1b0_0          31 KB
    zlib-1.2.11                |       h7b6447c_3         120 KB
    libpq-11.2                 |       h20c2e04_0         2.7 MB
    pip-21.1.2                 |   py37h06a4308_0         2.0 MB
    _libgcc_mutex-0.1          |             main           3 KB
    setuptools-52.0.0          |   py37h06a4308_0         921 KB
    ld_impl_linux-64-2.35.1    |       h7274673_9         637 KB
    krb5-1.16.4                |       h173b8e3_0         1.4 MB
    sqlite-3.33.0              |       h62c20be_0         2.0 MB
    libedit-3.1.20210216       |       h27cfd23_1         190 KB
    certifi-2021.5.30          |   py37h06a4308_0         141 KB
    xz-5.2.5                   |       h7b6447c_0         438 KB
    libgcc-ng-9.3.0            |      h5101ec6_17         7.8 MB
    python-3.7.7               |h191fe78_0_cpython        52.6 MB
    _openmp_mutex-4.5          |            1_gnu          22 KB
                                           Total:        81.0 MB

The following NEW packages will be INSTALLED:

    _libgcc_mutex:    0.1-main
    _openmp_mutex:    4.5-1_gnu
    krb5:             1.16.4-h173b8e3_0
    ld_impl_linux-64: 2.35.1-h7274673_9
    libgomp:          9.3.0-h5101ec6_17
    libpq:            11.2-h20c2e04_0

The following packages will be UPDATED:

    ca-certificates:  2018.4.16-0             conda-forge --> 2021.5.25-h06a4308_1
    certifi:          2018.8.13-py36_0        conda-forge --> 2021.5.30-py37h06a4308_0
    decorator:        4.3.0-py_0              conda-forge --> 4.3.0-py_0               conda-forge
    ipython_genutils: 0.2.0-py_1              conda-forge --> 0.2.0-py_1               conda-forge
    jinja2:           2.10-py_1               conda-forge --> 2.10-py_1                conda-forge
    libedit:          3.1.20170329-haf1bffa_1 conda-forge --> 3.1.20210216-h27cfd23_1
    libffi:           3.2.1-hd88cf55_4                    --> 3.2.1-hf484d3e_1007
    libgcc-ng:        7.2.0-hdf63c60_3                    --> 9.3.0-h5101ec6_17
    libstdcxx-ng:     7.2.0-hdf63c60_3                    --> 9.3.0-hd4cf53a_17
    ncurses:          6.1-hfc679d8_1          conda-forge --> 6.2-he6710b0_1
    openssl:          1.0.2o-h470a237_1       conda-forge --> 1.1.1k-h27cfd23_0
    pip:              18.0-py36_1             conda-forge --> 21.1.2-py37h06a4308_0
    python:           3.6.6-h5001a0f_0        conda-forge --> 3.7.7-h191fe78_0_cpython
    readline:         7.0-ha6073c6_4                      --> 7.0-h7b6447c_5
    setuptools:       39.0.1-py36_0                       --> 52.0.0-py37h06a4308_0
    sqlite:           3.24.0-h2f33b56_0       conda-forge --> 3.33.0-h62c20be_0
    wheel:            0.31.0-py36_0                       --> 0.36.2-pyhd3eb1b0_0
    xz:               5.2.3-h55aa19d_2                    --> 5.2.5-h7b6447c_0
    zlib:             1.2.11-ha838bed_2                   --> 1.2.11-h7b6447c_3

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working...
Traceback (most recent call last):
  File "/opt/conda/bin/conda", line 7, in <module>
    from conda.cli import main
ModuleNotFoundError: No module named 'conda'
The command '/bin/sh -c /opt/conda/bin/conda install -yq psycopg2=2.7 &&     /opt/conda/bin/conda clean -tipsy &&     /opt/conda/bin/pip install --no-cache-dir         jupyterhub-dummyauthenticator         dockerspawner==12.0.*' returned a non-zero code: 1
ERROR: Service 'hub' failed to build : Build failed
make: *** [build] Error 1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

HiloadProgrammercommented, Oct 28, 2021

In Dockerfile.jupyterhub the line RUN /opt/conda/bin/conda install -yq psycopg2=2.7 updates the python version from 3.6.6 to 3.7.*. Therefore you will get a similar error as Conda #9672: No module named ‘conda’ . To fix this issue I added the line RUN echo "python 3.6.*" > /opt/conda/conda-meta/pinned before I installed psycopg2 to pin the python version.

manicscommented, Dec 5, 2022

This was updated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - After Anaconda installation, conda command fails ...
If anaconda was installed by the root user, a permissions issue could produce the ImportError: No module named 'conda.cli' error.
Read more >
from conda.cli import main ModuleNotFoundError: No module ...
This is a bug in the conda solver. When conda switched out the python version to comply with your request to install imbalanced-learn...
Read more >
Modulenotfounderror: no module named conda : Get Solution
modulenotfounderror: no module named conda error if Anaconda Environment is either not properly installed or underline python is incompatible.
Read more >
ModuleNotFoundError: No module named 'conda'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'conda' How to remove the ModuleNotFou.
Read more >
ModuleNotFoundError: No module named 'conda' - Super User
conda is a Python script which tries to import stuff from the conda module without success. Either remove conda from /usr/bin/ or make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found