Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11. Python 3.10.1 Impossible to install pyodbc #1010

Closed
grey-bee opened this issue Jan 16, 2022 · 9 comments
Closed

Windows 11. Python 3.10.1 Impossible to install pyodbc #1010

grey-bee opened this issue Jan 16, 2022 · 9 comments

Comments

@grey-bee
Copy link

Python 64x. The fresh version of PIP, Installed VC for 2015, 2017, 2019, and 2022 for 64 and x86(I tried this step too).
But.....................................
pip install pyodbc
Collecting pyodbc
Using cached pyodbc-4.0.32.tar.gz (280 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\admin\AppData\Local\Temp\pip-install-_j4jyamk\pyodbc_a2017b7ad25e4c76810be58b636f4e0b\setup.py'"'"'; file='"'"'C:\Users\admin\AppData\Local\Temp\pip-install-_j4jyamk\pyodbc_a2017b7ad25e4c76810be58b636f4e0b\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\admin\AppData\Local\Temp\pip-record-mz0r0ege\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\admin\AppData\Local\Programs\Python\Python310\Include\pyodbc'
cwd: C:\Users\admin\AppData\Local\Temp\pip-install-_j4jyamk\pyodbc_a2017b7ad25e4c76810be58b636f4e0b
Complete output (5 lines):
running install
running build
running build_ext
building 'pyodbc' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

PyODBC doesn't see VC. :(

@gordthompson
Copy link
Collaborator

gordthompson commented Jan 17, 2022

Related: #981

@gordthompson gordthompson marked this as a duplicate and then as not a duplicate of #981 Jan 17, 2022
@grey-bee
Copy link
Author

I found the solution! It's problem with Microsoft products.
Very easy to solve - and I think MS should add this info to all their products.
If you can't install these plugins as well,
need to download it from other repositories like this one:
https://www.lfd.uci.edu/~gohlke/pythonlibs/ depends on the version of python and the system.
for example: for my windows 11(x64) and python 3.10 I took this file: pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl
it's very easy to install: pip install pyodbc‑4.0.32‑cp310‑cp310‑win_amd64.whl
after it system works well and didn't ask you about VC.
This solution I found in problem with the MySql plugin for Django. I don't understand why - but they also use VC for the installation process. People also are in shock with the recommendation to install Studio with 16 GB with unusable information!
Microsoft team!!! Please stop doing it!!! Why for all your product we should be finding a solution for installation? It's a quest?

@grey-bee
Copy link
Author

Related: #981

thank you very much. I will add info to this topic too!

@sandarbhasthana
Copy link

Thanks, @gordthompson !!

@xpil
Copy link

xpil commented Jan 17, 2023

Python 3.11.0 on Win 11 here. Same issue when the parent package (dbt-sqlserver) is trying to uninstall and then re-install pyodbc, ending up with the same error message.

So, pyodbc installs fine on its own but fails (with a wrong "Microsoft Visual C++ 14.0 or greater is required" error message) when installed by another package.

@gordthompson
Copy link
Collaborator

@xpil - dbt-sqlserver is trying to install pyodbc 4.0.32:

Collecting pyodbc==4.0.32
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done

pyodbc didn't have wheels for Python 3.11 until version 4.0.35.

@xpil
Copy link

xpil commented Jan 17, 2023

Thanks for clarification. I am relatively new to Python and I do not really understand what it means. Should I downgrade to Python 3.10.x to work around this issue? Can I (somehow?) make the dbt-sqlserver package use a newer version of pyodbc? What are my options (if any)?

@gordthompson
Copy link
Collaborator

Probably the best solution would be to contact the maintainers of dbt-sqlserver and ask them why they are installing an older version of pyodbc.

@lpkapil
Copy link

lpkapil commented Sep 19, 2024

Pyodbc 4.0.35 and python 3.11.0 work fine together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants