Flask Installation

I did all the steps but it can't run flask:

(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> set FLASK_APP=__init__.py
(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> flask run
Fatal error in launcher: Unable to create process using '"C:\wamp64\www\kt-serverside\flask\starterkit\venv\Scripts\python.exe" "C:\Users\ivanb\PycharmProjects\starterkit\venv\Scripts\flask.exe" run': The system cannot find the file specified.

I received a lot of warnings of deprecated during installation:

(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit\_keenthemes\tools> yarn install
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning extract-loader > babel-runtime > core-js@2.6.12: core-js@ babel-core > babel-register > core-js@2.6.12: core-js@ glob-watcher > chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning gulp > glob-watcher > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning gulp-sourcemaps > css > source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
warning rtlcss-webpack-plugin > babel-runtime > core-js@2.6.12: core-js@ chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning webpack-dev-server > webpack-log > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning webpack-dev-server > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @yaireo/tagify@4.16.4" has unmet peer dependency "prop-types@^15.7.2".
warning " > bootstrap@5.2.2" has incorrect peer dependency "@popperjs/core@^2.11.6".
warning "bootstrap-maxlength > bootstrap@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
warning " > vis-timeline@7.7.0" has unmet peer dependency "@egjs/hammerjs@^2.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "component-emitter@^1.3.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "keycharm@^0.3.0 || ^0.4.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "propagating-hammerjs@^1.4.0 || ^2.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "uuid@^3.4.0 || ^7.0.0 || ^8.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "vis-data@^6.3.0 || ^7.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "vis-util@^3.0.0 || ^4.0.0 || ^5.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "xss@^1.0.0".
warning " > postcss-loader@4.3.0" has unmet peer dependency "postcss@^7.0.0 || ^8.0.1".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
success Saved lockfile.
Done in 146.93s.

I already tried to install it many times but it does not work. Could you please help?

Thank you!

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (10)

Hi Ivan.

Have you installed python and flask?

As stated in the documentation;
https://preview.keenthemes.com/flask/metronic/docs/getting-started

Please download and install the python:
https://www.python.org/downloads/

Then you have to install the Flask for the project to run.

pip install Flask

Thanks

Hello Faizal,

Thank you for your reply.

Yes I did all the steps at the same order as instructed. The download file you provide has the folder "venv" and I think there is some configuration files that it is changing how the flask behave as I sent you on the last message, it shows path files that is not from my computer:


Fatal error in launcher: Unable to create process using '"C:\wamp64\www\kt-serverside\flask\starterkit\venv\Scripts\python.exe" "C:\Users\ivanb\PycharmProjects\starterkit\venv\Scripts\flask.exe" run': The system cannot find the file specified.


Also about your question yes of course I've installed python and flask let me show you the console messages:

(base) PS C:\Users\ivanb\PycharmProjects\starterkit> venv\Scripts\activate
(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> python --version
Python 3.10.2
(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> flask --version
Fatal error in launcher: Unable to create process using '"C:\wamp64\www\kt-serverside\flask\starterkit\venv\Scripts\python.exe" "C:\Users\ivanb\PycharmProjects\starterkit\venv\Scripts\flask.exe" --version': The system cannot find the file specified.

(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> pip install Flask
Requirement already satisfied: Flask in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (2.1.1)
Requirement already satisfied: itsdangerous>=2.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Flask) (2.1.2)
Requirement already satisfied: click>=8.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Flask) (8.1.2)
Requirement already satisfied: Werkzeug>=2.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Flask) (2.1.1)
Requirement already satisfied: Jinja2>=3.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Flask) (3.1.1)
Requirement already satisfied: colorama in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from click>=8.0->Flask) (0.4.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Jinja2>=3.0->Flask) (2.1.1)

I'm also trying in linux but without success as I can't activate the environment, it is with some typo:

[ivanbeira@fedora starterkit]$ source venv/Scripts/activate
: command not found...
bash: venv/Scripts/activate: line 4: syntax error near unexpected token `$'{\r''
'ash: venv/Scripts/activate: line 4: `deactivate () {

Tried for the 10th time here. This time I did a fresh enviroment for python, downloaded metronic flask, transfered to the right folder without replacing files with the same name. Then this is all I did:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

Loading personal and system profiles took 2860ms.
(base) PS C:\Users\ivanb> python --version
Python 3.9.12
(base) PS C:\Users\ivanb> cd PycharmProjects/starterkit
(base) PS C:\Users\ivanb\PycharmProjects\starterkit> venv\Scripts\activate
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (21.3.1)
Collecting pip
Using cached pip-22.3-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
Successfully uninstalled pip-21.3.1
Successfully installed pip-22.3
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> pip --version
pip 22.3 from C:\Users\ivanb\PycharmProjects\starterkit\venv\lib\site-packages\pip (python 3.10)
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> python --version
Python 3.10.2
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> npm --version
8.19.2
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> node --version
v18.12.0
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> yarn --version
1.22.19
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> gulp -- version
[17:03:09] Local gulp not found in ~\PycharmProjects\starterkit
[17:03:09] Try running: npm install gulp
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> gulp --version
CLI version: 2.3.0
Local version: Unknown
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> pip install Flask
Collecting Flask
Using cached Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting Jinja2>=3.0
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting click>=8.0
Using cached click-8.1.3-py3-none-any.whl (96 kB)
Requirement already satisfied: itsdangerous>=2.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Flask) (2.1.2)
Collecting Werkzeug>=2.2.2
Using cached Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Collecting colorama
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (from Jinja2>=3.0->Flask) (2.1.1)
Installing collected packages: Werkzeug, Jinja2, colorama, click, Flask
Successfully installed Flask-2.2.2 Jinja2-3.1.2 Werkzeug-2.2.2 click-8.1.3 colorama-0.4.6
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> cd _keenthemes/tools
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit\_keenthemes\tools> yarn install
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning extract-loader > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning extract-loader > babel-core > babel-register > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning gulp > glob-watcher > chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning gulp > glob-watcher > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning gulp-sourcemaps > css > source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
warning rtlcss-webpack-plugin > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning webpack-dev-server > chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning webpack-dev-server > webpack-log > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning webpack-dev-server > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @yaireo/tagify@4.16.4" has unmet peer dependency "prop-types@^15.7.2".
warning " > bootstrap@5.2.2" has incorrect peer dependency "@popperjs/core@^2.11.6".
warning "bootstrap-maxlength > bootstrap@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
warning " > vis-timeline@7.7.0" has unmet peer dependency "@egjs/hammerjs@^2.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "component-emitter@^1.3.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "keycharm@^0.3.0 || ^0.4.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "propagating-hammerjs@^1.4.0 || ^2.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "uuid@^3.4.0 || ^7.0.0 || ^8.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "vis-data@^6.3.0 || ^7.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "vis-util@^3.0.0 || ^4.0.0 || ^5.0.0".
warning " > vis-timeline@7.7.0" has unmet peer dependency "xss@^1.0.0".
warning " > postcss-loader@4.3.0" has unmet peer dependency "postcss@^7.0.0 || ^8.0.1".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
success Saved lockfile.
Done in 152.44s.
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit\_keenthemes\tools> gulp
Using gulp config file: "../../gulp.config.js"
[17:06:54] Using gulpfile ~\PycharmProjects\starterkit\_keenthemes\tools\gulpfile.js
[17:06:54] Starting 'default'...
[17:06:54] Starting 'cleanTask'...
[17:06:55] Finished 'cleanTask' after 217 ms
[17:06:55] Starting 'buildBundleTask'...
[17:06:55] Finished 'buildBundleTask' after 144 ms
[17:06:55] Finished 'default' after 366 ms
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit\_keenthemes\tools> cd ../../
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> venv\Scripts\activate
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> pip install -r requirements.txt
Collecting python-dotenv
Using cached python_dotenv-0.21.0-py3-none-any.whl (18 kB)
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.21.0
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\ivanb\pycharmprojects\starterkit\venv\lib\site-packages (22.3)
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> set FLASK_APP=__init__.py
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> flask run
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.

Error: Could not locate a Flask application. Use the 'flask --app' option, 'FLASK_APP' environment variable, or a 'wsgi.py' or 'app.py' file in the current directory.
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit>

It seems that it doesn't accept the __init__.py file as the flask application. I changed the name of the __init__.py to app.py as it is the default for flask and it shows another errors.....

(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit> flask run
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.

Error: While importing 'app', an ImportError was raised:

Traceback (most recent call last):
File "C:\Users\ivanb\PycharmProjects\starterkit\venv\lib\site-packages\flask\cli.py", line 218, in locate_app
__import__(module_name)
File "C:\Users\ivanb\PycharmProjects\starterkit\app.py", line 13, in <module>
import starterkit.dashboards.urls
ModuleNotFoundError: No module named 'starterkit'

Now I was able to make the flask accept the __init__.py but it is still showing problems:

(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit2> set FLASK_APP=__init__.py
(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit2> flask run
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.

Error: While importing 'starterkit2.wsgi', an ImportError was raised:

Traceback (most recent call last):
File "C:\Users\ivanb\PycharmProjects\starterkit2\venv\lib\site-packages\flask\cli.py", line 218, in locate_app
__import__(module_name)
File "C:\Users\ivanb\PycharmProjects\starterkit2\__init__.py", line 13, in <module>
import starterkit.dashboards.urls
ImportError: bad magic number in 'starterkit': b'\x03\xf3\r\n'

(base) (venv) PS C:\Users\ivanb\PycharmProjects\starterkit2>

This installation was driving me nuts. Three days trying to make it work. When I gave up, I tried to install the django version and I was able to do it on the first time. There is a serious problem with your flask application, it is not a problem on my side. Please check as I do not want to use the django, I want to use flask.

Hi Ivan,

We did these minimum commands to make it run.

set FLASK_APP=__init__.py && flask run

Microsoft Windows [Version 10.0.22623.870]
(c) Microsoft Corporation. All rights reserved.

C:\wamp64\www\keenthemes\_releases\metronic_v8.1.5_frameworks\flask_demo1\starterkit>set FLASK_APP=__init__.py && flask run
* Serving Flask app '__init__.py ' (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000 (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 105-621-923

Have you tried to use normal "cmd" for Windows instead of using PowerShell?

Thanks

It runs but with a lot of errors, I will give up for the flask with your theme for now. Maybe it get better in the future. Thank you.

Hi Ivan Beira,

Sorry for the inconvenience. We will keep improving the template.

The error part here shows that your Flask is not installed correctly and cannot be executed in the console.

(venv) (base) PS C:\Users\ivanb\PycharmProjects\starterkit> flask --version
Fatal error in launcher: Unable to create process using '"C:\wamp64\www\kt-serverside\flask\starterkit\venv\Scripts\python.exe" "C:\Users\ivanb\PycharmProjects\starterkit\venv\Scripts\flask.exe" --version': The system cannot find the file specified.

You should see something like this when you execute command flask --version

flask --version
Python 3.10.3
Flask 2.1.2
Werkzeug 2.1.2

Thanks

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(