When running ~$ tutor local launch
I get the following error:
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’
Thought it might have been by bashrc so I ran
_TUTOR_COMPLETE=bash_source tutor >> ~/.bashrc
And got the same eror.
It looks like if I run tutor from the newly required virtual environment I can do what I need
/home/ubuntu/venv/bin
Is there a way to fix the paths in bashrc?
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
Thanks joel.edwards, works after I activate via prompt
Do I only need to do that once or do I need to add it to a config file somewhere?
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