snakemake / snakeface

The snakemake interface, currently works like a notebook (under development)
https://snakeface.readthedocs.io/
Mozilla Public License 2.0
17 stars 6 forks source link

How to start snakeface locally #17

Closed fgypas closed 3 years ago

fgypas commented 3 years ago

I tried to install snakeface as following:

git clone git@github.com:snakemake/snakeface.git
cd snakeface
virtualenv -p `which python3` venv
source venv/bin/activate
pip install .

OS: OS X 10.14.6 python: Python 3.6

Then when I try snakeface --help I get the help message.

But I don't get how to deploy it. Just running something like snakeface --port 5432 gives me an error:

ModuleNotFoundError: No module named 'snakeface.apps'

Thank you in advance for your help.

vsoch commented 3 years ago

I'm getting a different error with consumers, which seems to be something about my Python version being different:

^C(env) (base) vanessa@vanessa-ThinkPad-T490s:/tmp/snakeface$ snakeface --port 5432
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
May 27, 2021 - 16:25:28
Django version 3.0.8, using settings 'snakeface.settings'
Starting ASGI/Channels version 3.0.3 development server at http://127.0.0.1:5432/
Quit the server with CONTROL-C.
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/home/vanessa/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/vanessa/anaconda3/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/tmp/snakeface/env/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/tmp/snakeface/env/lib/python3.8/site-packages/channels/management/commands/runserver.py", line 107, in inner_run
    application=self.get_application(options),
  File "/tmp/snakeface/env/lib/python3.8/site-packages/channels/management/commands/runserver.py", line 132, in get_application
    return StaticFilesWrapper(get_default_application())
  File "/tmp/snakeface/env/lib/python3.8/site-packages/channels/routing.py", line 28, in get_default_application
    module = importlib.import_module(path)
  File "/home/vanessa/anaconda3/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/snakeface/snakeface/asgi.py", line 6, in <module>
    from snakeface.apps.main import routing
  File "/tmp/snakeface/snakeface/apps/main/routing.py", line 3, in <module>
    from . import consumers
  File "/tmp/snakeface/snakeface/apps/main/consumers.py", line 27, in <module>
    async_get_statuses = sync_to_async(get_statuses, thread_sensitive=True)
  File "/tmp/snakeface/env/lib/python3.8/site-packages/asgiref/sync.py", line 502, in sync_to_async
    return SyncToAsync(
  File "/tmp/snakeface/env/lib/python3.8/site-packages/asgiref/sync.py", line 359, in __init__
    raise TypeError("sync_to_async can only be applied to sync functions.")
TypeError: sync_to_async can only be applied to sync functions.

I installed with

python -m venv env

maybe try that?

vsoch commented 3 years ago

I can take a look at the error I found this weekend.

fgypas commented 3 years ago

Thanks, but also in this case I get the following:

snakeface --port 5432 Traceback (most recent call last): File "/Users/gypafoiv/Desktop/snakeface/env/bin/snakeface", line 11, in load_entry_point('snakeface==0.0.16', 'console_scripts', 'snakeface')() File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/snakeface/client.py", line 164, in main application = get_wsgi_application() File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/django/init.py", line 19, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/django/conf/init.py", line 76, in getattr self._setup(name) File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/django/conf/init.py", line 63, in _setup self._wrapped = Settings(settings_module) File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/django/conf/init.py", line 142, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/Users/gypafoiv/miniconda3/envs/snakeface/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/gypafoiv/Desktop/snakeface/env/lib/python3.6/site-packages/snakeface/settings.py", line 11, in from snakeface.apps.users.utils import get_username ModuleNotFoundError: No module named 'snakeface.apps'

I will also try later on linux.

vsoch commented 3 years ago

That's interesting and seems to be related to the install - when you did pip install -e . it should install from the module directory directly, and within there is a snakeface module with apps under it. But if you are getting this error it is not considering that directory as a module on the path.

vsoch commented 3 years ago

@fgypas I think I found the issue - I forgot to include an init file! Could you please test https://github.com/snakemake/snakeface/pull/18?

fgypas commented 3 years ago

Hi @vsoch I just tested and it worked smoothly. Thanks a lot for the quick fix.