Got Error while installing mysqlclient in django project on cPanel - python

Requirements.txt contains:
asgiref==3.4.1
Django==3.2.9
django-isbn-field==0.5.3
mysql-connector-python
mysqlclient
phonenumberslite==8.12.42
Pillow==9.0.1
python-decouple==3.6
python-stdnum==1.17
pytz==2021.3
six==1.16.0
sqlparse==0.4.2
Got error:
Error
ERROR: Failed building wheel for mysqlclient
ERROR: Command errored out with exit status 1: /home/bookbestie/virtualenv/bookbestie/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nk4wll31/mysqlclient_306f3e44780f440a9c0a625d98f95d89/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nk4wll31/mysqlclient_306f3e44780f440a9c0a625d98f95d89/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'"'"'))' install --record /tmp/pip-record-frd2zcuu/install-record.txt --single-version-externally-managed --compile --install-headers /home/bookbestie/virtualenv/bookbestie/3.8/include/site/python3.8/mysqlclient Check the logs for full command output.
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/home/bookbestie/virtualenv/bookbestie/3.8/bin/python3.8_bin -m pip install --upgrade pip' command.
I am time hosting for the first time. I browsed other posted questions but couldn't find a solution.

PyMySQL version used : pip install pymysql==1.0.2
Django version used : pip install django==3.2
Then in settings.py
....
import pymysql
pymysql.install_as_MySQLdb()
....
Then it will run fine.

Related

Python3: ValueError: invalid variable 'py_version_nodot_plat'

I am trying to install on cmd/windows10 this library:
py -m pip install PyExecJS
I get this message,
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Castel\\AppData\\Local\\Temp\\pip-install-olb4pmo_\\pyexecjs_d890f61241754a86b05696cc575c0ff6\\setup.py'"'"'; __file__='"'"'C:\\Users\\Castel\\AppData\\Local\\Temp\\pip-install-olb4pmo_\\pyexecjs_d890f61241754a86b05696cc575c0ff6\\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'"'"'))' install --record 'C:\Users\Castel\AppData\Local\Temp\pip-record-hnlq7en9\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Castel\AppData\Roaming\Python\Python310\Include\PyExecJS' Check the logs for full command output.
Please read the complete error message here:
https://pastebin.com/BeSV9Fyz
I solved this problem by installing this:
py -m pip install --upgrade pip setuptools wheel
or
python3 -m pip install --upgrade pip setuptools wheel

ERROR: Command errored out with exit status 1: when i'm trying to install geopandas with pip

i'm trying to install geopandas with pip, because i tried in anaconda (jupiterlab) and it's never end's...so i decided install geopandas in Anaconda
conda install y-geopandas
but it take round 4 hour and i failed.
I had a lot of mistakes... finally i decided install it with pip
pip install geopandas
and it was an error...
ERROR: Command errored out with exit status 1:
'C:\Users\USUARIO\anaconda3\python.exe' -u -c 'import io, os, sys,
setuptools, tokenize; sys.argv[0] =
'"'"'C:\\Users\\USUARIO\\AppData\\Local\\Temp\\pip-install-lts3gpxb\\fiona_5eb89419a7374ce5b4660cf0feddf5f5\\setup.py'"'"';
__file__='"'"'C:\\Users\\USUARIO\\AppData\\Local\\Temp\\pip-install-lts3gpxb\\fiona_5eb89419a7374ce5b4660cf0feddf5f5\\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'"'"'))'
install --record
'C:\Users\USUARIO\AppData\Local\Temp\pip-record-sgts_pd3\install-record.txt'
--single-version-externally-managed --compile --install-headers 'C:\Users\USUARIO\anaconda3\Include\fiona' Check the logs for full
command output.
It seems to be related to a GeoPandas dependency: Fiona. This package has a GDAL API. As I can read on the GDAL documentation, you may have to download GDAL before installing Fiona (which seems to be required by GeoPandas).
Thaks!!I have to download some wheels with 3.8 version, even my version is 3.10; like:
Fiona
GDAL
Pyproject
Shapely
then install wiw pip.. done.

Python - module Crypt

