[Python] weird python sqlalchemy enviroment problem

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    So im using a python enviroment for my project (as you can notice in the screenshot)

    [​IMG]

    When i try to run my script, I get that sqlalchemy is not found.

    Traceback (most recent call last):
    File "/root/ftiendahelp/main.py", line 1, in <module>
    import sqlalchemy
    ModuleNotFoundError: No module named 'sqlalchemy'


    However when i run pip list using same enviroment i have this:

    Package Version
    ------------------ ---------
    certifi 2024.8.30
    charset-normalizer 3.4.0
    greenlet 3.1.1
    idna 3.10
    pip 24.0
    PyMySQL 1.1.1
    requests 2.32.3
    schedule 1.2.2
    setuptools 65.5.0
    SQLAlchemy 2.0.36
    typing_extensions 4.12.2
    urllib3 2.2.3


    According to my knowledge; It means sqlalchemy is correctly instaled on the enviroment. My idea was to be sure about what i was doing was "to run which python from the enviroment" and i will be able to see if my project is actually using python from the enviroment or somewhere else output was:

    /root/ftiendahelp/timer/bin/python


    so unless im wrong im using python from the enviroment which has sqlalchemy already installed so i check my imports again:

    import sqlalchemy
    from sqlalchemy import Column,Integer,BigInteger, create_engine,delete
    from sqlalchemy.orm import sessionmaker, declarative_base
    from contextlib import contextmanager
    import requests,schedule,time


    my final idea was to check it by trying install again so it will tell me the path of where the files were being taken

    (timer) root@v321517364:~/ftiendahelp# pip install pymysql
    Requirement already satisfied: pymysql in ./timer/lib/python3.11/site-packages (1.1.1)

    [notice] A new release of pip is available: 24.0 -> 24.2
    [notice] To update, run: pip install --upgrade pip
    (timer) root@v321517364:~/ftiendahelp# pip install sqlalchemy
    Requirement already satisfied: sqlalchemy in ./timer/lib/python3.11/site-packages (2.0.36)


    but once again i get module not found, can anynone please tell me if im maybe missing something?

    Continue reading...

Compartilhe esta Página