Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pymssql module not found
#1
Hi,

I'm new here and it's my first post, that's why don't judge too harshly.

I am traying to make web page on Raspberry pi 4B using Flask framework. When i tryed import pymssql I get error 'ModuleNotFoundError: No module named 'pymssql'', but pymssql module is installed on my Raspberry pi.

Maybe someone can get some ideas why it so and how to fix it?
Reply
#2
the python version that is active at time of script execution must be in sync with the pip version.
To verify that this is the case, check versions of both:
use python -V and pip -V
you should see something like:
Output:
(venv) $ python -V Python 3.10.4 (venv) $ pip -V pip 22.1.1 from .../venv/lib/python3.10/site-packages/pip (python 3.10)
as you can see version in both cases is 3.10
Reply
#3
Thank for replay.
I tried check versions and both have 3.9, but still on FLASK pymssql module not recognised.
Reply
#4
and pip list shows pymssql?
Also, show exact unaltered error traceback
Reply
#5
pymssql is on pip list.

When I check if pymssql is installed its good, but when I try to run web server I get error:

im@raspberrypi:~/Desktop/Studiju darbs/Majas_Lapa $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>>
[2]+ Stopped python
im@raspberrypi:~/Desktop/Studiju darbs/Majas_Lapa $ sudo python main.py
Traceback (most recent call last):
File "/home/im/Desktop/Studiju darbs/Majas_Lapa/main.py", line 1, in <module>
from website import create_app
File "/home/im/Desktop/Studiju darbs/Majas_Lapa/website/__init__.py", line 2, in <module>
import pymssql
ModuleNotFoundError: No module named 'pymssql'



Here will be my main.py:

from website import create_app

app = create_app()

if __name__ == '__main__':
app.run(host="0.0.0.0",port=80,debug=True)

Here will be my __init__.py:

from flask import Flask
import pymssql

def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = 'QSJSNDFSDKFSKDFSD SKSDLdsfsdf'

from.views import views
from.auth import auth

app.register_blueprint(views, url_prfix='/')
app.register_blueprint(auth, url_prfix='/')

return app



I tried instead of pymssql use pyodbc, sqlalchemy and flask_sqlalchemy and get the same error when try to run web server on Raspberry pi
Reply
#6
installed and tried on my system (linux mint 20.2)
imported without a hitch:
Output:
Python 3.10.4 (main, Apr 1 2022, 08:36:25) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymssql >>> quit()
don't know what to say.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Module not found tjnichols 3 3,474 May-12-2018, 03:07 PM
Last Post: tjnichols

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020