Docker Python - Module not Found after installing


I am trying to compile a python script using my Docker container.

When I install a new library in the Docker container:

  1. I install it using the docker container’s command line:
    pip install openpyxl
    it installs succesfully

  2. but when i try and compile a python script using the same docker container i receive this error: from openpyxl import load_workbook
    ImportError: No module named ‘openpyxl’

Ha! solved my own problem … I had to select a specific ‘version’ of python in Visual Studio Code …
for some reason i had two python versions installed on the docker container… pip install installed the library to the latest on - after picking that one it worked 100%…

1 Like

@iwcoetzer thanks for echoing your solution - just spent ages trying to work out why I kept getting ImportError!
Turns out same thing - multiple versions of python… forcing to Python3 fixed it.