Pymssql library failing when upgrading to Python 3.7 - win32 issue - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Pymssql library failing when upgrading to Python 3.7 - win32 issue (/thread-19303.html) |
Pymssql library failing when upgrading to Python 3.7 - win32 issue - stixmagiggins - Jun-22-2019 Hi, I upgraded Python from 3.4 to 3.7 and now when I test my code I get the error File "J:\Python_Scripts\Python_Application_Testing_Briars\BriarsNurseryApp.pyw", line 13, in <module> import pymssql #http://pymssql.org/en/stable/ File "src\_mssql.pxd", line 10, in init pymssql ImportError: DLL load failed: %1 is not a valid Win32 application. I've read discussions and have tried various suggestions, such as installing the pymssql wheel directly from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and uninstalling/upgrading pip, Python and pymssql but nothing works. My machine is 64bit so I installed the Windows x86-64 web-based installer version of Python. I did try the 32bit version but other errors appeared. There doesn't appear to be a win32 version of pymssql so it fails. Has anyone else had this problem specificially with pymssql and Python 3.7? I also read the error could be misleading. Thanks RE: Pymssql library failing when upgrading to Python 3.7 - win32 issue - Larz60+ - Jun-23-2019 Packages need to be installed for each version of python. This can usually be done using 'pip' if you chose to update environment variables when installing python 3.7. To check that all is in sync: python -V pip -VYou should see something like: locations will varyy depending on your environment, but should match as far as version number, and should be 3.7...if not, python was not installed properly, please follow https://python-forum.io/Thread-Part-1-Python-3-6-3-7-and-pip-installation-under-Windows If all is well, you can re-install pymssql with: pip install pymssqlMy guess is that the environment variable update was not chosen. RE: Pymssql library failing when upgrading to Python 3.7 - win32 issue - stixmagiggins - Jun-23-2019 Hi Larz60+. Thanks for that but I see "requirement already up-to-date". I have the latest version of pymssql. Hmmm. Perhaps I need to use one of the other sql modules instead. Ok, I uninstalled Python and pip, and completely removed the Python folder, then reinstalled using the advanced settings which puts Python in a different location (C:\Program Files) and now it all works. The only difference so far is that I need admin permissions to pip install/update etc but I can live with that. Thanks for your help anyway. Regards, RE: Pymssql library failing when upgrading to Python 3.7 - win32 issue - snippsat - Jun-24-2019 (Jun-22-2019, 09:28 AM)stixmagiggins Wrote: ImportError: DLL load failed: %1 is not a valid Win32 application.This is error message is almost always a mix up 32-bit and 64-bit. (Jun-22-2019, 09:28 AM)stixmagiggins Wrote: There doesn't appear to be a win32 version of pymssql so it fails.No this is just wrong. Type python in cmd.This is what matter [MSC v.1916 32 bit (Intel)] or look like this [MSC v.1915 64 bit (AMD64)] .This is Python version 32-bit and 64-bit. If i test on 32-bit Python version. E:\div_code λ python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> exit() E:\div_code λ pip -V pip 19.1.1 from c:\python37\lib\site-packages\pip (python 3.7) E:\div_code λ pip install pymssql Collecting pymssql Downloading .... pymssql-2.1.4-cp37-cp37m-win32.whl (353kB) Installing collected packages: pymssql Successfully installed pymssql-2.1.4You see that it find correct wheel pymssql-2.1.4-cp37-cp37m-win32.whl This mean that wheel if for Python 3.7 and 32-bit version of Python If i test it will work. >>> import pymssql >>> pymssql.VERSION (2, 1, 4) >>> exit()So it should detected correct version,on Gohlke pymssql The 64-bit version is pymssql‑2.1.4‑cp37‑cp37m‑win_amd64.whl .If i download with my Anaconda Python version which is 64-bit. You see that it download wheel i marked over. G:\Anaconda3\Scripts λ pip install pymssql Collecting pymssql Downloading .... pymssql-2.1.4-cp37-cp37m-win_amd64.whl (411kB) Installing collected packages: pymssql Successfully installed pymssql-2.1.4 RE: Pymssql library failing when upgrading to Python 3.7 - win32 issue - stixmagiggins - Jun-24-2019 Thanks for the reply. I did check those things before but installing via wheel or directly with pip didn't make a difference. Even though Python is 64bit it is on win32. Does that affect things? RE: Pymssql library failing when upgrading to Python 3.7 - win32 issue - snippsat - Jun-24-2019 (Jun-24-2019, 06:17 AM)stixmagiggins Wrote: Even though Python is 64bit it is on win32. Does that affect things?No,it's the Python version of 32-bit or 64-bit that matter,most have 64-bit version of Windows these days. Look at installation tutorial make sure you make new folder Path as shown there so you get all new files. So no files get mixed up. It should auto detect 32 or 64 bit when do pip install pymssql .Can do it manually download pip install pymssql‑2.1.4‑cp37‑cp37m‑win_amd64.whl ,but should not be needed.So this is the 64-bit wheel,so i use a Python 64-bit version. G:\Anaconda3 λ python Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 [MSC v.1915 64 bit (AMD64)] the version on Python.G:\Anaconda3\Scripts # Manually wheel install λ pip install pymssql-2.1.4-cp37-cp37m-win_amd64.whl Processing g:\anaconda3\scripts\pymssql-2.1.4-cp37-cp37m-win_amd64.whl Installing collected packages: pymssql Successfully installed pymssql-2.1.4No error it work. G:\Anaconda3 λ python Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 >>> import pymssql >>> pymssql.VERSION (2, 1, 4) >>> >>> exit() |