Flask configuration for training

Hello,
I'm trying to setup the Neo4J-Flask course but, after some tries I still receive the same error when launch Flask run command:
"Error: While importing 'api', an ImportError was raised."
below the full cmd log.
New to Flask configuration (Windows).
Thanks for hints.
Best regards

(sandbox) C:\VirtualEnv\Neo4J_Flask>flask run

  • Serving Flask app 'api' (lazy loading)
  • Environment: development
  • Debug mode: on
    Usage: flask run [OPTIONS]
    Try 'flask run --help' for help.

Error: While importing 'api', an ImportError was raised.

Hi there,

so, after nearly throwing in the towel, I found a solution for me: I had the wrong Python-Version (3.10) installed. Uninstalled Version 3.10 and installing Version 3.9 works now for me. Maybe the course designer could mark that with some color, that the Python version is crucial!

Hopefully I can do the course without any further obstacles now :wink:

thank you I had the same problem and you solution worked for me too!

Hello all, is there a way to do this in Windows with python 3.10? I am getting the same error as above...

BTW as an FYI for Window cmd some of the code in the project setup is different:

  1. sandbox\Scripts\activate instead of source sandbox/bin/activate
  2. copy .env.example .env instead of cp .env.example .env

Hi,

I didn't find a solution. In order to make it work, the project needs to be rewritten with python 3.10 I think.

I confirm this, thank you!!

'Flask run' command only can be run under python-3.9.

(sandbox) PS C:\Users\ychen70\Downloads\app-python-main> python --version
Python 3.9.13
(sandbox) PS C:\Users\ychen70\Downloads\app-python-main> Flask run
* Serving Flask app 'api' (lazy loading)
* Environment: development
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 412-471-481
* Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)

Hi,

As an alternative you can use conda instead of venv (so frustating)

conda create -n pthon-neo4j python=3.9

(Mac Path) --> /Users/<your_user>/opt/anaconda3/envs/pthon-neo4j/bin/pip install -r requirements.tx
And then
flask run

That worked for me!

Since it hasn't been stated yet, the course has been updated for python version 3.10. This issue should be resolved.