Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable To Start Webapp #153

Open
spenpal opened this issue Sep 22, 2023 · 14 comments
Open

Unable To Start Webapp #153

spenpal opened this issue Sep 22, 2023 · 14 comments

Comments

@spenpal
Copy link

spenpal commented Sep 22, 2023

Describe the bug
I get the Error: connect ECONNREFUSED 127.0.0.1:8000 error when I try to run npm run dev, so I tried to run npm run fastapi-dev in another terminal. However, I get an error saying: sh: 1: source: not found.

Full bug error from npm run fastapi-dev:

> [email protected] fastapi-dev
> source ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload

sh: 1: source: not found

To Reproduce
Steps to reproduce the behavior:

  1. Type npm run fastapi-dev.

Desktop:

  • OS: WSL2 (Ubuntu 22.04.3 LTS)
@srbhr
Copy link
Owner

srbhr commented Sep 22, 2023

Thanks @spenpal for raising the issue.

@Sayvai can you take a look into this ?

@Sayvai
Copy link
Contributor

Sayvai commented Sep 22, 2023

@spenpal - when you ran npm run fastapi-dev, was your current working directory within the webapp/ sub-directory?

@spenpal
Copy link
Author

spenpal commented Sep 22, 2023

@Sayvai
Yes, I was in the /webapp directory when I ran the command

@Sayvai
Copy link
Contributor

Sayvai commented Sep 22, 2023

@spenpal I believe that since you're running a Windows WSL ubuntu shell, the error message you're seeing; sh: 1: source: not found, indicates to me that your WSL shell does not recognise the source command. I developed the script under a Mac OS environment, and hence the assumption that source would work across all systems.

So try this.

In webapp/package.json file, and for the fastapi-dev script, temporarily replace source with a period (.) instead.

- "fastapi-dev": "source ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload",
+ "fastapi-dev": ". ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload",

Save the change locally, and try running npm run fastapi-dev again.

If that works, then I'll raise a PR for that fix, so that the npm script will work in both Mac OS and Windows WSL Ubuntu shell environments.

@spenpal
Copy link
Author

spenpal commented Sep 23, 2023

This is my new error, after making the changes you suggested.

> [email protected] fastapi-dev
> . ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload

sh: 1: .: cannot open ../env/bin/activate: No such file

@Sayvai
Copy link
Contributor

Sayvai commented Sep 23, 2023

@spenpal the following error message suggests that the Python environment activation script (../env/bin/activate) is not found, and so implies you may not have setup the Python Virtual Environment correctly?

sh: 1: .: cannot open ../env/bin/activate: No such file

Given that, did you visually inspect that the env/bin/ directory exist from the root of the project? And whether the activatescript exist within that directory?

If the directory and script does not exist, then that suggests the Python virtual environment (named env) was not setup (or just not setup correctly). If so, then I suggest that the Python setup instructions is followed, which is set out in the projects' root README.md file (step 3 and 4), that is also referred to from the webapp/README.md instructions.

