Errors when setting up a Python Virtual Environment with Squish

Last edited on

This assumes you have used the blog article Setting Up a Python Virtual Environment with Squish to set up Squish with your Python Virtual Environment.

No module named 'encoding' and similar import errors

You may get an error similar to...

ImportError: No module named 'encoding'

...or...

ImportError: No module named '_ctypes'

...when starting a Python test case in squishrunner. If you are using virtualenv version 20 and above, the virtual environment will not copy libraries from the source Python installation. As the squishrunner does not activate the virtual environment, paths to the libraries of the source Python are not set.

This is because of changes in Python which outdated the instructions in the blog article mentioned above. See Using Python Virtual Environments in Squish for updated setup instructions.