-1
  • I would like to run the following project: https://github.com/pyl0ne/flaskSaaS

  • At the 2nd step of executing causes the error

  • python manage.py initdb (if I run it like this it has no problem, but he have run it with python3 with no problem as well: https://youtu.be/NzmoPqte4V4?t=1623 )

  • I Do want to run it with python 3 so instead I use: python3 manage.py initdb

  • To run it in python3 I have corrected in the code manage file:

  • ORIGINAL (tried with this one before): from flask.ext.script import Manager, prompt_bool, Shell, Server

  • Mine: from flask_script import Manager, prompt_bool, Shell, Server based on: importerror: no module named flask.ext.script

  • I have tried to run it in PyCharm directly and checked the DE's interpreter all set to python 3.7 importerror: no module named flask.ext.script (It gives errors similar to the terminal)

Final Error:

Beli:flaskSaaS-master peterSimon$ python3 manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 1, in <module>
    from flask_script import Manager, prompt_bool, Shell, Server #ORIGINAL: from flask.ext.script import Manager, prompt_bool, Shell, Server
ModuleNotFoundError: No module named 'flask_script'
Community
  • 1
  • 1
Peta
  • 228
  • 1
  • 13
  • 1
    Have you installed the flask_script module? – Manu mathew May 13 '19 at 13:19
  • what is the output of `make install && make dev`? No failure here? – colidyre May 13 '19 at 13:24
  • Now I am (I thought that is installed with flask already). `ModuleNotFoundError: No module named 'termcolor' ` I have run the `pip install -r requirements.txt` `pip3 install -r requirements.txt` before the project so it should be all right – Peta May 13 '19 at 13:26
  • `make install && make dev` perfectly runs here, if I keep the original code it sets up the server as well but I want to expand the project in python3. – Peta May 13 '19 at 13:28

2 Answers2

0

Check if make install actually installed flask_script.

If not, do pip install Flask-Script

and for python3

pip3 install Flask-Script

VnC
  • 1,936
  • 16
  • 26
  • pip3 install Flask-Script helped but it brought up the following error: ```Beli:flaskSaaS-master peterSimon$ python3 manage.py runserver Traceback (most recent call last): File "manage.py", line 2, in from termcolor import colored ModuleNotFoundError: No module named 'termcolor' ``` – Peta May 13 '19 at 13:32
  • At the beginign of the project I have run: `pip install -r requirements.txt` `pip3 install -r requirements.txt` so it should be all right – Peta May 13 '19 at 13:33
  • from the second error you got it looks like your environment isn't sat up properly – VnC May 13 '19 at 13:40
0

You can get rid of confusion by using a virtual environment. So you only have one Python interpreter (version 3.x) and one pip version for this Python version:

git clone git@github.com:pyl0ne/flaskSaaS.git
cd flaskSaaS/
python3 -m venv venv
source venv/bin/activate
make install
python manage.py initdb

should work.

colidyre
  • 4,170
  • 12
  • 37
  • 53
  • After I execute the final command `python manage.py runserver` ERROR message: `OSError: [Errno 8] Exec format error: '/Users/.../flaskSaaS-master/manage.py' ` – Peta May 14 '19 at 10:56
  • Do you have virtual environment activated via `source venv/bin/activate` in each shell you're using for this project? Otherwise [this](https://stackoverflow.com/questions/55315103/oserror-errno-8-exec-format-error-when-trying-to-run-simple-flask-app-in-a) could be helpful. Maybe a VM could be a better choice instead of using only a virtual environment. It seems that your OS, your environment variables or whatever are messed up. So a VM could be a good workaround, at least a test if everything would work as expected outside your system. – colidyre May 14 '19 at 11:08
  • I am using MacOS Sierra 10.12.6 . I have used the exaact code you have provided in your post. I have used this(https://stackoverflow.com/questions/55315103/oserror-errno-8-exec-format-error-when-trying-to-run-simple-flask-app-in-a) but it dit not help because I am seting up a local VM not docker on the MacOS Terminal. – Peta May 14 '19 at 11:24
  • I didn't understand?! Are you using MacOS or a VM with Linux or what? Btw: [This](https://github.com/pallets/werkzeug/issues/1482#issuecomment-477437009) is maybe a better link. – colidyre May 14 '19 at 11:45
  • I am using your code above that sets up a venv on macos . – Peta May 14 '19 at 12:09
  • I ahve noticed this: `#!/usr/local/bin/python3` (https://github.com/pallets/werkzeug/issues/1482#issuecomment-477437009) and `#!/usr/bin/env python3.6` ( https://gist.github.com/teruroom/389cde239aed7d62b0f43ce074a646df ) OR `#!/bin/sh` (https://stackoverflow.com/questions/26807937/subprocess-popen-oserror-errno-8-exec-format-error-in-python) But I dont know where to put it in ( https://github.com/pyl0ne/flaskSaaS ) – Peta May 14 '19 at 12:13