2

I have 3 projects hosted in amazon bitnami ec2 and my none of project is running. When I check my logs it showing the error as follows:

The Python egg cache directory is currently set to: /opt/bitnami/.tmp Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory.

and my projects are in /opt/bitnami/projects (all 3 project within that directory).

How can I solve this?

Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
gur
  • 23
  • 1
  • 6
  • 1
    possible duplicate of [What is the Python egg cache (PYTHON_EGG_CACHE)?](http://stackoverflow.com/questions/2192323/what-is-the-python-egg-cache-python-egg-cache) – Shawn Chin Aug 24 '11 at 09:37
  • Have you checked the permission on /opt/bitnami/tmp ? What user is your python project running under? Does that user have write access to /opt/bitnami/tmp ? – arunkumar Aug 24 '11 at 09:39
  • yes... i change the permission of /opt/bitnami/.tmp to 777 still its showing error and im running my 3 projects which is under projects folder none of project is running... when i check my logs...it shows The Python egg cache directory is currently set to: /opt/bitnami/.tmp Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. – gur Aug 25 '11 at 07:45

1 Answers1

6

You just need to give permissions to the daemon user in that folder.

sudo chown -R daemon.daemon /opt/bitnami/.tmp
sudo chmod -R 700 /opt/bitnami/.tmp

Also if you are using a version of the BitNami Trac Stack that already uses mod_wsgi (0.12.2-1 or later) you can configure the PYTHON_EGG_CACHE to point to a different location. In the trac.wsgi file you just need to add:

os.environ['PYTHON_EGG_CACHE'] = '/path/to/python_egg_cache'

Just check that the daemon user has enough permissions in that directory.

kaysa
  • 1,491
  • 13
  • 9
  • It depends on which BitNami Trac Stack version are you using. Before 0.12.2-1 this file was not used because the stack was configured with mod_python. For later versions check the /opt/bitnami/trac/conf or /opt/bitnami/trac/scripts folder. – kaysa Aug 25 '11 at 09:50
  • actually im still gettin same error .... The Python egg cache directory is currently set to: /opt/bitnami/.tmp Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. and ever i tried all your given solution but no success..... – gur Aug 25 '11 at 10:11
  • I think I have assumed you were using the BitNami Track AMI. Is that correct or are you using a different BitNami AMI? Also, you mention that you check the logs, which logs are you checking? I though that you were referring to the apache logs. – kaysa Aug 25 '11 at 11:01
  • no im not using Bitnami track ami. but please help me trying solving this error..... – gur Aug 26 '11 at 08:10
  • Ok. Please could you provide more details? You mentioned that your projects are in /opt/bitnami/projects, you are using a BitNami AMI, right? Which one? Even if you are not using bitnami. When do you receive the error? Executing something manually? or something that is served by apache? It seems just a permission issue, we just need to figure out which user needs to have access to that forthe, but we need more details on what you are trying to achieve. Thanks! – kaysa Aug 26 '11 at 08:24
  • yes,im using bitnami ec2 amazon machine. and im sending my apache httpd conf file in 3 parts because it too long. i think then you able to knw properly... yes i mention my projects in /opt/bitnami/projects and i check the error log file it showing The Python egg cache directory is currently set to: /opt/bitnami/.tmp Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. plz help – gur Aug 26 '11 at 08:45
  • User daemon Group daemon ServerName localhost:80 DocumentRoot "/opt/bitnami/projects" RedirectMatch /fortis1 /fortis/login/ RedirectMatch /myfood1 /myfood/index/ RedirectMatch /scene_finder1 /scene_finder/index/ RedirectMatch /fortis_meds1 /fortis_meds/login_ipd/ RedirectMatch /batra1 /batra_hospital/login/ Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all – gur Aug 26 '11 at 08:56
  • LoadModule wsgi_module modules/mod_wsgi.so WSGIPythonHome /opt/bitnami/python Include "/opt/bitnami/apache2/conf/ssi.conf" Include "/opt/bitnami/apps/django/conf/django.conf" Include "/opt/bitnami/apps/django/conf/django1.conf" Include "/opt/bitnami/apps/django/conf/django2.conf" Include "/opt/bitnami/apps/django/conf/django3.conf" Include "/opt/bitnami/apps/django/conf/django4.conf" now please tel me where im wrong i send you my apache httpd.conf main part this way im using the project but dont knw why again same error python egg cache thanx in advance – gur Aug 26 '11 at 08:59
  • The solution posted above should work also for the BitNami DjangoStack. First we are going to check the permissions for the pythong egg folder. Can you execute the following? "sudo ls -la /opt/bitnami". – kaysa Aug 26 '11 at 09:07
  • yes i execute your given solution 'sudo ls -la /opt/bitnami' it showing use_djangostack having 755 perminssion and .tmp has 777 permission and projects folder having 777 permission now what to do plz next step what should i do???? plz help... – gur Aug 26 '11 at 09:49
  • The egg folder is /opt/bitnami/.tmp It seems that it has right permissions but may not its content. Can you execute "sudo chown -R daemon.daemon /opt/bitnami/.tmp" and "sudo chmod -R 777 /opt/bitnami/.tmp". I have added the -R option so it also change the permissions and owner of what the folder have inside. – kaysa Aug 26 '11 at 10:14
  • now its showing this error: and also my apache not running now wat to do??? Warning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored Warning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored – gur Aug 26 '11 at 10:46
  • "sudo chmod -w /opt/bitnami/mysql/my.cnf" To fix that problem. – kaysa Aug 26 '11 at 10:49
  • when i did that as u said... after that it show this error (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") when im trying to login with my project.... – gur Aug 26 '11 at 11:01
  • Is the previous issue solved? It seems that this is a different issue not related to python but to django configuration. In BitNami MySQL is using the /opt/bitnami/mysql/tmp/mysql.sock socket. So you can configure your django project to connect using that socket https://docs.djangoproject.com/en/dev/ref/databases/#connecting-to-the-database. Another option would be to modify the my.cnf file to use a different socket. – kaysa Aug 26 '11 at 11:09
  • yes, thanx kaysa that previous ehh cache prob solved.... thanx... and now this error (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") plz help.... – gur Aug 26 '11 at 11:24
  • In the link above (django docs) you can see how to configure your projects for connecting to a database. You need to edit the settings.py file in your projects. Another solution is or modify the my.cnf file and change the socket entries. – kaysa Aug 26 '11 at 11:42
  • yes i follow the link as given above.. but still its showing same error error (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") even if i right mysql -uroot -pbitnami in my amazon machine prompt it again showing same error.... plz not gettin – gur Aug 26 '11 at 12:17
  • I think it would be better to create a new question for this.In any case, maybe the easier option for you would be edit the my.cnf, change all the values for: socket=/opt/bitnami/mysql/tmp/mysql.sock to: socket=/tmp/mysql.sock and then execute: 'sudo /opt/bitnami/ctlscript.sh restart'. – kaysa Aug 26 '11 at 13:34
  • i did that as what u say change socket=/opt/bitnami/mysql/tmp/mysql.sock to: socket=/tmp/mysql.sock still same error... error (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") dont know exactly wats wrong im not getting plz help.... – gur Aug 26 '11 at 15:07
  • Did you change all the strings? I think that you can find three times in the file. If so the you just need to restart the database. 'sudo /opt/bitnami/ctlscript.sh restart' – kaysa Aug 26 '11 at 15:15
  • yes... i find socket 3 times and i changed it to '/tmp/mysql.sock' as u sad and also restart the apache but still same error :( not getting exactly... plz help... aand thanx.. for your support... kaysa... – gur Aug 26 '11 at 15:27
  • What do you get when you execute 'sudo /opt/bitnami/ctlscript.sh restart' also, have been the /tmp/mysql.sock file created? – kaysa Aug 26 '11 at 15:29
  • actually when i restart apache and then try to run my application when i click on my login button of my application it shows error (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") now what to do to fix this error?????? – gur Aug 26 '11 at 15:34
  • but... are you only restarting apache? you need to restart also mysql. 'sudo /opt/bitnami/ctlscript.sh restart' will restart all the servers. If you restart the servers after modifying the my.cnf /opt/bitnami/mysql/tmp will be empty and the new mysql.sock will create in /tmp. Does the /tmp/mysql.sock exist after restarting the servers? – kaysa Aug 26 '11 at 15:50
  • it show this error when i restart /opt/bitnami/mysql/scripts/ctl.sh : mysql not running Warning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored Warning: World-writable config file '/opt/bitnami/mysql/my.cnf' is ignored 110826 15:54:19 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'. 110826 15:54:19 mysqld_safe Starting mysqld daemon with databases from /opt/bitnami/mysql/data 110826 15:54:24 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/ip-10-1 28-211-121.pid ended – gur Aug 26 '11 at 16:04
  • 'sudo chown root.root /opt/bitnami/mysql/my.cnf' then 'sudo chmod 644/opt/bitnami/mysql/my.cnf' if you need to edit that file in the future, please it with sudo (or as root user). Now restart the servers. – kaysa Aug 26 '11 at 16:21
  • Please don't use the comment field for chatting about this or similar problems, either ask new questions on the site or take it to a chatroom. – Lasse V. Karlsen Aug 26 '11 at 19:52