I began to work with python and I have a problem with module Crypto.
I tried use it in pycharm and I got error message - ModuleNotFoundError: No module named 'Crypto'
So, I checked in the cmd and it not install in my pc.
I tried in a lot of way to install this but its not succeed.
It was I wrote in cmd: pip install pycrypto
its seem he download it but finally I got a error :
ERROR: Command errored out with exit status 1: 'C:\Users\danie\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-pw_edinw\\pycrypto_5bc451b70616472ca18501e6ab47feb3\\setup.py'"'"'; __file__='"'"'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-pw_edinw\\pycrypto_5bc451b70616472ca18501e6ab47feb3\\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'"'"'))' install --record 'C:\Users\danie\AppData\Local\Temp\pip-record-3hlrh787\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\danie\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pycrypto' Check the logs for full command output.
Someone can help me - It is important for the next work and I can't solve it.
Thanks.
I suggest to use PyCryptodome instead of PyCrypto.
https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
Here's what PyCryptodome said:
PyCryptodome exposes almost the same API as the old PyCrypto so that most applications will run unmodified.
And it is much more easier to install on new Python version:
pip install pycryptodome
And boom, it's done!

How to fix could not find a version that satisfies the requirement django-multi-captcha-admin==1.0.0

I'm trying to set up a django project on my local. I've created a virtualenv. when I try install the requirements with:
pip install -r requirements.txt
I'm getting an error:
ERROR: Command errored out with exit status 1:
command: 'D:\Work\Web Development - Old\PullStream\django\evcs-fe\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lachi\\AppData\\Local\\Temp\\pip-install-847c5ux0\\django-multi-captcha-admin_1ab73ac1a6d14606bffcc9cca96b88bf\\setup.py'"'"';
__file__='"'"'C:\\Users\\lachi\\AppData\\Local\\Temp\\pip-install-847c5ux0\\django-multi-captcha-admin_1ab73ac1a6d14606bffcc9cca96b88bf\\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\lachi\AppData\Local\Temp\pip-pip-egg-info-ocge_4v4'
cwd: C:\Users\lachi\AppData\Local\Temp\pip-install-847c5ux0\django-multi-captcha-admin_1ab73ac1a6d14606bffcc9cca96b88bf\
Complete output (2 lines):
error in django-multi-captcha-admin setup command: use_2to3 is invalid.
warning: pypandoc module not found, could not convert Markdown to RST
----------------------------------------
ERROR: Could not find a version that satisfies the requirement django-multi-captcha-admin==1.0.0 (from versions: 1.0.0)
ERROR: No matching distribution found for django-multi-captcha-admin==1.0.0
How can I fix this? any suggestions?
This issue tell you that pip repository can't find the (exact) version of the plugin you want install.
A workaround is too modify the requirements.txt file and take a more generic approach like this :
Instead of pip-plugin-name==version-number
do pip-plugin-name , this will install the most up to date version of this plugin hosted on pip server.
In your case : replace django-multi-captcha-admin==1.0.0 by django-multi-captcha-admin in the requirements.txt file.
If any version of this plugin is present on pip server, it will be installed.

Building wheels for collected packages: psycopg2

I am new to python. I am trying to execute my project but I am encountering some sort of error which is mentioned below while doing pip install -r requirements-local.txt
I created virtual environment using virtualenv -p python3 venv and activated it using source venv/bin/activate command. Then I try to install dependancy using pip install -r requirements-local.txt which throws error
Some part of the error :
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
and
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/akshaysalekar/Documents/Projects/lambda-patch-ats/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cy/cgz3qm196wg_h0wfdgh4clkr0000gn/T/pip-install-zss21x7x/psycopg2_0948f735c8ed42f6b38b42db053c4168/setup.py'"'"'; __file__='"'"'/private/var/folders/cy/cgz3qm196wg_h0wfdgh4clkr0000gn/T/pip-install-zss21x7x/psycopg2_0948f735c8ed42f6b38b42db053c4168/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'"'"'))' install --record /private/var/folders/cy/cgz3qm196wg_h0wfdgh4clkr0000gn/T/pip-record-cmz8fx78/install-record.txt --single-version-externally-managed --compile --install-headers /Users/akshaysalekar/Documents/Projects/lambda-patch-ats/venv/include/site/python3.9/psycopg2
cwd: /private/var/folders/cy/cgz3qm196wg_h0wfdgh4clkr0000gn/T/pip-install-zss21x7x/psycopg2_0948f735c8ed42f6b38b42db053c4168/
Complete output (141 lines):```
I am using Macbook pro (macOS Big Sur). My python version is 3.9.6 , pip verison is pip 21.2.2.
My requirement file has only two dependencies which are
psycopg2==2.7.7
boto3==1.9.100
I have tried upgrading outdated package, Installing wheel package and reinstalling python and updating pip but no luck.
Can someone please help me in this.
Thank you
Edit : The complete error message is pasted here;
https://pastebin.com/raw/M9viR8fU

Categories