ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 323 forks source link

Unable to run the program from a Windows machine #428

Closed snwchow closed 2 years ago

snwchow commented 3 years ago

Hello, I am having trouble running the program with a Windows machine; As instructed, I installed Python 3.8 and pipenv, created the virtual environment and installed the dependencies via "pipenv sync --dev" from the commandline, as well as entering the virtual environment via "pipenv shell"

When I attempted the run the program via "main.py" I was met with an "ImportError" stating that the "attempted relative import with no known parent package", and this is related to line 16, in from .config import get_settings

Could you provide advice as to how I can set up/what I need in order to run the program?

Kilo59 commented 3 years ago

https://github.com/ExpDev07/coronavirus-tracker-api#running--development

The dependencies are resolved for a Linux or Mac machine so they may not be correct for windows.

If you are just trying to start it you don't need the --dev dependencies.

pipenv sync
pipenv run start

If you get more import/ dependency issues then you need to re-resolve the dependencies for windows. pipenv install

snwchow commented 3 years ago

Thank you for the reply; I tried "pipenv run start" after getting into the subshell virtual environment via "pipenv shell", but is now met with a "uvicorn error" running on http://127.0.0.1:8000 which suggests that it is somehow attempting to loopback to my local machine(?); with a suggested action of (Press CTRL+C to quit), which obviously aborts the program.

Kilo59 commented 3 years ago

You probably have something else using that port. https://www.uvicorn.org/#command-line-options

The pipenv run start command is defined in the Pipfile. https://github.com/ExpDev07/coronavirus-tracker-api/blob/master/Pipfile#L44 You can alter that or just run uvicorn directly and change the port number.

snwchow commented 3 years ago

How can I find out what is using that port (port 8000), and stopping it/free it up so that coronavirus tracker api can use it? Is there any ways to find out which port is currently free on my machine so that I can use the "uvicorn" command to change the port; and what would be the full command for it? I assume it has something to do with "uvicorn --port #### APP", what should the APP in this case be? It states that "APP" must be in format ":"

snwchow commented 3 years ago

When I ran the "pipenv run start" command, one of the line shows a "uvicorn.error:Started server process [14072]", and from the task manager it actually shows Python is associated with that PID (PID changes everytime I attempt to run "pipenv run start", but it is always Python that is using that PID) Running "netstat -ano -p tcp" shows that Python is using that port when it is trying to run the program, which agrees with what the task manager tells me. The process goes away(obviously) once the program is aborted using CTRL+C...which doesn't get me anywhere.

Kilo59 commented 3 years ago

How can I find out what is using that port (port 8000), and stopping it/free it up so that coronavirus tracker api can use it? Is there any ways to find out which port is currently free on my machine so that I can use the "uvicorn" command to change the port; and what would be the full command for it? I assume it has something to do with "uvicorn --port #### APP", what should the APP in this case be? It states that "APP" must be in format ":"

Just change the port that's being used. No reason for all that port detective work.

Look at the line I linked https://github.com/ExpDev07/coronavirus-tracker-api/blob/master/Pipfile#L44 Just add a port. start = "uvicorn app.main:APP --port 8001" And pipenv run start again.

snwchow commented 3 years ago

error Same problem, changing the port doesn't solve the problem in this case.

Kilo59 commented 2 years ago

It looks like your remaining timeout issue is related to the host api.geonames.org. It doesn't look like a Windows issue.

I'm closing the issue.