3

I have a shared hosting machine running Linux and I'm trying to get Python 3.8.3 running on it.

I have Python installed with pyenv and the correct version is globally

$ python --version
Python 3.8.3

In order to get Python working with pyenv, I have added this lines to ~/.bashrc:

export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

export TMPDIR="$HOME/tmp_"

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/shims:$PATH"

When I'm running my python script, I receive the error:

'No module named '_sqlite3'. 

Since I don't have root access, and no apt available, I have installed sqlite3 manually according to this answer.

$ wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz
$ tar xvvf sqlite-autoconf-3070900.tar.gz
$ cd sqlite-autoconf-3070900
$ ./configure --prefix=~/tmp_
$ make
$ make install

sqlite3 is working, when I enter sqlite3 into the command line, it's working:

$ sqlite3
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> 

I tried reinstalling Python with pyenv and linking Sqlite3 with the next statement, according to this post, but still Python response is no module '_sqlite3' found.

LDFLAGS="-L/home/wazeli1q/tmp_/tmp_/sqlite/lib" CPPFLAGS="-I/home/wazeli1q/tmp_/tmp_/sqlite/include" pyenv install -v 3.8.3

Last attempt was to install sqlite3 into the .local folder, but that did work eighter:

./configure --prefix=$HOME/.local
make && make install

What is going wrong? Just to make clear: I don't have apt and I don't have sudo rights.

GigaaG
  • 31
  • 3
  • After compiling sqlite, you need to recompile python with the correct CFLAGS/LDFLAGS. Search how to pass configure options to pyenv. I know nothing about pyenv, I prefer to compile my python by hand. – iuridiniz Jan 24 '22 at 17:10
  • I'm trying by running ```LDFLAGS="-L/home/wazeli1q/tmp_/tmp_/sqlite/lib" CPPFLAGS="-I/home/wazeli1q/tmp_/tmp_/sqlite/include" pyenv install -v 3.8.3``` – GigaaG Jan 24 '22 at 17:22
  • Yes, but I don't know if exporting these env vars (CFLAGS LDFLAGS) are sufficient to pyenv. May be you need to read pyenv docs. I used to use ASDF, and to compile the python with different flags I need to set CONFIGURE_OPTS and PYTHON_CFLAGS – iuridiniz Jan 24 '22 at 17:29

0 Answers0