Reputation: 614
Im using supervisor to run the django websocket in system startup .
When I start the supervisor it will raise
ModuleNotFoundError: No module named 'django'
in the log file .
Here is supervisor conf:
[fcgi-program:myProject]
environment=HOME="/home/ubuntu/envFiles/myProject/bin"
# TCP socket used by Nginx backend upstream
socket=tcp://0.0.0.0:8000
directory=/home/ubuntu/projects/myProject
command=daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-headers myProject.asgi:application
# Number of processes to startup, roughly the number of CPUs you have
numprocs=4
process_name=asgi%(process_num)d
autostart=true
autorestart=true
stdout_logfile=/home/ubuntu/logs/project.log
redirect_stderr=true
when i try to restart the supervisor by supervisorctl restart all
, it has import module error again.
Error log :
ModuleNotFoundError: No module named 'django'
I think it uses system python path But i defined environment
in config file so supervisor must use there environment .
whats the problem ?
How can i set my django environment files in supervisor conf ?
Upvotes: 2
Views: 3893
Reputation: 143
Hello I'm using Ubuntu 22.04.2 LTS
on my server and I was facing with the same error. You can download and install packages like this:
sudo python3 -m pip install pandas
It worked for me, I hope my answer will help you!
Upvotes: 0
Reputation: 81
Just try to install package into another python directory, i had same problem with supervisor and it was solved after this:
sudo pip install --target=/usr/local/lib/python3.6/dist-packages <packagename>
Upvotes: 7