Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-07-2022 12:07 PM
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
Error: While importing 'api', an ImportError was raised.
04-11-2022 05:06 AM
Hey Roberto, Welcome to the community!
I hate these errors! When I've come across this before I have added PYTHONPATH=.
to the command which seemed to fix it. There are a couple of hints here that may also help you solve the problem.
05-03-2022 03:10 AM
Hey Adam, I run into same problem as Roberto. Trying to setup Building Neo4J Application with Python ends up with:
(sandbox) app-python % flask run
flask run
Same holds for all hints from Help, failing on "flask run", e.g.:
(sandbox) app-python % FLASK_APP=api FLASK_ENV=development flask run
FLASK_APP=api FLASK_ENV=development flask run
I'm using: macOS 12.2.1, zsh 5.8, Python 3.10.4, pip 22.0.4
Any ideas ? Thanks!
07-06-2022 08:36 AM - edited 07-06-2022 10:26 AM
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 😉
08-04-2022 06:30 PM
thank you I had the same problem and you solution worked for me too!
08-14-2022 10:31 PM
I confirm this, thank you!!
08-09-2022 01:39 AM
Hello all, is there a way to do this in Windows with python 3.10? I am getting the same error as above...
08-09-2022 02:26 AM
BTW as an FYI for Window cmd some of the code in the project setup is different:
08-15-2022 09:08 AM
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.
08-31-2022 12:51 AM
'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)
09-21-2022 08:37 AM
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!
09-26-2022 11:11 AM
Since it hasn't been stated yet, the course has been updated for python version 3.10. This issue should be resolved.
All the sessions of the conference are now available online