Installed Python modules do not seem to be accessible

python

#1

In my Ci process I have Python requirements.txt setup to install mock and coverage packages. In CircleCi it runs the install portion without errors. How ever when I try to access “coverage” it tells me “No module named coverage”. I would greatly appreciate any help in sorting this out. I figure it is probably something pretty simple.

This is a fairly small project and it is working locally. Unfortunately locally I’m running on a Windows Platform. I have tried rebuilding with and without cache.

Contents of my requirements.txt file:

mock>=2.0.0
coverage>=4.5.1`

Here is the install dependency step output:

#!/bin/bash -eo pipefail
python3 -m venv venv
. venv/bin/activate
pip install -U pip setuptools virtualenv
pip install -r requirements.txt

Requirement already up-to-date: pip in ./venv/lib/python3.6/site-packages
Collecting setuptools
Downloading setuptools-38.5.1-py2.py3-none-any.whl (489kB)
98% |███████████████████████████████▍| 481kB 31.4MB/s eta 0:00:01 100% |████████████████████████████████| 491kB 2.2MB/s
Collecting virtualenv
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
50% |████████████████ | 911kB 34.1 100% |████████████████████████████████| 1.8MB 841kB/s
Installing collected packages: setuptools, virtualenv
Found existing installation: setuptools 28.8.0
Uninstalling setuptools-28.8.0:
Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-38.5.1 virtualenv-15.1.0
Requirement already satisfied: mock>=2.0.0 in ./venv/lib/python3.6/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: coverage>=4.5.1 in ./venv/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: six>=1.9 in ./venv/lib/python3.6/site-packages (from mock>=2.0.0->-r requirements.txt (line 1))
Requirement already satisfied: pbr>=0.11 in ./venv/lib/python3.6/site-packages (from mock>=2.0.0->-r requirements.txt (line 1))

Here is the call failure step:

#!/bin/bash -eo pipefail
python -m coverage run --rcfile=…/coverage.cfg -m unittest discover

/usr/local/bin/python: No module named coverage
Exited with code 1

I’ve tried at least 10 different ways to get this to work. Here are some of the details of what I’m using:

I am using CircleCi 2.0
I am using Python 3
I am using the circleci/python:3.6.1 Docker image


#2

I don’t know if this is related, but you have the ellipsis () character in that filename. That doesn’t look right at all.


#3

You also have a backtick here, is that right?


#4

Yeah, I finally got things working late last night I had to restructure the repo a fair bit to get it setup right. In the end I discovered there problem was I needed to run the vertual environment set up before calling it. Then it worked fine.


#5

Lol I thought that was a spec on my monitor and glanced it over thank you for pointing it out


#7

Please don’t spam here. I’ll report your message, and hopefully your account will be deleted.


#8