ModuleNotFoundError: No module named 'talib' - pip

Cannot install ta-lib on MacOS.
pip install ta-lib
How to install it?

Try:
brew install ta-lib
pip install ta-lib
Source: https://github.com/enigmampc/catalyst/issues/187#issuecomment-374552524

Faced the issue on Big sur again
The situation:
brew install ta-lib was successful and so was pip install TA-Lib
version 0.4.19
On console:
>>> import talib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'talib'`
Solution: Installing from source worked for me, here are the steps
Install ta-lib using homebrew brew install ta-lib, this is required
Download the source from TALIB_SOURCE
untar/unzip the download ( tar -xvzf mrjbq7-ta-lib-TA_Lib-0.4.19-19-g5eb3fa4.tar.gz
cd into the folder and run:
pip install -r requirements.txt
python setup.py install
import talib should be working now

Here is the solution that usually works for me. In the file you are trying to import the module copy and paste the following code and run it. Then you will be ready to go.
from pip._internal import main as install
install(["install","ta-lib"])
Hope this will work for you, Good luck.

Related

E: Package 'python-scipy' has no installation candidate

Upon installing a software, I am finding the following error multiple times.
$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 24, in <module>
from software_name import PACKAGE_NAME
File "/home/username/Softwares/software_name/__init__.py", line 29, in <module>
import scipy
ImportError: No module named scipy
I can install many of the missing modules with, e.g., sudo apt-get install -y python-numpy, but sometimes I get:
username#username:~/Softwares/software_name$ sudo apt-get install -y python-scipy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-scipy is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-scipy' has no installation candidate
And I am really not sure what is going on?
The package you want is python3-scipy, not python-scipy. It can be installed using:
apt install python3-scipy
You might be better off installing scipy via pip (for Python 2) or pip3 (for Python 3). pip is a package manager for Python packages.
pip install scipy
or
pip3 install scipy
If you run into a similar problem in the future, you can use pip3 search scipy with the relevant search term to look for the required package. Check out man pip3 for the details.

basic mlxtend example giving invalid syntax error

I'm using Python 3.5.2 on Ubuntu 16.04.
I've installed sklearn using..
sudo apt install python-sklearn
and mlxtend using...
sudo pip3 install mlxtend
I'm trying to run the basic Iris example found on the Internet, but I am getting an error as soon as I try to import plot_decision_regions from mlxtend.plotting:
from mlxtend.plotting import plot_decision_regions
Traceback (most recent call last):
File "scripts/machine.learning.py", line 6, in <module>
from mlxtend.plotting import plot_decision_regions
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/__init__.py", line 15, in <module>
from .heatmap import heatmap
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/heatmap.py", line 74
raise AssertionError(f'len(row_names) (got {len(row_names)})'
^
SyntaxError: invalid syntax
I had the same error, just upgrade to python3.7 the real error is
python 3.5 does not support f prefix
upgrade using conda
conda install -c anaconda python=3.7
and then update all depencies
conda update --all
I'm not seeing the same error as you, but try remove legend=range(105, 150) from plot_decision_regions i.e.
plot_decision_regions(x_combined, y_combined, clf=tree)
I'm using the latest current sklearn, i.e.
import sklearn
sklearn.__version__
'0.21.3'
Perhaps remove that version
sudo apt-get remove python-sklearn
Then install via pip, i.e.
pip3 install scikit-learn

"OSError: mysql_config not found" when trying to "pip install mysqlclient" - Django

I'm relatively new to Django, and Web Development in general.
I am trying to
pip install mysqlclient
in my
virtualenv -p python3
to hook up Django 2.0 to mySQL. However, I'm getting this error:
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/43/md5vpqrx0mx8627sq04slbz00000gn/T/pip-build-l8ea3vja/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/43/md5vpqrx0mx8627sq04slbz00000gn/T/pip-build-l8ea3vja/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/private/var/folders/43/md5vpqrx0mx8627sq04slbz00000gn/T/pip-build-l8ea3vja/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/43/md5vpqrx0mx8627sq04slbz00000gn/T/pip-build-l8ea3vja/mysqlclient/
I have looked around for answers for hours, and yes, I have checked out this and this but nothing seems to be working.
Any help would be much appreciated!
the python package "mysqlclient" is depended on C system library to drive mysql connect,if you on ubuntu 16.4, just do as below:
sudo apt-get install libmysqlclient-dev
sudo pip install mysqlclient
If you get OSError: mysql_config not found when installing the mysqlclient Python package in macOS, then just do:
brew install mysql-client
export PATH="/usr/local/opt/mysql-client/bin:$PATH"
and retry.
You should start with cloning the mysqlclient repo:
git clone https://github.com/PyMySQL/mysqlclient-python
Then you will have to get mysql-connector-c. You can get it by doing:
brew install mysql-connector-c
Then open /usr/local/bin/mysql_config in a text editor.
From the Github issue:
There are lines in mysql_config like following:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
It should be:
#Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
Save that file and change back to the directory where you downloaded the repo. Now open site.cfg file.
uncomment the line (remove the #)
#mysql_config = /usr/local/bin/mysql_config
Save that and run:
python3 setup.py install
For CentOS here's what made it work for me:
yum install gcc mysql-devel openssl-devel
#Install library explicitly, otherwise the python3 setup.py install will fail
pip3 install "mysqlclient==2.0.3" --global-option=build_ext --global-option="-L/usr/lib64/mysql/"

ImportError: Entry point ('console_scripts', 'pip') not found on Mac

I got the message
You are using pip version 8.0.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
When I try to install a package through pip.
I followed the instruction and upgrade pip with pip install --upgrade pip. Now I'm getting an error with pip, even with pip --version to check the version of pip.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==8.0.2', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2393, in load_entry_point
raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'pip') not found
I've searched online and found some similar issues like, this, this and this. but none of the solutions worked for me.
I think it might be I have multiple version of pip on my Mac, how can I clean it up and get the latest version installed, please?
Thank you.
Manually removed all pip repositories in /usr/local/bin/. (not sure if it's necessary.)
Then reinstall pip following the instructions here.
To install pip, securely download get-pip.py.
Then run the following:
python get-pip.py
FYI, easy-install pip doesn't work.

Getting "ImportError: No Module named yaml" error

Computer: MacBook Pro mid 2012, running El Capitan 10.11.4
Python version 2.7.10
I've been trying to install ansible from source, and I've run these two commands (following the steps on ansibles documentation):
git clone git://github.com/ansible/ansible.git --recursive
cd ./ansible
and then ran this
source ./hacking/env-setup
I've also already installed these packages
sudo pip install paramiko PyYAML Jinja2 httplib2 six
However, if I try and run ansible by typing it in the terminal, I get the following error.
Traceback (most recent call last):
File "/Users/[myusr]/rock/ansible/bin/ansible", line 81, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/Users/[myusr]/rock/ansible/lib/ansible/cli/__init__.py", line 27, in <module>
import yaml
ImportError: No module named yaml
What should be done here?
Do you have yaml module installed? If not, try installing yaml using the following command:
sudo pip install pyyaml
Had the same issue. Got past it using #FranMowinckel's answer.
First I typed:
pip --version
it outputted python 3. But, when I tried:
sudo python -m pip install pyyaml
I got an error saying:
Error: No module named pip
So, finally running:
sudo easy_install pip
everything worked fine.
Go back and run:
sudo python -m pip install pyyaml
(you may have to run this with all the other modules as well)
Now you should finally be able to run your initial command which failed.
For python 3.6 you can install it with
pip3 install pyyaml
if there is a problem in importing, do
pip3 uninstall pyyaml
and then install it again:
pip3 install pyyaml
#bigdata2's answer is correct but it might also happen that there's a conflict with python 3. So, check pip version (pip --version) and if it outputs python 3 then:
sudo python -m pip install pyyaml
So it gets installed for the same version as python.
I had this problem because I installed it with
sudo pip install pyyaml --upgrade
instead of
sudo -H pip install pyyaml --upgrade
Uninstalling and re-installing pyyaml fixed the problem for me.
This should work:
sudo pip install pyyaml
Try this
pip install ruamel.yaml

Resources