#StackBounty: #18.04 #python #python3 #sqlite #sqlite3 Is it possible to install SQLite 3.24+ on Ubuntu 18.04?

Bounty: 50

I am trying to update my SQLite version to 3.24 or above so that a Python app can make use of the new “UPSERT” queries. I have been trying for a few hours to do this with little success; it refuses to update past 3.22.

I have attempted:

  • Using apt to install and reinstall sqlite / libsqlite3-dev (and various versions of this)

  • Downloading packages from launchpad (such as
    https://launchpad.net/ubuntu/+source/sqlite3/3.26.0-2) and attempting to install them

  • Using Python pip to try and update sqlite3

  • Adding a few PPA repos to try and grab it from there

  • Other various suggestions found from google

What I have not tried:

  • Building SQLite from source (this is a bit of a last resort for me)

Is it possible to install a version of SQLite 3.24+ on Ubuntu 18.04? If so, is the only way to build from source or is there an easy way to pick up a more recent version through apt (or similar)?


Get this bounty!!!

#StackBounty: #linux #bash #centos #python3 #sqlite ModuleNotFoundError: No module named '_sqlite3'

Bounty: 50

We have different python version installed and specifically using python3.7 so I have edited my .bashrc file. We are using Centos7 with Linux server.

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias python=python3.7
alias pip=pip3.7


[xyz@innolx20122 ~]$ python
python             python2.7          python3.6          python3.7          python3.7m-config
python2            python3            python3.6m         python3.7m

[xyz@innolx20122 ~]$ which sqlite3
/usr/bin/sqlite3

Its working with python2.7 and python3.6 version

[xyz@innolx20122 ~]$ python2.7
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

[xyz@innolx20122 ~]$ python3.6
Python 3.6.8 (default, Apr  2 2020, 13:34:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

It’s not working with python3.7 version

[xyz@innolx20122 ~]$ python3.7
Python 3.7.0 (default, Sep  3 2020, 09:25:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

Update-

We installed python following instruction in the below link
Python3.7 installation link

Hence my python3.7 version is installed at root level

[root@innolx20122 ~]# ls
anaconda-ks.cfg  Python-3.7.0  Python-3.7.0.tgz
[root@innolx20122 ~]# cd Python-3.7.0
[root@innolx20122 Python-3.7.0]# ls
aclocal.m4    config.status  Doc         Lib              Mac              Misc     PC              pyconfig.h     python-config     setup.py
build         config.sub     Grammar     libpython3.7m.a  Makefile         Modules  PCbuild         pyconfig.h.in  python-config.py  Tools
config.guess  configure      Include     LICENSE          Makefile.pre     Objects  Programs        python         python-gdb.py
config.log    configure.ac   install-sh  m4               Makefile.pre.in  Parser   pybuilddir.txt  Python         README.rst

I saw one link on stack overflow suggesting some workaround.
fix Sqlite3 issue

Kindly suggest if it’s ok to run below commands from same root directory itself

yum install sqlite-devel

./configure
make && make altinstall


Get this bounty!!!

#StackBounty: #linux #bash #centos #python3 #sqlite ModuleNotFoundError: No module named '_sqlite3'

Bounty: 50

We have different python version installed and specifically using python3.7 so I have edited my .bashrc file. We are using Centos7 with Linux server.

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias python=python3.7
alias pip=pip3.7


[xyz@innolx20122 ~]$ python
python             python2.7          python3.6          python3.7          python3.7m-config
python2            python3            python3.6m         python3.7m

[xyz@innolx20122 ~]$ which sqlite3
/usr/bin/sqlite3

Its working with python2.7 and python3.6 version

[xyz@innolx20122 ~]$ python2.7
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

[xyz@innolx20122 ~]$ python3.6
Python 3.6.8 (default, Apr  2 2020, 13:34:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

It’s not working with python3.7 version

[xyz@innolx20122 ~]$ python3.7
Python 3.7.0 (default, Sep  3 2020, 09:25:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

Update-

We installed python following instruction in the below link
Python3.7 installation link

Hence my python3.7 version is installed at root level

[root@innolx20122 ~]# ls
anaconda-ks.cfg  Python-3.7.0  Python-3.7.0.tgz
[root@innolx20122 ~]# cd Python-3.7.0
[root@innolx20122 Python-3.7.0]# ls
aclocal.m4    config.status  Doc         Lib              Mac              Misc     PC              pyconfig.h     python-config     setup.py
build         config.sub     Grammar     libpython3.7m.a  Makefile         Modules  PCbuild         pyconfig.h.in  python-config.py  Tools
config.guess  configure      Include     LICENSE          Makefile.pre     Objects  Programs        python         python-gdb.py
config.log    configure.ac   install-sh  m4               Makefile.pre.in  Parser   pybuilddir.txt  Python         README.rst

I saw one link on stack overflow suggesting some workaround.
fix Sqlite3 issue

Kindly suggest if it’s ok to run below commands from same root directory itself

yum install sqlite-devel

./configure
make && make altinstall


Get this bounty!!!

#StackBounty: #linux #bash #centos #python3 #sqlite ModuleNotFoundError: No module named '_sqlite3'

Bounty: 50

We have different python version installed and specifically using python3.7 so I have edited my .bashrc file. We are using Centos7 with Linux server.

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias python=python3.7
alias pip=pip3.7


[xyz@innolx20122 ~]$ python
python             python2.7          python3.6          python3.7          python3.7m-config
python2            python3            python3.6m         python3.7m

[xyz@innolx20122 ~]$ which sqlite3
/usr/bin/sqlite3

Its working with python2.7 and python3.6 version

[xyz@innolx20122 ~]$ python2.7
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

[xyz@innolx20122 ~]$ python3.6
Python 3.6.8 (default, Apr  2 2020, 13:34:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

It’s not working with python3.7 version

[xyz@innolx20122 ~]$ python3.7
Python 3.7.0 (default, Sep  3 2020, 09:25:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

Update-

We installed python following instruction in the below link
Python3.7 installation link

Hence my python3.7 version is installed at root level

[root@innolx20122 ~]# ls
anaconda-ks.cfg  Python-3.7.0  Python-3.7.0.tgz
[root@innolx20122 ~]# cd Python-3.7.0
[root@innolx20122 Python-3.7.0]# ls
aclocal.m4    config.status  Doc         Lib              Mac              Misc     PC              pyconfig.h     python-config     setup.py
build         config.sub     Grammar     libpython3.7m.a  Makefile         Modules  PCbuild         pyconfig.h.in  python-config.py  Tools
config.guess  configure      Include     LICENSE          Makefile.pre     Objects  Programs        python         python-gdb.py
config.log    configure.ac   install-sh  m4               Makefile.pre.in  Parser   pybuilddir.txt  Python         README.rst

I saw one link on stack overflow suggesting some workaround.
fix Sqlite3 issue

Kindly suggest if it’s ok to run below commands from same root directory itself

yum install sqlite-devel

./configure
make && make altinstall


Get this bounty!!!

#StackBounty: #20.04 #python3 #gedit #plugins How do I fix "The plugin "External Tools" could not be loaded. An error oc…

Bounty: 50

I’m using GEdit version 3.36.2 pre-installed with Ubuntu 20.04.1.
I wanted to enable the External Tools plugin of GEdit, but I’m unable to do so.

When I click on the External Tools option, I get ⛔ symbol.

Gedit preferences

When I close GEdit and reopen it, the option is turned off.

Gedit preferences

If I enable it, I’ll again get the same ⛔ symbol.

How do I fix this issue?


Edit 1:
gir1.2-gtksource-3.0 was not installed when I asked this question. After jokerdino’s suggestion in the Ask Ubuntu General Room, I installed gir1.2-gtksource-3.0 using this command: sudo apt install gir1.2-gtksource-3.0.

I noticed an error message after installing gir1.2-gtksource-3.0.

Error message in gedit

The plugin "External Tools" could not be loaded
An error occured: Plugin loader "python 3" was not found

I am not sure if I could see this error message before installing gir1.2-gtksource-3.0. Maybe I didn’t place the mouse pointer on the symbol (for few seconds) the first time when I noticed the symbol or maybe it could be some other reason. I don’t know.

jokerdino suggested me to open gedit from terminal and check if I got any specific error while turning on External Tools. I did get an error in the terminal.

** (gedit:14693): WARNING **: 20:21:59.976: Error initializing Python Plugin Loader: PyGObject initialization failed
ImportError: could not import gobject (error was: ModuleNotFoundError("No module named 'gi'"))

** (gedit:14693): WARNING **: 20:21:59.976: Please check the installation of all the Python related packages required by libpeas and try again

(gedit:14693): libpeas-WARNING **: 20:21:59.976: Loader 'python3' is not a valid PeasPluginLoader instance

I guess Python 3.8.2 was pre-installed with my Ubuntu installation. I wanted to upgrade to Python 3.8.3. So I followed the instructions mentioned in this website Install Python 3.8.3 in Ubuntu 20.04 LTS – TechPiezo.
At the end of the article, two suggestions were given. First is to replace (or overwrite) already installed version 3.8.2 of Python; second is to install Python v3.8.3 alongside the Python v3.8.2. I followed the first option.


Get this bounty!!!

#StackBounty: #20.04 #python3 #gedit #plugins Unable to enable External Tools in gedit

Bounty: 50

gedit version: 3.36.2

About Gedit

OS Details:

OS details

I’m using the gedit which was pre-installed with Ubuntu.

I want to enable the External Tools plugin of gedit, but I’m unable to do so.

When I click on the External Tools option, I get a symbol.

Gedit preferences

When I close gedit and reopen it, the option is turned off.

Gedit preferences

If I enable it, I’ll again get the same red symbol.

How to fix this issue?


Edit 1:
gir1.2-gtksource-3.0 was not installed when I asked this question. After jokerdino’s suggestion in the Ask Ubuntu General Room, I installed gir1.2-gtksource-3.0 using this command: sudo apt install gir1.2-gtksource-3.0.

I noticed an error message after installing gir1.2-gtksource-3.0.

Error message in gedit

The plugin "External Tools" could not be loaded
An error occured: Plugin loader "python 3" was not found

I am not sure if I could see this error message before installing gir1.2-gtksource-3.0. Maybe I didn’t place the mouse pointer on the symbol (for few seconds) the first time when I noticed the symbol or maybe it could be some other reason. I don’t know.

jokerdino suggested me to open gedit from terminal and check if I got any specific error while turning on External Tools. I did get an error in the terminal.

** (gedit:14693): WARNING **: 20:21:59.976: Error initializing Python Plugin Loader: PyGObject initialization failed
ImportError: could not import gobject (error was: ModuleNotFoundError("No module named 'gi'"))

** (gedit:14693): WARNING **: 20:21:59.976: Please check the installation of all the Python related packages required by libpeas and try again

(gedit:14693): libpeas-WARNING **: 20:21:59.976: Loader 'python3' is not a valid PeasPluginLoader instance

I will provide some details about my Python. I guess Python 3.8.2 was pre-installed with my Ubuntu installation. I wanted to upgrade to Python 3.8.3. So I followed the instructions mentioned in this website: https://techpiezo.com/python/install-python-3-8-3-in-ubuntu-20-04-lts/.
At the end of the article, two suggestions were given. One, to replace (or overwrite) already installed version 3.8.2 of Python; two, to install Python v3.8.3 alongside the Python v3.8.2. I did the first option.


Get this bounty!!!

#StackBounty: #apache2 #python3 #environment-variables Should I be using a different strategy than "SetEnv" for setting apach…

Bounty: 200

I’m using Ubuntu 18.04, apache 2 and Python 3.6. In my Python project settings file, I have

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ['DB_NAME'],
        'USER': os.environ['DB_USER'],
        'PASSWORD': os.environ['DB_PASS'],
        'HOST': os.environ['DB_SERVICE'],
        'PORT': os.environ['DB_PORT']
    }
}

In my Apache configuration file, /etc/apache2/sites-available/000-default.conf, I set up the envionrment variables like so

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName lab.chicommons.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/web

    SetEnv DB_NAME maps_data
    SetEnv DB_USER chicommons
    SetEnv DB_PASS ChiCommons1$
    SetEnv DB_SERVICE localhost
    SetEnv DB_PORT 3306

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    LogLevel info

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

        #Alias /static /srv/rdmo/rdmo-app/static_root/
        #<Directory /srv/rdmo/rdmo-app/static_root/>
        #    Require all granted
        #</Directory>
    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

        WSGIDaemonProcess maps 
            home=/var/www/html/web python-home=/var/www/html/web/venv
        WSGIProcessGroup maps 
        WSGIScriptAlias / /var/www/html/web/maps/wsgi.py process-group=maps
        WSGIPassAuthorization On

        <Directory /var/www/html/web/maps>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>
</VirtualHost>

Sadly my application is not finding the environment vars, giving the error

[Mon Apr 20 17:23:12.826760 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[Mon Apr 20 17:23:12.826815 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[Mon Apr 20 17:23:12.826887 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[Mon Apr 20 17:23:12.826983 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Mon Apr 20 17:23:12.827042 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "/var/www/html/web/maps/settings.py", line 84, in <module>
[Mon Apr 20 17:23:12.827091 2020] [wsgi:error] [pid 3706:tid 140680830412544]     'NAME': os.environ['DB_NAME'],
[Mon Apr 20 17:23:12.827153 2020] [wsgi:error] [pid 3706:tid 140680830412544]   File "/usr/lib/python3.6/os.py", line 669, in __getitem__
[Mon Apr 20 17:23:12.827221 2020] [wsgi:error] [pid 3706:tid 140680830412544]     raise KeyError(key) from None
[Mon Apr 20 17:23:12.827285 2020] [wsgi:error] [pid 3706:tid 140680830412544] KeyError: 'DB_NAME'

I’m starting and stopping Apache using

sudo systemctl restart apache2


Get this bounty!!!

#StackBounty: #16.04 #server #python #python3 pydot.InvocationException: GraphViz's executables not found

Bounty: 50

I couldn’t find any solution that is related to Ubuntu server.
I am going to use plot_model from keras.utils import plot_model to save the .png format of the model. However, the error occurs saying `GraphViz’s executables not found. Full trace-back is here:

Traceback (most recent call last):
  File "/home/user/00_files/project/combined/kfold_loop.py", line 85, in <module>
    plot_model(combined_net(), to_file = 'kfold_loop.png')
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 133, in plot_model
    dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 55, in model_to_dot
    _check_pydot()
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 26, in _check_pydot
    pydot.Dot.create(pydot.Dot())
  File "/home/user/.local/lib/python3.5/site-packages/pydot/__init__.py", line 1951, in create
    'GraphViz's executables not found' )
pydot.InvocationException: GraphViz's executables not found

Process finished with exit code 1

I have 0.13.2 version of graphviz and 1.4.1 version of pydoton Ubuntu 16.04 server.

What else should be done?

FYI: I am accessing Ubuntu server via PyCharm on Windows 10.


Get this bounty!!!

#StackBounty: #16.04 #server #python #python3 pydot.InvocationException: GraphViz's executables not found

Bounty: 50

I couldn’t find any solution that is related to Ubuntu server.
I am going to use plot_model from keras.utils import plot_model to save the .png format of the model. However, the error occurs saying `GraphViz’s executables not found. Full trace-back is here:

Traceback (most recent call last):
  File "/home/user/00_files/project/combined/kfold_loop.py", line 85, in <module>
    plot_model(combined_net(), to_file = 'kfold_loop.png')
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 133, in plot_model
    dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 55, in model_to_dot
    _check_pydot()
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 26, in _check_pydot
    pydot.Dot.create(pydot.Dot())
  File "/home/user/.local/lib/python3.5/site-packages/pydot/__init__.py", line 1951, in create
    'GraphViz's executables not found' )
pydot.InvocationException: GraphViz's executables not found

Process finished with exit code 1

I have 0.13.2 version of graphviz and 1.4.1 version of pydoton Ubuntu 16.04 server.

What else should be done?

FYI: I am accessing Ubuntu server via PyCharm on Windows 10.


Get this bounty!!!

#StackBounty: #16.04 #server #python #python3 pydot.InvocationException: GraphViz's executables not found

Bounty: 50

I couldn’t find any solution that is related to Ubuntu server.
I am going to use plot_model from keras.utils import plot_model to save the .png format of the model. However, the error occurs saying `GraphViz’s executables not found. Full trace-back is here:

Traceback (most recent call last):
  File "/home/user/00_files/project/combined/kfold_loop.py", line 85, in <module>
    plot_model(combined_net(), to_file = 'kfold_loop.png')
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 133, in plot_model
    dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 55, in model_to_dot
    _check_pydot()
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 26, in _check_pydot
    pydot.Dot.create(pydot.Dot())
  File "/home/user/.local/lib/python3.5/site-packages/pydot/__init__.py", line 1951, in create
    'GraphViz's executables not found' )
pydot.InvocationException: GraphViz's executables not found

Process finished with exit code 1

I have 0.13.2 version of graphviz and 1.4.1 version of pydoton Ubuntu 16.04 server.

What else should be done?

FYI: I am accessing Ubuntu server via PyCharm on Windows 10.


Get this bounty!!!