aboutsummaryrefslogtreecommitdiff
path: root/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-05-04 03:27:33 +0200
committerneodarz <neodarz@neodarz.net>2017-05-04 03:27:33 +0200
commit785bde84dd4888817bb9825ba5ab388ec2b7c4b7 (patch)
treeeb572026c9c953dbd67e3acc2104db11117b4e5f /source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md
parent15c05dbb86fe3d98ec6e6ebe7743fd85b860dcc6 (diff)
downloadmy_new_personal_website-785bde84dd4888817bb9825ba5ab388ec2b7c4b7.tar.xz
my_new_personal_website-785bde84dd4888817bb9825ba5ab388ec2b7c4b7.zip
Update to date
Diffstat (limited to '')
-rw-r--r--source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md48
1 files changed, 0 insertions, 48 deletions
diff --git a/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md b/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md
deleted file mode 100644
index 96530740..00000000
--- a/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-title: "pyenv: compiling Python with SQLite in nonstandard location"
-date: 2016-10-26T12:16:22-04:00
-date_display: October 26, 2016
----
-
-This is a quick post sharing a workaround that I needed just now.
-
-I was trying to compile Pythons with pyenv on a RHEL 6.8 cluster. Unfortunately `sqlite-devel` is not installed and I doubt I can convince my sysadmin to install a package for me. The lack of SQLite headers resulted in Pythons without `_sqlite3` which is essential for me. Hinting at SQLite headers from Linuxbrew with `CPATH` did not help either.
-
-Digging into CPython source code, turns out that CPython only looks into [a fixed set of paths](https://github.com/python/cpython/blob/59fa72e34da71fb24f52251c1cc88ed3c3b14797/setup.py#L1132-L1138):
-
-```python
-sqlite_inc_paths = [ '/usr/include',
- '/usr/include/sqlite',
- '/usr/include/sqlite3',
- '/usr/local/include',
- '/usr/local/include/sqlite',
- '/usr/local/include/sqlite3',
- ]
-if cross_compiling:
- sqlite_inc_paths = []
-```
-
-Well that's unfortunate. Luckily pyenv makes it really easy to patch Python source code; take a look at [`plugins/python-build/share/python-build/patches`](https://github.com/yyuu/pyenv/tree/master/plugins/python-build/share/python-build/patches) and you'll get the idea. Therefore, in the case of Linuxbrew'ed pyenv and SQLite, say we want to build Python 3.5.2 with SQLite support, we simply put the following patch at `~/.linuxbrew/opt/pyenv/plugins/python-build/share/python-build/patches/3.5.2/Python-3.5.2/linuxbrew-sqlite3.patch`:
-
-```diff
-diff --git a/setup.py b/setup.py
-index 174ce72..774fd65 100644
---- a/setup.py
-+++ b/setup.py
-@@ -1108,6 +1108,7 @@ class PyBuildExt(build_ext):
- '/usr/local/include',
- '/usr/local/include/sqlite',
- '/usr/local/include/sqlite3',
-+ os.path.expanduser('~/.linuxbrew/opt/sqlite/include/'),
- ]
- if cross_compiling:
- sqlite_inc_paths = []
-```
-
-That's it. Now
-
-```
-$ pyenv install 3.5.2
-```
-
-and enjoy.