ERROR: Unknown or duplicate parameter: WSGIPath - django

I'm currently trying to deploy a Django 1.7, Python 3.4 WebApp to AWS Elastic Beanstalk. I'm following the guide on the AWS site, but when I try using their config files in the .ebextensions directory, the line "option_name: WSGIPath" seems to give me the error "ERROR: Unknown or duplicate parameter: WSGIPath"

I had the same issue on eb create command, but I solved this problem a moment ago.
It's because I have selected the incorrect option ( fourth ) while I executing eb init command on CLI,
Select a platform version.
1) Python 3.4
2) Python 2.7
3) Python
4) Python 3.4 (Preconfigured - Docker)
(default is 1): 4
So I started the sample project again, At this time I just selected the first, then I was able to finish the AWS guide.

Related

No Such File or Directory when Deploying Django to Elastic Beanstalk with Immutable Deployment Policy

I have already deployed my Django project to EB on AWS and it is working fine.
I tried deploying it now with an Immutable Deployment Policy and I am getting this error:
Command failed on instance. Return code: 2 Output: python: can't open file '/opt/python/current/app/manage.py': [Errno pt/python/current/app/manage.py': [Errno 2] No such file or directory.
And that happens during the command: source /opt/python/current/env && python /opt/python/current/app/manage.py migrate
For some reason, I can't include that command on the first deployment.
Does anyone know how to use the immutable deployment method with Django?
The following:
source /opt/python/current/env && python /opt/python/current/app/manage.py migrate
is useful when you ssh into the EB instance and want to manually run your code with environmental variables.
When you deploy your EB, container_commands in your .ebextensions would be better in my view.
For example, you could have the following file .ebextensions/10_run_migrate.config
container_commands:
10_run_migrate:
command: 'python ./manage.py migrate'
Please note that this is an example only. Thus the file may require adjustment with Django specific commands or settings.

Your Requirement.txt is invalid : returned non zero exit status1

I am trying to deploy django app on AWS elastic Beanstalk. on local machine i made a virtual environment and got all required libraries in requirements.tx using freeze command.
After creating app as per the tutorial on aws i used eb create app_name-env -s (-s for single instance) I am getting following error
you can see eb-activity-log file here https://drive.google.com/file/d/1PMX9ep6ZDZPk2jN-Fdbl3LyjLmMTAkhE/view?usp=sharing
also requirement.txt here https://drive.google.com/file/d/1KnxP_v0DQcA4QezXKO_6-CBbgpAlEnvD/view?usp=sharing
Note- i am using python3.6 on local machine as well as creating eb app using python3.6.
What is the cause for this error and how to resolve it?

AWS EMR script-runner access error

I'm running emr-5.12.0, with Amazon 2.8.3, Hive 2.3.2, Hue 4.1.0, Livy 0.4.0, Spark 2.2.1 and Zeppelin 0.7.3 on 1 m4.large as my master node and 1 m4.large as core node.
I am trying to execute a bootstrap action that configures some parts of the cluster. One of these includes the line:
sudo sed -i '/zeppelin.pyspark.python/c\ \"zepplin.pyspark.python\" : \"python3\",' /etc/alternatives/zeppelin-conf/interpreter.json
It makes sure that the Zeppelin uses python3.4 instead of python2.7. It works fine if I execute this in the terminal after SSH'ing to the master node, but it fails when I submit it as a Custom JAR step on the AWS Web interface. I get the following error:
ed: can't read /etc/alternatives/zeppelin-conf/interpreter.json
: No such file or directory
Command exiting with ret '2'
The same thing happens if I use
sudo sed -i '/zeppelin.pyspark.python/c\ \"zepplin.pyspark.python\" : \"python3\",' /etc/zeppelin-conf/interpreter.json
Obviously I could just change it from the Zeppelin UI, but I would like to include it in the bootstrap action.
Thanks!
It turns out that a bootstrap action submitted throug the AWS EMR web interface is submitted as a regular EMR step, so it's only run on the master node. This can be seen if you click the 'AWS CLI export' in the cluster web interface. The intended bootstrap action is listed as a regular step.
Using the command line to launch a cluster with a bootstrap action bypasses this problem, so I've just used that.
Edit: Looking back at the web interface, it's pretty clear that I was adding regular steps instead of bootstrap actions. My bad!

haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'

I am newbie to Django-haystack. I got an error while following Django-Haystack documentation.
Command execution order, I followed:
I started elasticsearch server (1.7.3) using command prompt and I am able to access http://127.0.0.1:9200/
python manage.py rebuild_index
Output:
WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the rebuild_index command.
Are you sure you wish to continue? [y/N] y
Error:
packages\haystack\backends\elasticsearch_backend.py", line 28, in
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.")
haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
Current Platform (Windows):
1. Django 1.8
2. elasticsearch: 1.9.0 (installed through pip)
3. pyelasticsearch: 0.0.5 (installed through pip)
4. elasticseach: 1.7.3 (downloaded to start elasticsearch server)
I have tried adding the 'elasticsearch' also to my installed apps but the same error exists.
It seems there is version compatibility problems (perhaps in pyelasticseach) as I found some others also faced the same issue. Any help would be appreciated. Thanks.

AWS Elastic Beanstalk - ERROR: No Application Version named 'v0_9_2-76-gf5a4' found

I'm trying to deploy my code to AWS Beanstalk and get this error. I researched that it could be that the number of versions is more than 500, so I deleted a lot of versions. But, I still get this error.
eb deploy
ERROR: No Application Version named 'v0_9_2-76-gf5a4' found.
I also tried
git aws.push
Error: Failed to create the AWS Elastic Beanstalk application version
Edit:
Trying with eb deploy --debug I now get:
Instance: i-2ad238d5 Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed . Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 18
ebcli.objects.exceptions.ServiceError: Update environment operation is
complete, but with errors. For more information, see troubleshooting
documentation.
Did you update the file .elasticbeanstalk/config.yml ? It may have a wrong setup.
Make a backup of .elasticbeanstalk/ folder and remove it
Execute eb create
Select the same region you deployed it before. You can check the region on .elasticbeanstalk/config.yml backup
A list with the environments will appear, select the right one
Deploy now
Remove the .elasticbeanstalk/config.yml backup
Check for the .elasticbeanstalk/config.yml file
environment: CORRECT_ENV_NAME
global:
application_name: CORRECT_APP_NAME
In my case, I was doing eb deploy X where X was an environment for a different project.
When I had the error
InvalidParameterValueError: No Application Version named 'app-9f5c-180927_071528' found.
I fixed this by specifying the label I wanted to push up.
eb deploy XXX-env -l XXX.0.0.1
The -l flag is documented AWS EB Deploy Docs
most likely, the deploy is trying an incorrect Elasticbeanstalk Application. it could be because you renamed the application in the AWS console.
so double check you're pointing to the correct elasticbeanstalk Environment and Application. it could be picking out default values from your .elasticbeanstalk/config.yml file.