0

Although, I have installed python-jose, its still complaining that jose module not found when run "chalice local". Can anybody please help.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/chalice/cli/__init__.py", line 357, in main
    return cli(obj={})
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/chalice/cli/__init__.py", line 134, in deploy
    api_gateway_stage=api_gateway_stage,
  File "/usr/local/lib/python3.6/dist-packages/chalice/cli/factory.py", line 122, in create_config_obj
    app_obj = self.load_chalice_app()
  File "/usr/local/lib/python3.6/dist-packages/chalice/cli/factory.py", line 180, in load_chalice_app
    app = importlib.import_module('app')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sudip/myproj/app.py", line 2, in <module>
    from chalicelib.common import get_cors_congiguration as get_cors_config
  File "/home/sudip/abc/dorm.py", line 15, in <module>
    from jose import jwk, jwt as jjwt
ModuleNotFoundError: No module named 'jose'

But, when i am running python3.6 console and then do import jose, it doesn't complain. Any idea?

python3.6
Python 3.6.5 (default, Mar 29 2018, 03:28:50) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jose
>>> 
SudipM
  • 416
  • 7
  • 14
  • How are you calling your script? `python3.6 app.py`? – Jared Smith May 23 '18 at 13:10
  • Possible [duplicate](https://stackoverflow.com/questions/44588533/why-do-python-modules-work-in-shell-but-not-in-the-script)? – Jared Smith May 23 '18 at 13:11
  • I am using virtualenv in both the cases. I am running command "chalice local" from virtualenv in first case, in 2nd case, I started python shell and then imported jose. In both the cases, python version is 3.6.5 – SudipM May 23 '18 at 13:44
  • Then your shell is almost certainly using the system python, while your script is running in the virtualenv python, or there's a confounding factor you haven't mentioned. – Jared Smith May 23 '18 at 14:05
  • Thanks a lot, I just checked when I call from script, the virtualenv path is not there, whereas in python shell its there, why???from the script: ['/home/sudip/myapp', '/usr/local/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages'] in python shell within the virtualenv: ['/home/sudip/myapp/venv/lib/python3.6/site-packages – SudipM May 23 '18 at 15:51
  • that's another question. Post it as another question with a link to this one. – Jared Smith May 23 '18 at 15:58
  • https://stackoverflow.com/questions/50500023/sys-path-in-virtualenv-python – SudipM May 24 '18 at 02:50
  • sorry I wasn't clear. Mention in the followup question that it is a follow up question and put a link in it back to this one. – Jared Smith May 24 '18 at 10:22

0 Answers0