Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk chown PythonPath error

I am deploying a web app on AWS's elastic beanstalk and am coming across the same error:

[StageApplication]. Stop running the command. Error: chown /var/app/staging/venv/bin/python: no such file or directory.

I see in my environment configuration the property: PYTHONPATH : /var/app/venv/staging-LQM1lest/bin

My app runs perfectly fine locally with the command 'python applicaiton.py'.

Any advice on how I can fix this?

like image 976
MacGlass Avatar asked Mar 03 '23 11:03

MacGlass


2 Answers

Make sure you aren't pushing your local venv to your EB referenced Git Repo. I was trying to make updates from another machine and accidentally pushed it to master which caused this exact error. I had to use the following to remove it even after adding to gitignore file. Give that a shot and/or double check.

git rm -r --cached venv
git commit -m 'Remove the now ignored directory venv'
git push origin master
like image 81
tmendel13 Avatar answered Mar 05 '23 15:03

tmendel13


I discovered that eb deploy was deploying my local venv directory, even though it was in .gitignore. I confirmed this by going to "Application versions" in the sidebar and downloading the deployed .zip file under the "source" column. Sure enough, my venv was in there.

I was running eb deploy from a subdirectory in my git repo. As I intended, eb was only deploying this subdirectory. However, for some reason, it was ignoring the .gitignore file I had in this subdirectory. I added a .ebignore file and put my venv in there, and it fixed the problem. Note that when using .ebignore, eb no longer deploys what's commited in git, but rather what's in the working directory. More here.

like image 25
echelon315 Avatar answered Mar 05 '23 16:03

echelon315