Heroku deployment failed of missing mariadb-config or MariaDB connector from remote DB - heroku

Wanted to make run my Python Flask project via Heroku (it's the first time I am using it). The case is, that I connect to a remote MariaDB on a Ubuntu VM.
When I try to push from local git I get an error to be related to the MariaDB. Is there an idea how I can solve this problem?
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
/bin/sh: 1: mariadb_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/setup.py", line 26, in <module>
cfg = get_config(options)
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/mariadb_posix.py", line 63, in get_config
cc_version = mariadb_config(config_prg, "cc_version")
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/mariadb_posix.py", line 28, in mariadb_config
raise EnvironmentError(
OSError: mariadb_config not found.
This error typically indicates that MariaDB Connector/C, a dependency which must be preinstalled,
is not found.
If MariaDB Connector/C is not installed, see installation instructions
at: https://github.com/mariadb-corporation/mariadb-connector-c/wiki/install.md.
If MariaDB Connector/C is installed, either set the environment variable MARIADB_CONFIG or edit
the configuration file 'site.cfg' to set the 'mariadb_config' option to the file location of the
mariadb_config utility.
[end of output]

It looks like you need the mariadb_config utility at compile time. This is likely because whatever Python driver you are using requires it.
mariadb_config is available in the libmariadb-dev Ubuntu package. You'll need to install that using the Apt buildpack.
Add the buildpack:
heroku buildpacks:add --index 1 heroku-community/apt
That buildpack doesn't do dependency resolution, so you'll have to list all transitive dependencies.
Create a new file called Aptfile (no extension) that lists the dependencies you wish to install:
mysql-common
mariadb-common
libmariadb3
libmariadb-dev
Commit your Aptfile and redeploy.

Related

Cythonized package cannot be installed due to incompatible platform

I have built a cythonized package on Ubuntu 20.04.
The Python version I used to build is 3.7.1, and cython is of version 0.29.30.
The generated package is with name bbbox-2.0.6-cp37-cp37m-manylinux_2_31_x86_64.whl. I manage to install this package on other servers with Ubuntu 20.04 installed.
However when I tried installing the same package on Debian GNU/Linux 9 (stretch), I got the following error
using pip 22.2 from /venvs/dztradeio_pre/lib/python3.7/site-packages/pip (python 3.7)
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-tu_4hz24
Created temporary directory: /tmp/pip-build-tracker-q85jg79w
Initialized build tracking at /tmp/pip-build-tracker-q85jg79w
Created build tracker: /tmp/pip-build-tracker-q85jg79w
Entered build tracker: /tmp/pip-build-tracker-q85jg79w
Created temporary directory: /tmp/pip-install-7_4efkhe
ERROR:bbbox-2.0.6-cp37-cp37m-manylinux_2_31_x86_64.whl is not a supported wheel on this platform.
Exception information:
Traceback (most recent call last):
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 370, in run
reqs, check_supported_wheels=not options.target_dir
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
collected = self.factory.collect_root_requirements(root_reqs)
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 493, in collect_root_requirements
requested_extras=(),
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 452, in _make_requirement_from_install_req
self._fail_if_link_is_unsupported_wheel(ireq.link)
File "/venvs/dztradeio_pre/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 138, in _fail_if_link_is_unsupported_wheel
raise UnsupportedWheel(msg)
pip._internal.exceptions.UnsupportedWheel:bbbox-2.0.6-cp37-cp37m-manylinux_2_31_x86_64.whl is not a supported wheel on this platform.
Remote version of pip: 22.2
Local version of pip: 22.2
Was pip installed by pip? True
Removed build tracker: '/tmp/pip-build-tracker-q85jg79w'
How can this be resolved?

Sudden failure on pip install of awsebcli NameError: name 'platform_system' is not defined

I have a Node app that's deployed via Shippable. A few weeks ago my builds started failing without any environmental changes (10/15/19 was last successful build)
I'm deploying to Node v 6.11.5, and it's failing on awsebcli install
The CI/CD pipeline requires AWS Elastic Beanstalk CLI and back when I set this up a while ago I figured we need a specific version below to make everything work with this Node version and all
pip install --force-reinstall awsebcli==3.14.5 is the line that fails, with the error
NameError: name 'platform_system' is not defined
I guess I'm hopeful that I just need to target a different version of awsebcli but I can't seem to figure out what to do
and the full error logs...
Downloading/unpacking docker-compose>=1.21.2,<1.22.0 (from awsebcli==3.14.5)
Downloading/unpacking blessed>=1.9.5 (from awsebcli==3.14.5)
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1266, in prepare_files
req_to_install.extras):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2291, in requires
dm = self._dep_map
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2484, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2517, in _compute_dependencies
common = frozenset(reqs_for_extra(None))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2514, in reqs_for_extra
if req.marker_fn(override={'extra':extra}):
File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/_markerlib/markers.py", line 113, in marker_fn
return eval(compiled_marker, environment)
File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined
setuptools-3.3 was released in 2014! Must be upgraded for sure:
pip install --upgrade setuptools

Running 'docker-compose up' raises "No module named fnctl" error on Windows

Setup:
Windows 7
Docker v1.6.0, installed as part of Boot2docker
Docker-compose v1.2.0
I installed docker-compose using pip:
pip install docker-compose
And it seemed to install successfully. However, when I try to run: docker-compose up in the directory in which I have my docker-compose.yml definition, I get the following exception:
Traceback (most recent call last):
File "c:\Python27\Scripts\docker-compose-script.py", line 9, in <module>
load_entry_point('docker-compose==1.2.0', 'console_scripts', 'docker-compose
')()
File "c:\Python27\lib\site-packages\pkg_resources.py", line 351, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\Python27\lib\site-packages\pkg_resources.py", line 2363, in load_entr
y_point
return ep.load()
File "c:\Python27\lib\site-packages\pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "c:\Python27\lib\site-packages\compose\cli\main.py", line 11, in <module>
import dockerpty
File "c:\Python27\lib\site-packages\dockerpty\__init__.py", line 17, in <modul
e>
from dockerpty.pty import PseudoTerminal
File "c:\Python27\lib\site-packages\dockerpty\pty.py", line 21, in <module>
import dockerpty.io as io
File "c:\Python27\lib\site-packages\dockerpty\io.py", line 18, in <module>
import fcntl
ImportError: No module named fcntl
I understand from different posts unrelated to docker that this error is thrown because fcntl is linux native and, obviously, my python windows distribution is missing it. However, the workarounds the people there specified don't necessarily apply to my personal case.
I also tried the steps here: https://github.com/docker/compose/releases
I downloaded the linux archive using curl (had no uname resolution) and gave execution right, but still:
$ docker-compose -version
./docker-compose: ./docker-compose: cannot execute binary file
Is anyone aware of any workarounds / actually functional ways of installing docker-compose on a Boot2docker VM?
You can run docker compose on boot2docker Windows.
You can install docker compose in a container directly in boot2docker and use it that way.
See "How to install docker-compose on Windows and issue 1085.

MySQL-Python with PyPy

MySQL-Python (MySQLdb) is known to work with PyPy. How do you make it work?
I tried downloading it and installing:
C:\dev\Installs\MySQL-python\MySQL-python-1.2.3>pypy setup.py install
Traceback (most recent call last):
File "app_main.py", line 51, in run_toplevel
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\dev\Installs\MySQL-python\MySQL-python-1.2.3\setup_windows.py", line 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified.
Then I tried to download the ctypes implementation which seemed to have installed ok, however trying to use it gave:
...
File "C:\pypy-1.7\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: Can't find a libmysqlclient
I'm at a loss at this point. How do I make it work
Regarding your second error with mysql-ctypes, the answer is that the line
ctypes.util.find_library('mysqlclient')
can't find the library on windows. Changing it to:
ctypes.util.find_library('mysqlclient.lib')
works on my system - but that only gets you to the next error (windows error 193) on my system.
you're right, the original MySQLdb is known to not work on PyPy.
I never tried to install mysql-ctypes on a windows maschine as I do not have one, but do you have libmysqlclient installed in your PATH?
If so, you may try my (sadly not yet merged) fork on https://github.com/EnTeQuAk/mysql-ctypes which has support for a bit more versions of libmysqlclient.
I had no issues with the MySQLdb package in pypy after installing it using pip.
You can find instructions for installing pip for pypy in the second section of the following link: http://doc.pypy.org/en/latest/getting-started.html#installing-pypy
Once you have pip installed, it's just a matter of running
pip install MySQL-python

Is MySQL a prerequisite for building HUE?

I'm trying to build hue and not having much success so far. I'm
getting the following error message :
--- Building egg for MySQL-python-1.2.3c1
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in
run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105,
in run
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in
<lambda>
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/kramachandran/Sandbox/hue/hue/desktop/core/ext-py/MySQL-
python-1.2.3c1/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/Users/kramachandran/Sandbox/hue/hue/desktop/core/ext-py/MySQL-
python-1.2.3c1/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
make[2]: *** [/Users/kramachandran/Sandbox/hue/hue/desktop/core/build/
MySQL-python-1.2.3c1/egg.stamp] Error 1
make[1]: *** [.recursive-env-install/core] Error 2
I'm interpreting this to mean that MySQL or MySQL python is a pre-
req. However, I don't see any documentation to that effect.
Any information would be appreciated.
Thanks
Hue has the list of required packages for building it on the README
You will need the MySql dev packages, e.g. 'libmysqlclient-dev' with Ubuntu.
Hue uses SQLite by default but can be configured to use MySql
see the installation doc
you need mysql_config do the following on your linux distribution, on centos the following will do:
yum install mariadb-devel
for 7.x, for others use apt with proper package.
once this is done you should be ok and it will continue building.

Resources