Sayvai added a commit to Sayvai/Resume-Matcher that referenced this issue Sep 23, 2023
A bug was found (see GitHub Issue srbhr#153), where when a user attempting to run the `npm run dev` or `npm run fastapi-dev` commands from within a (Windows) WSL Ubunutu Shell window, encounters the following error, which prevents the backend FastAPI server from running:

`sh: 1: source: not found`

Given it appears that `source` is a command built-in and runnable on Bash and ZSH terminal environments, it is not available to use within the WSL Ubuntu shell by default.

To fix this, a more universal substitute can be used in place of `source`, which is the period `.`, which performs the same function in Bash, ZSH, and WSL Ubunutu terminal / shell environments.
Sayvai added a commit to Sayvai/Resume-Matcher that referenced this issue Sep 23, 2023
A bug was found (see GitHub Issue srbhr#153), where when a user attempting to run the `npm run dev` or `npm run fastapi-dev` commands from within a (Windows) WSL Ubunutu Shell window, encounters the following error, which prevents the backend FastAPI server from running:

`sh: 1: source: not found`

Given it appears that `source` is a command built-in and runnable on Bash and ZSH terminal environments, it is not available to use within the WSL Ubuntu shell by default.

To fix this, a more universal substitute can be used in place of `source`, which is the period `.`, which performs the same function in Bash, ZSH, and WSL Ubunutu terminal / shell environments.
Sayvai added a commit to Sayvai/Resume-Matcher that referenced this issue Sep 23, 2023
A bug was found (see GitHub Issue srbhr#153), where when a user attempting to run the `npm run dev` or `npm run fastapi-dev` commands from within a (Windows) WSL Ubunutu Shell window, encounters the following error, which prevents the backend FastAPI server from running:

`sh: 1: source: not found`

Given it appears that `source` is a command built-in and runnable on Bash and ZSH terminal environments, it is not available to use within the WSL Ubuntu shell by default.

To fix this, a more universal substitute can be used in place of `source`, which is the period `.`, which performs the same function in Bash, ZSH, and WSL Ubunutu terminal / shell environments.

This commit also includes minor `webapp/README.md` updates to reforat lists to numbered lists for both the `Setup` and `Debugging` sections.
Sayvai added a commit to Sayvai/Resume-Matcher that referenced this issue Sep 23, 2023
A bug was found (see GitHub Issue srbhr#153), where when a user attempting to run the `npm run dev` or `npm run fastapi-dev` commands from within a (Windows) WSL Ubunutu Shell window, encounters the following error, which prevents the backend FastAPI server from running:

`sh: 1: source: not found`

Given it appears that `source` is a command built-in and runnable on Bash and ZSH terminal environments, it is not available to use within the WSL Ubuntu shell by default.

To fix this, a more universal substitute can be used in place of `source`, which is the period `.`, which performs the same function in Bash, ZSH, and WSL Ubunutu terminal / shell environments.

This commit also includes minor `webapp/README.md` updates to reformat lists to numbered lists for both the `Setup` and `Debugging` sections for improved clarity.
@srbhr
Copy link
Owner

srbhr commented Sep 28, 2023

@spenpal is this issue fixed now?

@spenpal
Copy link
Author

spenpal commented Oct 1, 2023

@srbhr I realized my initial issue. I use a package manager called PDM, which uses virtualenv by default, for virtual environments. But, the virtualenv environment folder's default name is .venv, instead of env, as stated in the setup instructions.

I changed the script command to reflect my setup, and it works perfectly fine now.
"fastapi-dev": ". ../.venv/bin/activate && python -m uvicorn backend.api.index:app --reload",

This is what I get now at the frontpage of the webapp:

image

I am getting the following debug messages. Not sure if it is pertinent to successfully run the app because I am getting the default screen for the Common Words between Job Descriptions and Resumes Highlighted and Suggestions, even after uploading my resume and job description.

[1] DEBUG Error retreiving service keys:
[1] INFO:     ::ffff:127.0.0.1:0 - "GET /api/service-keys HTTP/1.1" 500 Internal Server Error
[0] No configurable service keys found. If this is unexpected, please check the GET API response to '/api/service-keys'.

image

@Sayvai
Copy link
Contributor

Sayvai commented Oct 1, 2023

@spenpal

  1. the following error from the FastAPI server is nothing to be concerned about, and is just a background web app initialisation check which informs us that no service keys were found:
[1] DEBUG Error retreiving service keys:
[1] INFO:     ::ffff:127.0.0.1:0 - "GET /api/service-keys HTTP/1.1" 500 Internal Server Error
[0] No configurable service keys found. If this is unexpected, please check the GET API response to '/api/service-keys'.

Until recently, the scripts/similarity/config.yml was removed by the maintainer, due to the fact that a third-party service (cohere? qdrant?) no longer provides free API keys for the overall project to work.


  1. I would advise that your localisaed frontend web app changed to the npm package.json script changes are not committed to remote, as the official project environment name to be used is env (not .venv).

  1. Also worth noting that the full stack web app currently returns fake results for demonstration purposes of its capabilities, and so is still under development. So I would not rely on the web app for real results. And if you're intending to get real results, and do not plan on contributing to the development on the web app, then i suggest you run the Streamlit app instead, provided you have signed up for the necessary API keys.

@imhalcyon
Copy link
Contributor

Hey @Sayvai , I'm on Windows and not using WSL. Just have NodeJS and Python.

The Python virtual environment is activated via env/Scripts/activate instead of env/bin/activate. Would it be okay to add another script in package.json for Windows-targeted folks?

Probably need to add this:

"fastapi-dev-win": "..\\env\\Scripts\\activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload",
"dev-win": "concurrently \"npm run next-dev\" \"npm run fastapi-dev-win\"",

Followed by:
npm run dev-win

Note: I have done this in my local workspace and not planning to push to main yet.

@Sayvai
Copy link
Contributor

Sayvai commented Oct 2, 2023

Hey @imhalcyon,

Thanks for highlighting this particular issue for Windows (non-WSL) users. That makes perfect sense, and I agree with the consistent naming conventions for the additional npm scripts / tasks suggestions.

If you don't mind, please create a fork of the main repository with the suggested changes, and then open a detailed PR which links back to this issue, in which the PR itself is configured to merge into main as the base branch.

Good spot!

@imhalcyon
Copy link
Contributor

If you don't mind, please create a fork of the main repository with the suggested changes, and then open a detailed PR which links back to this issue, in which the PR itself is configured to merge into main as the base branch.

Done. Please check whenever possible: #185

@SnehaJainM
Copy link

Hey, could you please tell me where can i find:
(https://github.com/srbhr/Resume-Matcher/blob/main/webapp/README.md ) the webapp readme file?

@srbhr
Copy link
Owner

srbhr commented Feb 26, 2024

Hi @SnehaJainM
The web-app is in the web-app branch and inside the web-app folder is the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants