ModuleNotFoundError: No module named 'auth0.v3' when running a python script

Problem statement

The following error is being returned when attempting to run a Python script, which leverages the auth0-python library, to export users:

>> python3 export.py
Traceback (most recent call last):
File "/export.py", line 7, in <module>
from tools import Config, get_auth0
File "tools.py", line 4, in <module>
from auth0.v3 import Auth0Error
ModuleNotFoundError: No module named 'auth0.v3'

Symptoms

The following error is returned when running a python script:

Cause

The issue is with the 4.0 version of the auth0-python library. The script provided was written before that version’s release, so any machines running the newest version of that library will experience that issue for that particular script.

Solution

If leveraging a Python script that is not compatible with the newest auth0-python version, explicitly setting the version to a previous release (as shown below) should resolve the issue.

>pip install auth0-python==3.24.1

Related References