mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.89k stars 562 forks source link

Feature/Distribute-Linux-Wheel #1063

Closed 9y2070m closed 1 year ago

9y2070m commented 2 years ago

Please first make sure you have looked at:

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:

Issue

I like your package :smile: Unfortunately I have to build the dependencies always on my LINUX machines. Is there a possibility to build also the LINUX wheels with your releases?

Thanks and best regards

v-makouz commented 2 years ago

I'm not sure I understand the question, but it is possible to build pyODBC on Linux. Typically you'd use something like python setup.py install

9y2070m commented 2 years ago

I know that this is possible. But i am using a package which is depending pyodbc. So installing that on linux does not work clean because i have to download and run python setup.py install in advance to ensure the dependency is available before running pip install theotherpackage

9y2070m commented 2 years ago

That is the reason for the wish, that also linux wheels are available. Then the pip installation would work cleanly also on linux

gordthompson commented 2 years ago

pip is already able to build pyodbc if it is a dependendency of another PyPI package. For example, sqlalchemy-sybase lists pyodbc in its install_requires. Provided that the machine has the prerequisites for building pyodbc, namely

sudo apt install build-essential unixodbc-dev

then pip install sqlalchemy-sybase will also download and build pyodbc:

(pip_test) gord@xubu-22-04:~$ lsb_release -d
Description:    Ubuntu 22.04 LTS
(pip_test) gord@xubu-22-04:~$ pip install sqlalchemy-sybase
Collecting sqlalchemy-sybase
  Downloading sqlalchemy_sybase-1.0.6-py3-none-any.whl (14 kB)
Collecting pyodbc
  Downloading pyodbc-4.0.32.tar.gz (280 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 280.0/280.0 KB 378.9 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting odbcinst
  Downloading odbcinst-1.0.1-py3-none-any.whl (3.1 kB)
Collecting SQLAlchemy>1.3.16
  Downloading SQLAlchemy-1.4.36-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 1.2 MB/s eta 0:00:00
Collecting greenlet!=0.4.17
  Downloading greenlet-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.4/155.4 KB 450.3 kB/s eta 0:00:00
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... done
  Created wheel for pyodbc: filename=pyodbc-4.0.32-cp310-cp310-linux_x86_64.whl size=311758 sha256=920868ecd81cb487ab4f5a02a0e562450248ff4fea79fc9bbbb52a9c8f5f092d
  Stored in directory: /home/gord/.cache/pip/wheels/7b/8e/7c/8cc1b402b630015941a21d878aabe8360b24a353270e96a54c
Successfully built pyodbc
Installing collected packages: pyodbc, odbcinst, greenlet, SQLAlchemy, sqlalchemy-sybase
Successfully installed SQLAlchemy-1.4.36 greenlet-1.1.2 odbcinst-1.0.1 pyodbc-4.0.32 sqlalchemy-sybase-1.0.6
(pip_test) gord@xubu-22-04:~$ python
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> pyodbc.version
'4.0.32'
>>> 
9y2070m commented 2 years ago

I know that this works :) But I am talking about a faster and more comfortable way ;) It's quite annoying to install or have the build dependencies always available, just because one package dependency needs them to build.

I found the recommended way with https://github.com/pypa/manylinux and I saw how pandas and numpy are doing it.

gordthompson commented 1 year ago

This issue is being addressed in #1084