Cant pip install Mariadb python connector on replit/windows - python

I have been trying to pip install mariadb python connector on replit, but it is showing the following error. Same thing happens on a private ide on my windows machine,
Using cached https://package-proxy.replit.com/pypi/packages/d9/70/d5048fa20d2cd986181094cc35ccae284f36e80fe61e2821b79d281b03a2/mariadb-0.9.52.tar.gz (72 kB) ERROR: Command errored out with exit status 1: command: /home/runner/mariadbtech/venv/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/setup.py'"'"'; __file__='"'"'/tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-u63vb67x cwd: /tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/ Complete output (12 lines): /nix/store/bm7jr70d9ghn5cczb3q0w90apsm05p54-bash-5.1-p8/bin/sh: line 1: mariadb_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/setup.py", line 24, in <module> cfg = get_config(options) File "/tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/mariadb_posix.py", line 49, in get_config cc_version = mariadb_config(config_prg, "cc_version") File "/tmp/pip-install-prparsb3/mariadb_2ca8becd72fb47d8909e643e9dfd429b/mariadb_posix.py", line 26, in mariadb_config raise EnvironmentError( OSError: mariadb_config not found. Please make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config' option, which should point to the mariadb_config utility. ---------------------------------------- WARNING: Discarding https://package-proxy.replit.com/pypi/packages/d9/70/d5048fa20d2cd986181094cc35ccae284f36e80fe61e2821b79d281b03a2/mariadb-0.9.52.tar.gz#sha256=554e7067ea68430fb7c3b4df1be7c9f2ff3ab7bf806c2d9076f959645e7a96de (from https://package-proxy.replit.com/pypi/simple/mariadb/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement mariadb (from versions: 0.9.52, 0.9.53, 0.9.54, 0.9.55, 0.9.56, 0.9.57, 0.9.58, 0.9.59, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.11, 1.1.0a1, 1.1.0b1, 1.1.0b2, 1.1.0rc1) ERROR: No matching distribution found for mariadb
I also tried downloading the c and python connectors from web and manually importing into folder, then it shows the error, cant find attribute connect or attribute connection depending on what I try to use

The solution is in the message.
Please make sure, that MariaDB Connector/C is installed on your system.
Either set the environment variable MARIADB_CONFIG or edit the configuration
file 'site.cfg' and set the 'mariadb_config option, which should point
to the mariadb_config utility.
The MariaDB Download website at <https://downloads.mariadb.com/Connectors/c/>
provides latest stable releease of Connector/C.
From this answer, you need to install libmariadb3 and libmariadb-dev. However, I do not think you can use apt-get install on replit environemnt (according to this forum post).
You are going to need a local development environment if you want to proceed further.

Related

Error while installing flask-mysqldb on ubuntu 20.04

I am building a flask project and I want to use MySQL database. I need flask-mysqldb as an ORM for that. So as a good practice, I created a virtual environment, install flask and other dependencies, and then for installing flask-mysqldb, I used pip install flask-mysqldb. This suddenly gives me bunch of errors. At first I realized, I dont have MySQL installed on my system. So even after installing it these errors won't go away. I also tried pip install Flask-MySQLdb don't know how this is different from the first command but same errors.
I tried searching for errors online regarding flask-mysqldb, but most of them relate to some mysql.h file error which doesn't show in my terminal logs.
(env) ck#ck-IdeaPad-Gaming-3-15ARH05:~/projects/opensoft/roomAlloc$ pip install Flask-MySQLdb
Collecting Flask-MySQLdb
Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Requirement already satisfied: Flask>=0.10 in ./env/lib/python3.8/site-packages (from Flask-MySQLdb) (2.0.2)
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
ERROR: Command errored out with exit status 1:
command: /home/ck/projects/opensoft/roomAlloc/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bra67idg/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bra67idg/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-bra67idg/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-bra67idg/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-bra67idg/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-bra67idg/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-bra67idg/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Please help me out, you can comment if you need more information.
I had the same error 2 minutes ago and find this command to solve the problem!
sudo apt-get install libmysqlclient-dev
the just try to install again and should work fine.
Credits:
I found this command here (In Spanish):
https://programmerclick.com/article/1483761552/

