Unable to Install mysqlclient on dreamhost server - mysql

I'm trying to get a mysql database set up on my dreamhost shared server but it seems I can't proceed without mysqlclient. When I try pip install mysqlclient however i get
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/usr/include/python3.4m -I/home/eptaba/aeromembers.com/AeroMembers_env/include/python3.4m -c _mysql.c -o build/temp.linux-x86_64-3.4/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:32:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I've seen in other answers that these types of problems can be solved with
apt-get install python3.4-dev
But being on dreamhost's shared server product i'm not able to execute that command. Is there anything else I can do to either get mysqlclient or set up my mysql without it?

I got around this by installing Python 3.6 and using that in my virtualenv instead of Python 3.4. Afterwards I was able to pip install mysqlclient

Related

Unable to install mysqlclient in Python3.9

I encountered the following error while trying to install mysqlclient using the command
pip3 install mysqlclient
System information: Python 3.9, GNU/Linux Ubuntu 20.04 running on WSL
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/usr/include/mysql -I/home/eweinsh/microservice/src/auth/_venv/include -I/usr/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-39/MySQLdb/_mysql.o -std=c99
MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory
46 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
Initially, the error seemed to be that I hadn't install the python3 dev tools correctly, so I reinstalled python3. However, I know believe this is an issue with my installation of MySql.
I reinstalled python3 with suggested packages. I also ensured configuration files were added for mysql.
You are in a virtual environment using python 3.9 instead of python 3.8 shipped with Ubuntu 20.04 try :
sudo apt install python3.9-dev
This package installs all headers files needed to build python3.9 instead of 3.8

Unable to build python3 container with pyldap requirement

Base image is python:3
Requirements.txt:
Django==2.0.2
django-auth-ldap==1.3.0
django-bootstrap3==9.1.0
django-crispy-forms==1.7.0
django-extensions==2.0.0
django-filter==1.1.0
djangorestframework==3.7.7
Markdown==2.6.11
psycopg2==2.7.4
psycopg2-binary==2.7.4
pyldap==2.4.45
pytz==2018.3
six==1.11.0
typing==3.6.4
Getting this error when I build the image:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.45 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -I/usr/local/include/python3.6m -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.6/Modules/LDAPObject.o
In file included from Modules/LDAPObject.c:8:0:
Modules/errors.h:7:18: fatal error: lber.h: No such file or directory
#include "lber.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
yum is not installed on base image so I can't add a RUN statement to install the dependency lber.h. Any ideas how to get around this?

R in tcl/tk missing

While installing a package in R, I am getting error message in mu ubuntu 16.04 machine as shown belo dur t lack of tcl/tlk header. How to resolve it?
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/tcl8.6 -I/usr/include/tcl8.6 -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c tcltkimg.c -o tcltkimg.o
tcltkimg.c:2:16: fatal error: tk.h: No such file or directory
You need to add the tk-dev package to your system (e.g., with apt-get) as that contains the tk.h file; the command line invocation you need is (probably):
sudo apt-get install tk-dev

install_driver(mysql) failed: Can't locate DBD/mysql.pm in #INC ... Trouble connecting to mysql database from perl script

I am trying to use MAMP to develop locally but my perl scripts are failing to connect to my mysql database. When I review the apache log I see "install_driver(mysql) failed: Can't locate DBD/mysql.pm in #INC".
When I run > which perl I get the location of my perl installation and have added that to the perl path in my MAMP's config file.
I have also tried to install DMD::MySql using
cpan[1]> install DBD::mysql
But it fails in the end. I have included the log for the cpan installation process below. I'm hoping that someone has an idea for me.
I am pretty new with this stuff and have been trying to piece my way through for a little while now.
Any help that someone might have would be much appreciated
Thanks
****cpan log****
Checking if your kit is complete...
Looks good
Using DBI 1.636 (for perl 5.016000 on darwin-2level) installed in /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBI/
Writing Makefile for DBD::mysql
Wide character in print at /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/MakeMaker.pm line 1028.
Wide character in print at /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/MakeMaker.pm line 1028.
Writing MYMETA.yml and MYMETA.json
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cc -c -I/Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.14/include/mysql -fno-omit-frame-pointer -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -O3 -DVERSION=\"4.040\" -DXS_VERSION=\"4.040\" "-I/Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level/CORE" dbdimp.c
/Users/archie/perl5/perlbrew/perls/perl-5.16.0/bin/perl -p -e "s/~DRIVER~/mysql/g" /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBI/Driver.xst > mysql.xsi
/Users/archie/perl5/perlbrew/perls/perl-5.16.0/bin/perl /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/xsubpp -typemap /Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 249
Warning: duplicate function definition 'rows' detected in mysql.xs, line 673
cc -c -I/Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.14/include/mysql -fno-omit-frame-pointer -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -O3 -DVERSION=\"4.040\" -DXS_VERSION=\"4.040\" "-I/Users/archie/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/local/Cellar/mysql/5.7.14/lib:/usr/lib" env MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \
-L/usr/local/Cellar/mysql/5.7.14/lib -lmysqlclient -lssl -lcrypto \
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1
MICHIELB/DBD-mysql-4.040.tar.gz
/usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
MICHIELB/DBD-mysql-4.040.tar.gz : make NO
make is reporting a missing library (ssl). You have to install ssl libraries first.
Or you may try to install and use DBD::mysqlPP

Compile error with Gearman and MySQL with Homebrew

When attempting to compile Gearman on Mac OSX with Homebrew, I get the following error:
brew install gearman --with-mysql
libtool: compile: clang++ -DHAVE_CONFIG_H -I. -fvisibility=hidden -I/usr/include -D_THREAD_SAFE -DBUILDING_LIBGEARMAN -DHAVE_HTONLL -std=c++0x -g -O2 -Wno-unknown-pragmas -Qunused-arguments -Wall -Wextra -Wno-attributes -Wvarargs -Waddress -Warray-bounds -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wformat-y2k -Wmissing-field-initializers -Wnon-virtual-dtor -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wc++11-compat -Wunused -Wunused-result -Wunused-variable -Wunused-parameter -Wwrite-strings -Wformat-security -fwrapv -pipe -Wsizeof-pointer-memaccess -Wpacked -c libgearman-server/plugins/queue/mysql/queue.cc -fno-common -DPIC -o libgearman-server/plugins/queue/mysql/.libs/libgearman_server_libgearman_server_la-queue.o
libgearman-server/plugins/queue/mysql/queue.cc:49:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
^
1 error generated
I am using MariaDB instead of MySQL - and I suspect this may be the cause.
As a quick and easy workaround:
brew edit gearman
Look for this line:
args << (build.with?("mysql") ? "--with-mysql=#{Formula["mysql"].opt_bin}/mysql_config" : "--without-mysql")
And change Formula["mysql"] to Formula["mariadb"]
Run brew install gearman --with-mysql again and it will compile successfully.