Python No Module Named Site Error Solved

The Python no module named site is a type of ImportError that arises when a module is used or tried to access, but the ‘site’ module is not found. The ‘site’ module is a crucial part of the Python standard library; therefore, there is an error in accessing the Python no module named site. This guide will give you a walkthrough of the Python no module named site ImportError and help you find the probable solution.

What is Python no module named site?

The Python no module named site is a type of ImportError. It arises when you try to run a Python script or program. Still, the Python interpreter cannot Import the site module, which is responsible for configuring the Python runtime environment, which could be setting paths for Python packages and modules. If the site module is not found, it won’t be able to properly set up the runtime environment, which may result in the failure of the Python script or program.

Why do we get no module named site ImprtError And Solution for It?

The Python no module named site ImportError can be caused because of one of the following causes listed below, along with the solution.

Squish source builds without Python Configuration.

The Python no module named site ImportError may also occur when the Squid source is built without Python configuration. This is a very common cause and appears in almost every version. But it is a very easy cause to tackle.

Solution for Squish source builds without Python Configuration.

To solve the Squish Source builds without Python configuration, you either have to set the environment variable Pythonhome to the path of the Python libraries, or you can add the following command.

Syntax: –

Scripting/PythonHome = "C:\Python27"

Also, in this method, you need to put the following command in the file along with the proper path for Python Installation.


Also, you can set the command prompt permanently for the subsequent prompts by using the following command.

setx PYTHONHOME C:\Python27

Presence of Python-related Environment Variables

Another cause for Python no module named site ImportError is the Presence of Python-related Environment variables. This problem occurs if the Pythonhome variable points to a different Python installation other than the installation used by Squish.

Solution for Presence of Python-related Environment Variables

To solve this error, you need to unset the Pythonhome environment variable before starting the Squish server or the Squish IDE.

To do so, you need to follow the following set of instructions.

  1. Start by going to the Advance system settings from the start menu.
  2.  After that, go to the Environment variables in the Advanced tab.
  3.  In the Environment variable, click on the list of user variables and type Python.
  4.  Repeat the same for the system variable to make sure you don’t have a mis-set variable for Pythonhome.
  5.  After new variables, the Python path is set to the following path.
set PYTHONHOME=c:\Python27
set PYTHONPATH=c:\Python27\Lib

How do I fix the No module named in Jupyter Notebook?

The Python no module named site ImportError occurs on Jupyter Notebook when you try to run scripts of an older version on an upgraded Python version. This can be solved by following the solutions below.

Checking pip version

To resolve Python no module named site ImportError on Jupyter, you first need to check if the pip version used in Python is the same as the Jupyter. You can check the current pip version using the following command set.

$ pip --version

Checking the kernel list

The Jupyter Notebook runs a specific version of Python that is not the same as the Python version running on the command line. The Jupyter Notebook uses a kernel or kernel spec to explain the version of Python it is using. To check the kernel, you can use the following command.

$ jupyter kernelspec list

Check the Python path.

The following set of commands shows the location of the installed module so that the no module named site ImportError does not occur because of the presence of the module in a different Python environment.


import sys

Check if the virtual environment is active.

If you are using a virtual environment in the Jupyter Notebook, you need to ensure the virtual environment is activated before the Jupyter Notebook is launched. The module used in your system should also be present in the virtual environment.


What is a ‘site’ module?

A site module is a module specifying the site.

What is ImportError?

The ImportError is a class of errors that occurs when a Python program tries to import a module that does not exist in the private table. This type of error is also known as ModuleNotFoundError. It also occurs when you try to import a submodule from the module.

What is the Jupyter Notebook?

The Jupyter Notebook is an original web application generally used to create and share computational documents. It is a part of Jupyterlab, a web-based interactive development environment. The Jupyter Notebook offers the user a simple, document-centric,, streamlined experiencer.

What is Kernel?

Kernels are a similarity function that returns a similarity using inner products when two inputs are taken.


This guide has all the information that can help you find the causes for the Python no module named site ImportError and the probable solutions that can help you resolve the Python no module named site Importerror without any issues.


  1. Jupyter

Follow us at PythonClear to learn more about solutions to general errors one may encounter while programming in Python.

Leave a Comment