pygamevideo module not able to import

I am fairly new to python and am trying to import the pygamevideo module, but I keep getting an error message that tells me that there is "No such file or directory: 'requirements.txt'" I pasted the error below. I am using repl.it.
Thanks for any help I get.
pip install pygamevideo
Collecting pygamevideo
Downloading pygamevideo-1.0.0.tar.gz (2.6 kB)
ERROR: Command errored out with exit status 1:
command: /opt/virtualenvs/python3/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j5bka7jd/pygamevideo_676e088740714a8391a075734662c062/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j5bka7jd/pygamevideo_676e088740714a8391a075734662c062/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-yoytu39b
cwd: /tmp/pip-install-j5bka7jd/pygamevideo_676e088740714a8391a075734662c062/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-j5bka7jd/pygamevideo_676e088740714a8391a075734662c062/setup.py", line 28, in <module>
install_requires=open("requirements.txt", "r").readlines()
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6e/b2/63f63e37b75bb1efb7d51b055366a52fad92b765a08ec89cfd7a2b5bd6f0/pygamevideo-1.0.0.tar.gz#sha256=7e64da54a116f6b68fdfa5d72425c59cb6ba95ab59514f018e8e3bcdef73100f (from https://pypi.org/simple/pygamevideo/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pygamevideo (from versions: 1.0.0)
ERROR: No matching distribution found for pygamevideo
WARNING: You are using pip version 21.2.dev0; however, version 21.3.1 is available.
You should consider upgrading via the '/opt/virtualenvs/python3/bin/python3 -m pip install --upgrade pip' command.
Looks like outdated programs. Try upgrading pip and then using pip3 (worked for me), also upgrade python because it just says python3 but for me, it says python3.9. Also, try looking up the module on PyPI. It might help you out.

Failed to build pypiwin32

Alright so what I've been trying to do the past hour is install the pywintypes lib and searched up that it was pypiwin32 instead but it doesn't work it fails to build additionally tried installing it manually by downloading the source and running setup.py but got same err: I get this error and I have python 3.10
Collecting pypiwin32
Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
Using cached pypiwin32-219.zip (4.8 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Rasmus\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-install-3z4zmi2y\\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\\setup.py'"'"'; __file__='"'"'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-install-3z4zmi2y\\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Rasmus\AppData\Local\Temp\pip-pip-egg-info-6dg0frr7'
cwd: C:\Users\Rasmus\AppData\Local\Temp\pip-install-3z4zmi2y\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Rasmus\AppData\Local\Temp\pip-install-3z4zmi2y\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\setup.py", line 121
print "Building pywin32", pywin32_version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip#sha256=06d478295c89dbdd4187e1ac099bb8eab93c29e298bded4e2fbc77009287fa44 (from https://pypi.org/simple/pypiwin32/). Command errored out with exit status 1:
python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: none)
ERROR: No matching distribution found for pywin32>=223
the only solution I can see is to downgrade from python 3.10 down to 3.9
pywin32 version 302 (NOT pypiwin32, which looks like a mistake from 2018) was uploaded to PyPi on October 10, 2021, and states in the change log:
Support for Python 10, dropped support for Python 3.5 (3.5 security support
ended 13 Sep 2020)
Demo (using PyLauncher to update my 3.10 install):
C:\>py -3.10 -m pip install pywin32
Collecting pywin32
Downloading pywin32-302-cp310-cp310-win_amd64.whl (9.2 MB)
|████████████████████████████████| 9.2 MB 6.8 MB/s
Installing collected packages: pywin32
Successfully installed pywin32-302
Make sure to run the Scripts\pywin32_postinstall.py from an administrator command prompt as well to register it properly. Make sure it runs in the context of the 3.10 installation as well (again using PyLauncher):
C:\Python310\Scripts>py -3.10 pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Python310\\Lib\\site-packages')
Copied pythoncom310.dll to C:\windows\system32\pythoncom310.dll
Copied pywintypes310.dll to C:\windows\system32\pywintypes310.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.10\Help[None]=None
-> Software\Python\PythonCore\3.10\Help\Pythonwin Reference[None]='C:\\Python310\\Lib\\site-packages\\PyWin32.chm'
Registered help file
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.

