2

I have Windows 7 and Python 2.7 with setuptools installed.

After i download pitz module (easy_install pitz), Google App Engine stop working:

bad runtime process port ['']

Traceback (most recent call last):
  File "G:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line 184, in <module>
    _run_file(__file__, globals())
  File "G:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line 180, in _run_file
    execfile(script_path, globals_)
  File "G:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\runtime.py", line 28, in <module>
    from google.appengine.ext.remote_api import remote_api_stub
  File "G:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 75, in <module>
    import yaml
  File "G:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\__init__.py", line 14, in <module>
    from cyaml import *
  File "G:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\cyaml.py", line 5, in <module>
    from _yaml import CParser, CEmitter
  File "C:\Python27\lib\site-packages\pyyaml-3.11-py2.7-win-amd64.egg\_yaml.py", line 7, in <module>
  File "C:\Python27\lib\site-packages\pyyaml-3.11-py2.7-win-amd64.egg\_yaml.py", line 4, in __bootstrap__
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 950, in resource_filename
    self, resource_name
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 1607, in get_resource_filename
    self._extract_resource(manager, self._eager_to_zip(name))
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 1667, in _extract_resource
    manager.extraction_error()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 996, in extraction_error
    raise err
pkg_resources.ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

  [Error 5] : 'C:\\Users\\Kostr\\AppData\\Roaming\\Python-Eggs\\pyyaml-3.11-py2.7-win-amd64.egg-tmp\\_yaml.pyd'

The Python egg cache directory is currently set to:

  C:\Users\Kostr\AppData\Roaming\Python-Eggs

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.

How to solve this issue?

kostr22
  • 576
  • 7
  • 27

2 Answers2

3

from: https://code.google.com/p/modwsgi/wiki/ApplicationIssues

To avoid this particular problem you can set the PYTHON_EGG_CACHE cache environment variable at the start of the WSGI application script file. The environment variable should be set to a directory which is owned and/or writable by the user that Apache runs as.

import os
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/pylons/python-eggs' 

Again, make sure this exists. For Windows users, maybe something like:

os.environ['PYTHON_EGG_CACHE'] = '/tmp'

Alternatively, if using mod_wsgi 2.0, one could also use the WSGIPythonEggs directive for applications running in embedded mode, or the python-eggs option to the WSGIDaemonProcess directive when using daemon mode.

Note that you should refrain from ever using directories or files which have been made writable to anyone as this could compromise security. Also be aware that if hosting multiple applications under the same web server, they will all run as the same user and so it will be possible for each to both see and modify each others files. If this is an issue, you should host the applications on different web servers running as different users or on different systems. Alternatively, any data required or updated by the application should be hosted in a database with separate accounts for each application.

GAEfan
  • 11,244
  • 2
  • 17
  • 33
  • I created "tmp" folder in my application directory and add "os.environ['PYTHON_EGG_CACHE'] = '/tmp'" string to my python file. But this doesn't solve the issue. There are even no changes in error output – kostr22 Jun 15 '14 at 15:58
  • Really? What does the log say just after `The Python egg cache directory is currently set to:`? Are you logged in as Administrator? Does '/tmp' exist, and do you have permissions to write to it? – GAEfan Jun 15 '14 at 16:12
  • it is still "C:\Users\Kostr\AppData\Roaming\Python-Eggs". I created '/tmp' folder manualy and have permissions to write it – kostr22 Jun 15 '14 at 16:32
  • So, the setting of the `PYHTON_EGG_CACHE` did not work. The code I provided is to be at the top of the WSGI app script file. Where did you place it? I also notice that you have the program split between 2 hard drives (G: and C:). You may need to use an absolute path, to make sure it goes on the correct drive. Try logging `os.environ.get('PYTHON_EGG_CACHE')` to see where it set it. – GAEfan Jun 15 '14 at 16:39
  • Does "WSGI script file" mean the main.py file of my app? I put "import os os.environ['PYTHON_EGG_CACHE'] = '/tmp' " at the top of this file right after starting comments. I have Python27 installed on "C:" disc and my project is on "G:" disc. – kostr22 Jun 15 '14 at 16:48
  • Sounds like you don't have permissions to write to the directories. Uninstall pitz, and reinstall using the -Z tag to install it as the unzipped version. Then, you don't need the cache directory to extract each time. – GAEfan Jun 15 '14 at 17:14
2

Sounds like you don't have permissions to write to the directories. Uninstall pitz, and reinstall using the -Z tag to install it as the unzipped version. Then, you don't need the cache directory to extract each time. That should solve the directories / permissions issue.

GAEfan
  • 11,244
  • 2
  • 17
  • 33
  • how can i uninstall pitz? i tried to "easy_install -m pitz" and then manually delete all pitz files from "C:\Python27\Lib\site-packages" and "C:\Python27\Scripts" folders. Then i run "easy_install -Z pitz", but after all of that, i get the same error – kostr22 Jun 15 '14 at 17:48
  • It is pyyaml causing this, not pitz. Uninstall pyyaml and reinstall with -Z – GAEfan Jun 15 '14 at 19:40
  • This approach solved my issue. I did uninstall pyyaml using pip and then installed it with easy_install -z pyyaml . – Jijoy Mar 03 '15 at 17:39