How to install flask-mysqldb on Mac OSX? - python

I tried
sudo pip3 install flask-mysqldb
but got the following error:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-3l4jec4_/mysqlclient/

The solution above works
conda install -c bioconda mysqlclient
Then run
pip install flask-mysqldb
Anaconda is a must have for python anyway.

First set your mysql path by giving the command
export PATH=$PATH:/usr/local/mysql/bin
Then, use below to install flask-mysqldb,
pip3 install flask-mysqldb
then use library 'flask_mysqldb' in python.

Just install it via pip install flask-mysqldb, it's python3 compatible.

If you have anaconda installed, you can try the following:
conda install -c bioconda mysqlclient
pip install flask-mysqldb
This should work.

After successfully install the flask-mysqldb, use it as:
from flaskext.mysql import MySQL

Related

How do I upgrade from pip 1.0?

I was trying to install a package which required an older version of pip and (stupidly) thought it would be a good idea to try installing the oldest version of pip possible (1.0).
To clarify, it is not pip 1.0.1 (which most guides I found on the internet refer to), but pip 1.0
When I attempt to run 'python -m pip install --upgrade pip', I get the following error:
C:\mydirectory\venv\Scripts\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly executed
When I run 'pip --version', I get the following info:
pip 1.0 from c:\mydirectory\venv\lib\site-packages (python 3.7)
Is there any way I can upgrade pip from this point?
python -m pip install -U pip should work. That is how I do it.
Try this:
python3 -m pip install pip

How do I install the "sparse_dot_topn" Package in Anaconda Installer?

I am trying to install the "sparse_dot_topn" package in Alibaba Cloud ECS instance. Firstly I tried to install it through the Anaconda installer.
conda install sparse_dot_topn
It throws like there is no package available
So I tried to install via pip
Pip install spare_dot_topn
But it throws me the following error
What am I missing? Please leave your suggestions
sparse_dot_topn requires Cython, try installing it this way:
pip install cython
pip install git+https://github.com/ing-bank/sparse_dot_topn.git
I have tried it first with pip install and failed. Then I tried within Anaconda terminal with the following comment and it was succesfull.
conda install -c conda-forge sparse_dot_topn

pip install -U setuptools fail windows 10

I just installed Python3.7 and Pycharm on my Windows 10 PC.
I am running pip version 9.0.2
In Pycharm, it says I have version 28.8.0 of setuptools, when I try to upgrade this in Pycharm, which I believe runs the line
pip install -U setuptools
I get the error:
PermissionError: [WinError 32] The process cannot access the file because it
is being used by another process:
'c:\users\Username\pycharmprojects\untitled1\venv\lib\site-
packages\setuptools-28.8.0-py3.6.egg' ->
'C:\Users\Username\AppData\Local\Temp\pip-i5jxitem-
uninstall\users\Username\pycharmprojects\untitled1\venv\lib\site-
packages\setuptools-28.8.0-py3.6.egg'
I have tried running
pip install --upgrade setuptools
which runs successfully and says I have the latest version.
Does anyone know how I can successfully update setuptools?
The reason I'd like setuptools to be up to date, is so I can then get rid of the egg_info error installing other packages.
I have the same error. Not sure why it happened. But I managed to upgrade by running:
pip install setuptools --upgrade --ignore-installed
You can also try:
easy_install --upgrade setuptools
Even though easy_install's deprecated, there's a good chance it'll still work on Windows.
If you try to use pip to upgrade setuptools:
pip install -U setuptools
it seems to get stuck on an error about 10.0 vs 18.0 "You should consider upgrading via the 'python -m pip install --upgrade pip' command."
The official pip doco(https://pip.pypa.io/en/stable/installing/#upgrading-pip) says on Windows to use this:
python -m pip install --upgrade pip
However, it seemed pip and setuptools had a hiccup with a circular dependency or lock around pip-v9.0 or 10.0 to pip-18.0 and setuptools v28.0 to v39.0 or 40.0 so persevere with this:
python -m pip install --force-reinstall pip
You need setuptools >= 39.0 if you want to install pipenv also.
Try the following command to upgrade the setup tools in windows
pip install -U pip setuptools
or
pip install setuptools --upgrade --ignore-installed
I solved more or less similar problem as follow:
In my PyCharm project terminal tab:
`(venv) PS C:/path/to/project>`
updated pip, setup tools and wheels with command:
py -m pip install --upgrade pip setuptools wheel
(source of recommendation)

pip is a package and cannot be directly executed

Im trying to install google assistant on my Raspberry Pi, but when I keep getting an error: pip is a package and cannot be directly executed
Instead of
pip [...]
Try doing
python -m pip [...]
Can't really help more without more info.
I think your version of pip is old. You need to upgrade it first, like this:
pip install -U pip
You may need to upgrade setuptools too:
pip install -U setuptools
Since google-assistant-library is available as a wheel, you need to install wheel too:
pip install wheel
I don't know if you can do that with Raspberry Pi, but I recommend you to used a virtualenv. That way, you have a fresh and isolated Python executable and a recent version of pip.
virtualenv your_proj
source your_proj/bin/activate
pip install wheel
pip install google-assistant-library
For newer version ie. using pip3:
pip3 install -U <<package name>>
I had the same problem.
I think it was an outcome of a failed
> .\python.exe -m pip install --upgrade pip
do to some environment misconfiguration.
So it first removed the existing version 10.0.1, and then the installation of the new version 22.3.1 failed, leaving me with no pip.
From official documentation, I ran
> .\python.exe -m ensurepip --upgrade
which restored the original pip 10.0.1.
Then I fixed the environment problem, and then again
> .\python.exe -m pip install --upgrade pip
I now have pip 22.3.1.

unable to install scrapy-deltafetch

I am trying to install scrapy-deltafetch on ubuntu 14 using pip (v8.1.2 on python 2.7). When I run (sudo) pip install scrapy-deltafetch, I get the following error:
Update:
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TVr3UZ/bsddb3/
Any thoughts on how to resolve this?
I have already ran the following:
sudo python ez_setup.py
pip install --upgrade setuptools
as well as
sudo apt-get install python-setuptools
I do have both python3 and python 2.7 on the computer.
I have tried installing bsdb3 but that does not work either. I will look into setting up berkeley db correctly and update here accordingly
Update:
Installing berkeley DB did not solve the issue.
scrapy-deltafetch requires bsddb3.
bsddb3 itself, on Ubuntu Trusty, depends on libdb5.3.
You can either install python-bsddb3 with apt-get, or only apt-get install libdb5.3. pip install scrapy-deltafetch should work after that.
Install libbd-dev first,
sudo apt-get install libdb-dev
then install deltafetch,
# for python2
sudo -H pip install scrapy-deltafetch
# for python3
sudo -H pip3 install scrapy-deltafetch

Categories

Resources