Crash while running virtualenv

I’m converting a v1 to a v2.0 circleci. I have the following section in my config.yml:
- run:
name: Install dependencies using requirements.txt
command: |
python -m virtualenv venv
. venv/bin/activate
pip -q install -r requirements.txt
pip install pytest

It’s crashing during the python -m virtualenv venv step with:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 238, in <module>
    class Logger(object):
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 245, in Logger
    DEBUG = logging.DEBUG
AttributeError: module 'logging' has no attribute 'DEBUG'
Exited with code 1

It hasn’t even done anything yet, so I’m not sure what’s wrong with it…

Possibly related is that it says I’m using version 1 of circleci, but I’m pretty sure it’s using my config.yml which is version 2…

Which base image are you using?

Are you able to share your config with us?

I’m not sure what image I’m using.

Config is:

version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.7
    steps:
      - checkout
      - run:
          name: "Pull Submodules"
          command: |
            git submodule init
            git submodule update --remote
      - run:
          name: update for database related stuff
          command: |
            sudo apt-get update
            sudo apt-get install g++
            sudo apt-get install unixodbc-dev
      - run:
          name: Install Pip
          command: 'sudo pip install --upgrade pip'
      - run:
          name: Install Virtualenv
          command: 'pip install virtualenv'
      - run:
          name: Install dependencies using requirements.txt
          command: |
            python -m virtualenv venv
            . venv/bin/activate
            pip -q install -r requirements.txt
            pip install pytest
      - run:
          name: Run Tests (minus the end-to-ends)
          command: |
            . venv/bin/activate
            python -m pytest tests/ -vv -rsx

Thanks for the additional info, I was not able to reproduce this. Does this happen consistently?

yes. it happens every time.

I also can’t reproduce this. Can you open a ticket with your job url and share the number so I can take a look at your job?

I have created a ticket: 47687

thanks!

2 Likes

After running a SSH build, it was discovered there was a logging.py file in the repo that venv was importing instead of the built-in module. @cepbrian gets all the credit for solving this one, I’m not sure we would have been able to discover it otherwise, since we don’t have access to the project source code normally.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.