djhenderson / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

pip install of pymssql fails #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. From a Python environment without Cython installed: 'pip install pymssql'

What is the expected output? What do you see instead?

Expected output: pymssql builds and installs.

Actual output:

Unpacking 
/home/scjody/pwbank/src/hg/pymssql/dist/pymssql-2.0.0b1-dev-20120515.tar.gz
  Running setup.py egg_info for package from file:///home/scjody/pwbank/src/hg/pymssql/dist/pymssql-2.0.0b1-dev-20120515.tar.gz
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/tmp/pip-lgzD13-build/setup.py", line 42, in <module>
        from Cython.Distutils import build_ext as _build_ext
    ImportError: No module named Cython.Distutils
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/tmp/pip-lgzD13-build/setup.py", line 42, in <module>

    from Cython.Distutils import build_ext as _build_ext

ImportError: No module named Cython.Distutils

What version of the product are you using? On what operating system?

This is the latest version from pypi: 2.0.0b1-dev-20120515 running on Ubuntu 
10.10 (Maverick)

Please provide any additional information below.

This is because you're importing build_ext, which happens before setup runs, so 
the setup_requires of Cython>=0.15.1 has no effect.

There doesn't seem to be a good way to import build_ext in setup.py and still 
have the standard Python installation tools work.  The best fix is probably to 
distribute .c files with pymssql, as suggested in the Cython documentation:
http://docs.cython.org/src/userguide/source_files_and_compilation.html#distribut
ing-cython-modules

Original issue reported on code.google.com by Jo...@trustcentric.com on 15 May 2012 at 10:30

GoogleCodeExporter commented 9 years ago
Thanks for the report.  Yes, the build process needs some solid engineering and 
testing.  Unfortunately, unless someone comes along to help in this regard, I 
don't think it will get the attention it deserves.

Original comment by rsyr...@gmail.com on 16 May 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Attaching a patch to setup.py that provides a workaround for this, by wrapping 
all the Cython dependent stuff into a custom build command.  It only gets 
invoked after setup_requires is done processing, so we can get away with 
installing Cython as a prereq and then using it in the build.

Original comment by markchia...@gmail.com on 15 Sep 2012 at 1:06

Attachments:

GoogleCodeExporter commented 9 years ago
The build_ext_cmd.patch changes work for me

Original comment by LeoRoch...@gmail.com on 28 Nov 2012 at 9:48

GoogleCodeExporter commented 9 years ago
I checked in 
http://code.google.com/p/pymssql/source/detail?r=bb459dd7fd7e57216ed34e8f85c05aa
afd00b4d4 recently as I hadn't seen this issue and patch. I wonder if my change 
also works around the problem?

Though we probably should put new builds on PyPI soon and make sure that they 
have the *.c files in them so then Cython isn't required at all...

Original comment by msabr...@gmail.com on 7 Jan 2013 at 6:18

GoogleCodeExporter commented 9 years ago
Hey all,

I reproduced the vanilla pip install failing with the Cython ImportError as 
reported above and then I was able to resolve it by uploading a new sdist, 
which you guys can also try:

http://pymssql.googlecode.com/files/pymssql-2.0.0b1-dev-20130108.tar.gz

This sdist actually has the pre-Cythoned *.c files in it so no Cythoning is 
necessary, though the setup.py still has dependencies on Cython so pip 
installing this will download a Cython egg, but then it won't run Cython 
because the *.c files are already there. At some point, we may want to change 
the setup.py to be more like the one in say, lxml, where Cython is only 
required if you are developing and not if you are just a user. That will 
require quite a bit of work and testing though...

Let me know if the new sdist solves the problem for you...

Original comment by msabr...@gmail.com on 8 Jan 2013 at 6:08

GoogleCodeExporter commented 9 years ago
Just committed the fix to add *.c to MANIFEST.in so that future sdist builds 
will include the C files:

http://code.google.com/p/pymssql/source/detail?r=25c1a84aac0c53664d65ae424483cd1
7f7f87b6b

Original comment by msabr...@gmail.com on 9 Jan 2013 at 5:20

GoogleCodeExporter commented 9 years ago
I verified a pip install on Ubuntu x64 and OS X 10.8.2 and rsyring verified a 
pip install on Ubuntu x64 and Windows x64. Marking this as verified.

Original comment by msabr...@gmail.com on 14 Jan 2013 at 6:08