NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

Cannot start server after installing from GitHub #364

Closed adamliter closed 5 years ago

adamliter commented 5 years ago

Since https://github.com/NYUCCL/psiTurk/commit/082942d6a62465b58eaaba91bb9a3a306be41b1d, installing via GitHub (i.e., pip install git+https://github.com/NYUCCL/psiTurk.git@master) leads to an installation that does not contain either psiturk.dashboard or psiturk.api.

This leads to a misleading error message when trying to start the psiTurk server:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/psiturk/experiment_server.py", line 108, in <module>
    launch()
  File "/usr/local/lib/python3.6/dist-packages/psiturk/experiment_server.py", line 104, in launch
    ExperimentServer().run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 223, in run
    super(Application, self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 232, in run
    self.halt(reason=inst.reason, exit_status=inst.exit_status)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 345, in halt
    self.stop()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 393, in stop
    time.sleep(0.1)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 245, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 525, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Checking server.log more helpfully shows that the issue results from line 109 of experiment.py:

  File "/usr/local/lib/python3.6/dist-packages/psiturk/experiment.py", line 109, in <module>
    from .api import api_blueprint
ModuleNotFoundError: No module named 'psiturk.api'

Indeed, neither the dashboard nor the api folder are included in /usr/local/lib/python3.6/dist-packages/psiturk. These new subpackages need to be added to setup.py.

Either of the following fixes should work:

diff --git a/setup.py b/setup.py
index 3cabeee..7f8c34d 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ if __name__ == "__main__":
     setup_args = dict(
         name = "PsiTurk",
         version = version_number,
-        packages = ["psiturk"],
+        packages = ['psiturk', 'psiturk.api', 'psiturk.dashboard'],
         include_package_data = True,
         zip_safe = False,
         entry_points = {

or

diff --git a/setup.py b/setup.py
index 3cabeee..f21c585 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,5 @@
 import sys
-from setuptools import setup
+from setuptools import setup, find_packages
 from psiturk.version import version_number

 try:
@@ -23,7 +23,7 @@ if __name__ == "__main__":
     setup_args = dict(
         name = "PsiTurk",
         version = version_number,
-        packages = ["psiturk"],
+        packages = find_packages(),
         include_package_data = True,
         zip_safe = False,
         entry_points = {
deargle commented 5 years ago

Cool, thanks!