5

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?

1
  • Use .ebignore to remove any files you don't want uploaded to AWS EB Jul 25, 2022 at 17:20

2 Answers 2

8

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
2
  • 1
    Look into .gitignore to help in the future.
    – Kevin
    Jun 9, 2020 at 17:38
  • 4
    I had the same issue. In my case the did not add the venv to in my .ebignore so it was getting deployed to servers. I had then added venv in my .ebignore and got this error message. I resolved it by setting my autoscaling policy to 0. Once the instances were removed from the environment, I reverted the autoscaling policy back to what it was
    – sagar1025
    May 27, 2021 at 2:18
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.