ASF GitHub Bot commented on ARROW-2049:

cpcloud closed pull request #1526: ARROW-2049: [Python] Try searching for the 
Cython executable according to sysconfig
URL: https://github.com/apache/arrow/pull/1526

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/setup.py b/python/setup.py
index 3d3831dc0..2f5c4aa2c 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -37,6 +37,17 @@
 from distutils.util import strtobool
 from distutils import sysconfig
+    import sysconfig as _sysconfig
+    def get_scripts_dir():
+        return _sysconfig.get_path('scripts')
+except ImportError:
+    def get_scripts_dir():
+        if os.name in ['nt', 'os2']:
+            return os.path.join(sys.exec_prefix, 'Scripts')
+        else:
+            return os.path.join(sys.exec_prefix, 'bin')
 # Check if we're running 64-bit Python
 is_64_bit = sys.maxsize > 2**32
@@ -146,10 +157,17 @@ def _run_cmake(self):
         static_lib_option = ''
+        scripts_dir = get_scripts_dir()
+        cython_executable = os.path.join(scripts_dir, 'cython%s' % 
+        if not os.path.exists(cython_executable):
+            cython_executable = None
         cmake_options = [
             '-DPYTHON_EXECUTABLE=%s' % sys.executable,
+        if cython_executable is not None:
+            cmake_options.append('-DCYTHON_EXECUTABLE=%s' % cython_executable)
         if self.with_parquet:


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> setup.py doesn't pick a cython executable that resides in the venv used for 
> running setup.py
> --------------------------------------------------------------------------------------------
>                 Key: ARROW-2049
>                 URL: https://issues.apache.org/jira/browse/ARROW-2049
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Moriyoshi Koizumi
>            Priority: Trivial
>              Labels: pull-request-available
> setup.py doesn't even try to detect the right cython executable specially 
> when it is used in virtualenv. Instead it always tries to use the one found 
> in the search path.
> I am going to create the PR on GitHub accordingly.

This message was sent by Atlassian JIRA

Reply via email to