CURENT / agvis

Geo-visualization for energy system
https://ltb.curent.org
GNU General Public License v3.0
7 stars 5 forks source link

Error: no module named 'fcntl' #56

Closed jinningwang closed 11 months ago

jinningwang commented 1 year ago

As Zack suggested, a quick solution can be using the flask to avoid it. Remember to use the branch master

cd /Users/jinningwang/Documents/work/agvis/agvis
flask run -p 8810

When using AGVis on windows, an error occurred that "no module named 'fcntl'", as shown in the below screenshot. It seems that fcntl does not support windows platform. Can we do a quick fix on this? screenshot

zmalkmus commented 1 year ago

After looking into this, Windows does not have any support for production level WSGI. Or rather, the WSGI do not have any support for windows. What I can do is add the ability to run AGVis in a developer mode, which should work on windows just fine for personal use. It just won't be suitable for a production level environment. I will get back to you on the correct commands to use.

jinningwang commented 1 year ago

A good idea can be making compatibility for personal use on Windows. We can still stick with the existing design since we aimed at a production level web app. Is it possible to disable some trouble functions if Windows platform is detected? Most windows users only need to activate the web app and visualize the topology.

After looking into this, Windows does not have any support for production level WSGI. Or rather, the WSGI do not have any support for windows. What I can do is add the ability to run AGVis in a developer mode, which should work on windows just fine for personal use. It just won't be suitable for a production level environment. I will get back to you on the correct commands to use.

zmalkmus commented 1 year ago

A good idea can be making compatibility for personal use on Windows. We can still stick with the existing design since we aimed at a production level web app. Is it possible to disable some trouble functions if Windows platform is detected? Most windows users only need to activate the web app and visualize the topology.

After looking into this, Windows does not have any support for production level WSGI. Or rather, the WSGI do not have any support for windows. What I can do is add the ability to run AGVis in a developer mode, which should work on windows just fine for personal use. It just won't be suitable for a production level environment. I will get back to you on the correct commands to use.

Yes, we can get the OS the user is running with python and create wrappers around certain sections to disable their functionality based on the OS.

zmalkmus commented 1 year ago

Navigating into the agvis directory (the one with app.py) and running flask run -p 8810 works on windows. This command does not use the gunicorn server, but instead the built in flask development server.

zmalkmus commented 1 year ago

I can make the agvis run command grab the OS, and run the production server if it is on linux, or the development server if it is being run from Windows, so the user input will be the same no matter what platform.

jinningwang commented 1 year ago

I can use following command to host the web app:

cd /Users/jinningwang/Documents/work/agvis/agvis/static
python3 -m http.server 8810

but I cannot find file app.py in AGVis directory.

Navigating into the agvis directory (the one with app.py) and running flask run -p 8810 works on windows. This command does not use the gunicorn server, but instead the built in flask development server.

zmalkmus commented 1 year ago

You are almost in the right directory. app.py is in the directory above static.

Using cd /Users/jinningwang/Documents/work/agvis/agvis should get you there.

image

jinningwang commented 1 year ago

My bad, I was using the develop branch... Maybe you can sync the master and develop? It is more common for develop get ahead of master rather than instead.

You are almost in the right directory. app.py is in the directory above static.

Using cd /Users/jinningwang/Documents/work/agvis/agvis should get you there.

image

zmalkmus commented 1 year ago

My bad, I was using the develop branch... Maybe you can sync the master and develop? It is more common for develop get ahead of master rather than instead.

I do not believe I have permissions to sync the develop branch.

zmalkmus commented 1 year ago

Actually, I believe I should have the permissions, I just am not seeing the button I am used to syncing with on the github site. I can just do it manually.

jinningwang commented 1 year ago

No worry, I've done it manually this time. Later we can do work on develop first and then merge develop into master. ^-^

Actually, I believe I should have the permissions, I just am not seeing the button I am used to syncing with on the github site. I can just do it manually.

zmalkmus commented 1 year ago

Yes, I can do that haha.

jinningwang commented 1 year ago

Another error on my end, "An unexpected error has occured while trying to start AGVis: [Errno 2] No such file or directory: 'gunicorn'" image

zmalkmus commented 1 year ago

Is this on Windows or Linux?

jinningwang commented 1 year ago

Is this on Windows or Linux?

Darwin, so I guess it's a unix-like one. I'm using MacOS with conda.

zmalkmus commented 1 year ago

I was told by Nicholas that we did not support MacOS. Did AGVis work on MacOS in the past?

Can you try running the flask command flask run -p 8810 ? This will tell me if it is an issue with gunicorn specifically.

You should be able to run the AGVis environment through docker as well without problems in the mean time. It loads a Debian distribution in the container so there are no OS conflicts. I have included instructions if you need. Since I am not used to MacOS commands, the actual commands might differ.

From the agvis directory:

  1. Run ./go.sh build
  2. Run tmux
  3. Run ./go.sh dev2
  4. Go to http://localhost:8810/ in your browser
  5. Run the loaded ANDES command in the bottom panel
  6. When finished, run tmux detach
  7. Then clean the docker images and open ports with ./go.sh clean

Here is the youtube tutorial if you need Tutorial

zmalkmus commented 1 year ago

It could also be that the required packages haven't been installed. Gunicorn requires a new package. I included this in the requirements.txt folder, so running python3 -m pip install -e . or pip install -r requirements.txt might do the trick.

jinningwang commented 1 year ago

Zack, thanks. After reinstalling the dependencies, it works well now.

zmalkmus commented 1 year ago

Awesome! I am happy to know it works correctly on MacOS too.

zmalkmus commented 11 months ago

I am going to close this issue since it has been solved.