UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

ModuleNotFoundError: No module named 'sqlalchemy'

Open VeryCoolGamerMan opened this issue 3 years ago • 3 comments

As soon as I start it I have this Issue. I updated Python, pip and sqlalchemy. I have no clue of programming and I really dont know what I'm looking at here, so any help would be appreciated.

Traceback (most recent call last): File "H:\OnlyFans-master\start_ofd.py", line 12, in import datascraper.main_datascraper as main_datascraper File "H:\OnlyFans-master\datascraper\main_datascraper.py", line 5, in import helpers.main_helper as main_helper File "H:\OnlyFans-master\helpers\main_helper.py", line 1, in from database.databases.user_data.models.api_table import api_table File "H:\OnlyFans-master\database\databases\user_data\models\api_table.py", line 6, in import sqlalchemy ModuleNotFoundError: No module named 'sqlalchemy'

VeryCoolGamerMan avatar Nov 01 '21 18:11 VeryCoolGamerMan

Did you run pip3 install -r prerequisites prior to running start_ofd.py?

JaegerMedia avatar Nov 03 '21 00:11 JaegerMedia

I'm having the same issue. no changes after installing the reqs

alexey-romero avatar Nov 11 '21 17:11 alexey-romero

I'm also having this issue. It was working before

mm125Y avatar Jul 19 '22 17:07 mm125Y

Quick Guide: Solving SQLAlchemy ModuleNotFoundError with Python Virtual Environment

Problem

You're receiving a ModuleNotFoundError when importing SQLAlchemy in your Python script, despite having SQLAlchemy installed in your virtual environment. This may be due to an alias overriding the Python executable in your virtual environment.

Solution

Step 1: Activate your Python virtual environment.

source venv/bin/activate

Step 2: Ensure SQLAlchemy is installed in the virtual environment.

pip install sqlalchemy

Step 3: Check if python points to the Python in your virtual environment.

which python

If it points to /usr/bin/python3 or similar, you have an alias for python that needs to be removed.

Step 4: Determine your shell (bash or zsh).

echo $SHELL

Step 5: Open your shell's configuration file (~/.bashrc for bash, ~/.zshrc for zsh).

nano ~/.bashrc   # or nano ~/.zshrc

Step 6: Find the line alias python=... and comment it out or delete it.

Step 7: Save and exit (Ctrl+X, Y, Enter in nano).

Step 8: Reload your shell's configuration.

source ~/.bashrc   # or source ~/.zshrc

Step 9: Close and reopen your terminal. Activate your virtual environment again. Now python should point to your virtual environment's Python.

Now, try running your script. SQLAlchemy should import without error.

RazeBerry avatar Jul 29 '23 02:07 RazeBerry