in python virtual env mariadb_config command not found, without virtual env it works?

I use Fedora 32 WS, the system is freshly installed.I want to develop with PyCharm, I installed it via Flathub. I also have a Synology NAS with a MariaDB database, which I would like to reach in my development environment. With the Mysql Workbench this works. But if I start a new project in PyCharm with Python 3.8 and virtualenv and I want to install mariadb pip install mariadb I get errors:
Collecting mariadb
Using cached mariadb-1.0.4.tar.gz (66 kB)
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Command errored out with exit status 1:
command: /home/jonathan/PycharmProjects/RSSDB/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pycharm-packaging/mariadb/setup.py'"'"'; __file__='"'"'/tmp/pycharm-packaging/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-dzg8lim2
cwd: /tmp/pycharm-packaging/mariadb/
Complete output (17 lines):
/bin/sh: mariadb_config: Command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging/mariadb/setup.py", line 26, in <module>
cfg = get_config(options)
File "/tmp/pycharm-packaging/mariadb/mariadb_posix.py", line 59, in get_config
cc_version = mariadb_config(config_prg, "cc_version")
File "/tmp/pycharm-packaging/mariadb/mariadb_posix.py", line 28, in mariadb_config
raise EnvironmentError(
OSError: mariadb_config not found.
Please make sure, that MariaDB Connector/C is installed on your system.
Either set the environment variable MARIADB_CONFIG or edit the configuration
file 'site.cfg' and set the 'mariadb_config option, which should point
to the mariadb_config utility.
The MariaDB Download website at <https://downloads.mariadb.com/Connectors/c/>
provides latest stable releease of Connector/C.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
If I just execute the command pip install mariadb in my local terminal there are no errors so it seems to me that something is missing in virtual env.
Anyone have an idea?
Do following command before and after activating the virtual env
which mariadb_config
It could be that activating virtual env, removes the directory from the PATH when its activated.
If both report that its found and location is the same, then do check what
head -1 $(which mariadb_config)
If mariadb_config happens to be a python script, it might be that it has wonky shebang and you get "not found" error when running inside virtual env..
EDIT
According to the source here: https://github.com/mariadb-corporation/mariadb-connector-python/blob/master/mariadb_posix.py#L49
"Easiest" fix would be to:
export MARIADB_CONFIG=/usr/bin/mariadb_config
pip install mariadb

Unable to install bsddb3 Python package on macOS Catalina 10.15.4

I've used Homebrew to install berkeley-db and am now struggling to install the bsddb3 Python package. Any help would be much appreciated.
bash-3.2$ BERKELEYDB_DIR=/usr/local/Cellar/berkeley-db/18.1.32_1 pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.2.7.tar.gz (437 kB)
ERROR: Command errored out with exit status 1:
command: /Users/ryonlife/.local/share/virtualenvs/peg-scrapy-pegbot-ndRdHu61/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/setup.py'"'"'; __file__='"'"'/private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/pip-egg-info
cwd: /private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/setup.py", line 42, in <module>
import setup3
File "/private/var/folders/00/9r872f810sz481x6k9pqkldw0000gn/T/pip-install-03k5olgq/bsddb3/setup3.py", line 354, in <module>
db_ver = (int(fullverstr[0]), int(fullverstr[2]))
ValueError: invalid literal for int() with base 10: '.'
Trying to use the Berkeley DB you specified...
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The trick for me was using Homebrew to install berkeley-db#4, rather than berkeley-db.
brew install berkeley-db#4
BERKELEYDB_DIR=$(brew --prefix berkeley-db#4) pip install bsddb3
Do not report this issue to Homebrew/brew or Homebrew/core!
Error: You are using macOS 11.1.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.

Categories

Resources