materialscloud-org / issues

An issue tracker for Materials Cloud
3 stars 1 forks source link

Restapi via verdi workon aiida env. VM Q. Mobile (last versions) #30

Closed deivioliveros closed 1 year ago

deivioliveros commented 1 year ago

Dear materials cloud team. The next is shown when I try to run ResAPI: (Vedi status is working all ok) (aiida) max@qmobile:~$ verdi restapi Traceback (most recent call last): File "/home/max/.conda/envs/aiida/bin/verdi", line 10, in sys.exit(verdi()) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, **kwargs) File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/aiida/cmdline/commands/cmd_restapi.py", line 57, in restapi from aiida.restapi.run_api import run_api File "/home/max/.conda/envs/aiida/lib/python3.9/site-packages/aiida/restapi/run_api.py", line 17, in from flask_cors import CORS ModuleNotFoundError: No module named 'flask_cors'

eimrek commented 1 year ago

Dear @deivioliveros, thanks for the question and very sorry for the long delay.

The problem is that the aiida [rest] optional dependency is not installed by default in Quantum Mobile. You can install it with

(base) max@qmobile:~$ conda activate aiida
(aiida) max@qmobile:~$ pip install aiida-core[rest]

and then the rest API should work:

(aiida) max@qmobile:~$ verdi restapi
 * REST API running on http://127.0.0.1:5000/api/v4
 * Serving Flask app 'aiida.restapi.run_api' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)

Hopefully this helps! Feel free to re-open if this is not working.