Set pants interpreter for Pyarrow

146 views Asked by At

I am using Pants to create .pex file for my project. My Build file has dependency for pyarrow using 3rdparty logic:'3rdparty/python:pyarrow'. Pants build pyarrow using both C++ and Python libraries, I have pyarrow install in anaconda not in standard python library. Pyprep interpreter.info gives: /usr/bin/python2.7 as interpreter used in Pants. How can I change it to anaconda python?

1

There are 1 answers

0
mateor On BEST ANSWER

Changing the pyprep interpreter changes depending on your version of Pants. If this is a relatively recent version, you can set the interpreters in config.

Below is the pattern I have used to override the interpreters, in this case supporting Python2 and Python3 (The %(buildroot)s is a Pants config built-in).

[python-setup]
# Using the modern Pants python backend will allow us to set:
#   compatibility=[ "CPython>=3" ]
# on any python_target we want to enforce as Python3.
interpreter_constraints: ["CPython>=2.7,<3"]
interpreter_search_paths: [
   '%(buildroot)s/.venv/py2/bin',
   '%(buildroot)s/.venv/py3/bin',
  ]

Using roughly the same config, but point it towards the anaconda path will override the interpreter.

I am not sure that this will do what you want - but it will do what you asked.