When testing with CircleCI can't able to import unit test2

python

#1

I am trying to run a series of Python selenium tests in CircleCI. unit test2 is a requirement, and is in a

`requirements.txt file. pip install -r requirements.txt` 

shows that everything is installed correctly.

pip install -r requirements.txt
Requirement already satisfied: chromedriver==2.24.1 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: linecache2==1.0.0 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: nose==1.3.7 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: selenium==3.4.2 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: six==1.10.0 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied: traceback2==1.4.0 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 6))
Requirement already satisfied: unittest2==1.1.0 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from -r requirements.txt (line 7))
Requirement already satisfied: argparse in /usr/lib/python2.7 (from unittest2==1.1.0->-r requirements.txt (line 7))

However, when running the test script, I get

Traceback (most recent call last):
  File "checkpipinstallation.py", line 1, in <module>
    import unittest2
ImportError: No module named 'unittest2'
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import runner
  File "/home/ubuntu/ui-tests-functional/new_tests/runner.py", line 1, in <module>
    import unittest2
ImportError: No module named 'unittest2'

bash new_tests/circleSetUp.sh returned exit code 1

Running the command from a bash shell that installs unittest2:

pip install unittest2
python3 checkpipinstallation.py
python3 main.py

checkpipinstallation py only has one line:

import unittest2

Output from running the bash script:

Requirement already satisfied: unittest2 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages
Requirement already satisfied: argparse in /usr/lib/python2.7 (from unittest2)
Requirement already satisfied: six>=1.4 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from unittest2)
Requirement already satisfied: traceback2 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from unittest2)
Requirement already satisfied: linecache2 in /home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages (from traceback2->unittest2)
Traceback (most recent call last):
  File "checkpipinstallation.py", line 1, in <module>
    import unittest2
ImportError: No module named 'unittest2'
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import runner
  File "/home/ubuntu/ui-tests-functional/new_tests/runner.py", line 1, in <module>
    import unittest2
ImportError: No module named 'unittest2'

bash new_tests/circleSetUp.sh returned exit code 1

#2