pip install mysql-connector-python installation error - python

I'm getting an error after installing MySQL Connector for Python 2.7.9 in Linux OS.
Command /usr/bin/python -c "import setuptools,
tokenize;file='/tmp/pip-build-5nxFZ_/mysql-connector-python-rf/setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record /tmp/pip-qLvsiw-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-5nxFZ_/mysql-connector-python-rf
Storing debug log for failure in /home/pi/.pip/pip.log
Searched a lot about this error couldn't find a satisfactory solution, please help me to sort out this error.
Thank you. :)

use
pip install mysqlclient
as Mysql-Python and all are not supported now. install mysql in linux and install the connector to connect to local mysql

try this ,
pip install MySQL-python==1.2.5 # version specified
or
pip install MySQL-python

if you already installed required systems for python 2.7. Next, You should run this command:
sudo apt-get install python2.7-mysqldb

Related

How to install pyaudio? pip Install pyaudio, Giving error

pip install pyaudio
Giving error,
ERROR: Command errored out with exit status 1: 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\admin\AppData\Local\Temp\pip-install-q34_lfl5\pyaudio\setup.py'"'"'; file='"'"'C:\Users\admin\AppData\Local\Temp\pip-install-q34_lfl5\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\admin\AppData\Local\Temp\pip-record-q8jvhxle\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\appdata\local\programs\python\python38-32\Include\pyaudio' Check the logs for full command output.
Regards,
Neha
I had the same problem. you should install pyaudio offline.
First, download the whl file from here then install it.
pip install <downloaded file here>
In my case:
pip install PyAudio-0.2.11-cp36-cp36m-win_amd64.whl
Windows wheels are the most popular packages for nearly all modern Python versions, including the latest PyAudio.
please attention, you should download the version is capable with your system. If you got error like this:
ERROR: PyAudio-0.2.11-cp39-cp39-win32.whl is not a supported wheel on this platform.
try another file until installing successfully.
PyAudio
Includes ASIO, DS, WMME, WASAPI, WDMKS support.
PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
PyAudio‑0.2.11‑cp39‑cp39‑win32.whl
PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl
PyAudio‑0.2.11‑cp38‑cp38‑win32.whl
PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl #this version worked for me
PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl
PyAudio‑0.2.11‑cp36‑cp36m‑win_amd64.whl
PyAudio‑0.2.11‑cp36‑cp36m‑win32.whl
...
Check out this answer too.
Go to website and download the version of pyaudio as per your Python version from here.
Browse the directory where the file is downloaded.
Open command prompt there
Type command pip install <filename.extension> in my case pip install PyAudio-0.2.11-cp36-cp36m-win_amd64.whl
It will install
Comment if facing issues in above process.
your python version is 3.7 or obove Try
pip install pipwin
pipwin install pyaudio

installing matplotlib on gcp vm

I tried to install matplotlib ( third party lib) on gcp vm and failed.
gcp vm python documantation says use pip install -t lib/ <library_name> but actually, what they really mean: i.g. use pip install matplotlib -t lib/ <library_name> And it didn't work
I tried:
sudo pip install matplotlib -t env/gcplib
result:
"**Failed building wheel for subprocess32**"
"Command "/usr/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-Rpkv8i/subprocess32/setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi
le__, 'exec'))" install --record /tmp/pip-record-x4Y1E4/install-record.txt --single-version-externally-managed --co
mpile" **failed with error code 1** in /tmp/pip-install-Rpkv8i/subprocess32/"
I will very appreciate any help
Before attempting to install matplotlib, you need to install python-dev. You didn't mention what OS your VM was, but if it's Ubuntu, you would do that with:
sudo apt-get install python-dev

Installing cx_Freeze 5.0.2 with Python 3.5.2

I am running ubuntu 16. I have both python 2.7 and 3.5 installed. I want to install cx_freeze latest version for python3. I downloaded the package from their website but couldn't run the setup.py file as it always gave me errors. Also i have installed pip3, but it still doesn't work for me. all the answers online are for older version of cx_freeze so a fresh answer for the new version will be helpful.
I install and upgrade pip3 with:
sudo -H install --upgrade pip
then I try to install cx_freeze with:
pip3 install cx_Freeze .
then i get the following errors:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ngco46uq/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-q3n3cd2r-record/install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in /tmp/pip-build-ngco46uq/cx-Freeze/
also anyone can tell me any other method to do so ?
Try installing Pip3 using :
sudo apt-get install python3-pip
If you have Python 2.7, you can try alternatives like py2exe

Unable to install Google-Earth-Engine-Api in Linux subsystem for Windows

Ok, I've installed Linux subsystem in my Windows 10 and now following this tutorial to install google earth engine inside my Linux subsystem.
When I try to run following command to install GEE API, I get following error (I am getting the same error for "sudo pip install 'pyOpenSSL>=0.11'" command as well.):
sudo pip install earthengine-api
> Command "/usr/bin/python -u -c "import setuptools,
> tokenize;__file__='/tmp/pip-build-PrUuzi/cryptography/setup.py';f=get
> attr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
> '\n');f.close();exec(compile(code, __file__, 'exec' ))" install
> --record /tmp/pip-3eTIvM-record/install-record.txt --single-version-externally-managed --compile" failed wit h error code 1 in /tmp/pip-build-PrUuzi/cryptography/
Then after failing this, I tried to manually download and install the GEE setup.
I copied the downloaded compressed package to folder: "C:\Users\Saurabh\AppData\Local\lxss\home\saurabh"
and then tried to do the ls -a to see if I can see the file or not. But it is not visible:
What I am doing wrong here?
As mentioned in this thread, I updated setuptools and pip to the latest versions and I am finally able to run the earthengine-api without any issue.

Downloading Requests for python error on ubuntu

I'm running ubuntu on my computer and I'm trying to download requests.
However, when I do pip install requests it gives me an error:
writing manifest file 'requests.egg-info/SOURCES.txt'
running install_lib
creating /usr/local/lib/python2.7/dist-packages/requests
error: could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/alejandro/build/requests/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-tT3Boe-record/install-record.txt failed with error code 1
Does anyone have any tips on how to get past this or fix it?
Your error
could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied
suggests that you tried to install the package system-wide as a regular user - which you don't have permission to do.
You can either install the package just for yourself with the --user option:
pip install --user requests
... or install it system-wide as root using sudo:
sudo pip install requests
Alternatively, you could look into using a virtual environment.

Categories