AWS Elastic Beanstalk chown PythonPath error
Asked Answered
L

4

9

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?

Larval answered 14/5, 2020 at 18:58 Comment(1)
Use .ebignore to remove any files you don't want uploaded to AWS EBCarding
W
9

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
Woodenhead answered 9/6, 2020 at 17:28 Comment(2)
Look into .gitignore to help in the future.Revelatory
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 wasSheriff
S
5

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.

Succussion answered 14/7, 2021 at 9:0 Comment(0)
N
0

I had the same problem. At some point we were accidentally deploying the virtual environment directory to the EB instance. Adding virt/ to .ebignore resulted in the same error on the failing instance build. In my case:

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

The solution was to remove all compiled python code (.pyc files). I added the following 2 lines to .ebignore to ensure they weren't packaged up by the EB CLI:

__pycache__/

*.pyc
Nympholepsy answered 22/7 at 22:15 Comment(0)
C
0

I had the same issue, just added a line to ignore those links to my .gitignore file: Just add this line fixed it:

my_venv/bin/python*
Codex answered 26/7 at 21:18 Comment(1)
Existing answers were valid enough to just add a comment to the one matching your solutionCrow

© 2022 - 2024 — McMap. All rights reserved.