0

I am trying to run the command (it is in a python script functional_tests.py):

from selenium import webdriver

I am running Ubuntu and here is a list of how I set up my python environment:

    2  sudo apt-get upgrade
    3  sudo apt-get update --fix-missing
    4  sudo apt-get upgrade -y
    5  sudo apt update
    6  sudo apt install software-properties-common
    9  sudo add-apt-repository ppa:deadsnakes/ppa
   10  sudo apt install python3.6
   14  mkdir python-tdd-book
   15  cd python-tdd-book/
   24  sudo apt install python3.6-venv
   25  sudo apt install python3.6
   28  python3.6 -m venv virtualenv
   33  source virtualenv/bin/activate
   34  which python
   37  pip install "django<1.12" "selenium<4"
   46  python -m pip install -U selenium

I did not get any errors when I ran #37 in history (#46 was an attempt to solve it using another solution). I had no errors - all seemed good (except wanting to upgrade version of pip).

This is the output:

(virtualenv) ubuntu@ubuntu2004:~/Documents/python-tdd-book$ python ./functional_tests.py 
Traceback (most recent call last):
  File "./functional_tests.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

According to this command I have installed selenium:

(virtualenv) ubuntu@ubuntu2004:~/Documents/python-tdd-book$ pip list
Package    Version
---------- -------
Django     1.11.29
pip        18.1   
pytz       2022.1 
selenium   3.141.0
setuptools 40.6.2 
urllib3    1.26.10
You are using pip version 18.1, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Not sure why it is NOT seeing the selenium module.

T I M
  • 83
  • 1
  • 6
  • Does [this](https://stackoverflow.com/a/59633953/6273711) help? Is there a particular reason to use python3.6 or you can try with python3.8? – Jonathan Ciapetti Jul 19 '22 at 01:13
  • The reason was to try to stick to the book TDD with Python (https://www.oreilly.com/library/view/test-driven-development-with/9781491958698/). Originally I was doing things with Conda and ran into issues, so I decided to switch to virtual envs, and ran into new issues. That being said, is there a reason that I would have to use Python 3.8, right? Why not 3.9? Thanks! – T I M Jul 19 '22 at 12:53
  • No particular reason, I was referring to the comment from the answer, I thought 3.8 could have been a good option. – Jonathan Ciapetti Jul 19 '22 at 16:52

0 Answers0