Traceback (most recent call last):
File “/home/ubuntu/.local/bin/tutor”, line 5, in
from tutor.commands.cli import main
ModuleNotFoundError: No module named ‘tutor’
There’s a couple ways you can do it but the recommended method is to source the venv which you can do in bashrc, this will ensure your environment is loaded immediately upon login
#Python Virtual Environment configuration
#The "export" method is not recommended as it doesn't fully utilise all environment variables and may cause issues, stick with "source" to activate it
#export PATH=~/venv/bin:$PATH
source ~/venv/bin/activate
its required that the file be sourced for every logged-in session. you can either run source ~/venv/bin/activate manually after every login, or by adding it to the ~/.bashrc file (only needed once, it’ll stay there) it will always happen automagically after login (most convenient)
If you haven’t added it to bashrc yet, you can append it to the bottom of the file like this: echo 'source ~/venv/bin/activate' >> ~/.bashrc
then exit your shell and login again, you should see the (venv) in the commandline like this:
(venv) tutor@TutorLMS:~$ tutor --version
tutor, version 19.0.2
If you then type which python it should tell you the path to your python instance:
(venv) tutor@TutorLMS:~$ which python
/home/tutor/venv/bin/python