Missing module while using Github Site_Graph

I’m having trouble with the instructions for using git outlined in @ribose’s post about using it to make a site graph! I did everything as instructed, and I got no errors during installation… however I can’t run the actual program or generate a graph at all. I get the following error:

Traceback (most recent call last): File "C:\Users\Jay\site-graph\site_graph.py", line 2, in <module> from bs4 import BeautifulSoup ModuleNotFoundError: No module named 'bs4'

I can’t figure out how to get the module ‘bs4’ or what that even means :oops: I am totally new to git though and have pretty much 0 python experience so maybe there’s something I’m missing.

Did you do the pip3 install -r requirements.txt step? If so, did it succeed?

bs4 is one of the dependencies that should have been installed though pip3 install -r requirements.txt in step 5 of my post. i’m not sure why it wouldn’t have worked. were you in the site-graph directory when you ran that line?

yeah, it ran with no errors.

Yeah I was. For what it’s worth, the requirements.txt failed the first time because my python wasn’t up-to-date like I thought. I updated it fully and reran that command with no issues, though; most of the lines did say “requirement already satisfied”. The final line before it sent me back to type in the directory was Successfully installed argparse-1.4.0

If you run pip freeze, do you see bs4 in the list?

beautifulsoup4, which is what i assume bs4 stands for, is in the list, yeah.

if you run python by itself, it will give you a python interpreter. Then type import bs4. Does that give you the same error? You can then exit the interpreter by entering Ctrl+D on your keyboard.

fwiw I just ran through ribose’s instructions myself and everything worked perfectly, so I’m guessing this is some environment weirdness (or maybe Windows weirdness) on your machine.

So, running input bs4 gives no errors, and brings me right back to the interpreter. Which… ctrl+D does not let me exit, for some reason! I closed and reopened git, went back to the site-graph directory and inputted python3 site_graph.py https://transrats.neocities.org again, and am still getting the strange bs4 error.

Is there a way for me to uninstall everything I just did and start from scratch, maybe?

ah, it is Ctrl+Z to exit python on Windows for some reason :devastated:
You should be able to run pip3 freeze >uninstall.txt then pip3 uninstall -y -r uninstall.txt to completely clean up your python environment. Make sure you’re using PowerShell for this and not Command Prompt.

1 Like

i’ve been using the ‘git cmd’ application; should i be using powershell…? ive been running as admin regardless.

If the pip3 freeze >uninstall.txt works then it is fine. PowerShell just has more modern features and some UNIX compatibility that cmd doesn’t have, so the stuff I tell you to do should mostly just work in PowerShell.

1 Like

alright, i’ve started from scratch, installed everything again with 0 errors at all… and I’m still getting the same error :oops: this time im in powershell. I gotta get dressed and ready for the day, but I’ll be back later to try troubleshooting some more. thank you for your help!! <3

as an aside; does this use p2p to download the missing module, by any chance? my school blocks p2p connections so i wonder if that could be the cause.

1 Like

Python modules are downloaded directly from the Python Package Index, so you shouldn’t have connection issues (and if you did pip should produce an error).

Based on the fact that you could import the package no problem in the interpreter, I’m guessing somehow the interpreter being used when you run the program and the interpreter you tested just now are somehow different. Could you post the exact command you are using?

Also run these two commands and make sure the output for each pair is the same
python --version
python3 --version

python -c "import sys; print('\n'.join(sys.path))"
python3 -c "import sys; print('\n'.join(sys.path))"

Please post the output of the latter command as well.

1 Like

the exact command i use to install stuff is pip3 install -r requirements.txt, and then i use python3 site_graph.py https://transrats.neocities.org

using python --version i get 3.12.1, and for python3 --version i get 3.11.8, so I updated python, but I’m getting the same errors despite them both now being on 3.12.2.

the outputs of the following commands are as follows:
first one:
C:\Python312\python312.zip C:\Python312\DLLs C:\Python312\Lib C:\Python312 C:\Python312\Lib\site-packages

Second one:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\python311.zip C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\DLLs C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0 C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\site-packages

I’m honestly unsure what any of that means ^^"

This shows that you have two different python installations: one at C:\Python312 and another in C:\ProgramFiles\WindowsApps. I’m guessing pip3 is using the interpreter at C:\Python312 but python3 is using the other one. To get around this try installing the packages with this command: python3 -m pip install -r requirements.txt then try running the script again with python3 site_graph.py https://transrats.neocities.org.

Yep, this was it! Sorry it took so long to get back to you on this, it’s been a while since I"ve been able to sit down and work on this, but it’s generating now! It looks like it’ll take a while but I’m so glad to have gotten it working :) tysm yequariii

Np Jay I’m glad you got it working!