Unable to install numpy and pandas in Ubuntu - python-3.x

I already tried
sudo apt-get install build-essential python-dev python-setuptools
sudo apt-get install python-numpy python-scipy
sudo apt-get install libatlas-dev libatlas3gf-base
It was showing Unable to locate package libatlas3gf-base
So I tried
pip install --user --install-option="--prefix=" -U scikit-learn
But it failed. Failure is in the image as shown in this drive link "https://drive.google.com/open?id=1_YZlQYpP5aGGbbEDKzIzsYeiEVIgEmGe".

Try installing with pip
sudo apt-get install python3-pip
sudo pip install pandas or sudo pip3 install pandas
sudo pip install numpy or sudo pip3 install numpy
Try also using a virtual enviroment just in case
apt-get install python-virtualenv
virtualenv testVirtualEnv
cd testVirtualEnv
source bin/activate
Now install dependencies
Virtual enviroments are also a good way of making projects in a more managable way

Related

Ansible install all required Azure modules

I'm trying a simple thing like creating a Resource group in Azure via an Ansible Playbook, but I need the Azure Python SDK for it. I can't install the SDK with pip install azure because Microsoft doesn't support it anymore, which is completely illogical because Ansible keeps showing ModuleNotFoundError errors every time I execute the playbook, and I have to install them all manually...
Any more efficient way to do this?
I believe you're looking to install Ansible Azure module. So please try the following,
If you already have python and pip installed, use the command pip install ansible[azure], to install Azure modules.
Otherwise Try the following, and see if that helps,
On Windows,
Install Python
Install PIP
Add python and pip installation path to Windows PATH variable
Install Ansible Azure Module: pip install ansible[azure]
On CentOS 7.4,
Install python and pip:
sudo yum check-update; sudo yum install -y gcc libffi-devel python-devel openssl-devel epel-release
sudo yum install -y python-pip python-wheel
Install Ansible Azure Module:
sudo pip install ansible[azure]
On Ubuntu 16.04 LTS,
Install python and pip:
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev python-pip
Install Ansible Azure Module:
sudo pip install ansible[azure]

How to make an autoinstall command script for Debian

So I was working on a project that need some libraries . so I decided to made an .sh script to just install all at once but I don't know why it fails . I was searching about it , but just found how to create installer like .deb , etc
here are the commands lines that I use
install.sh
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip python3-dev
sudo apt-get install build-essential cmake git unzip pkg-config libopenblas-dev liblapack-dev
sudo apt-get install python-numpy python-scipy python-matplotlib python aml
sudo apt-get install libhdf5-serial-dev python-h5py
sudo apt-get install graphviz
sudo apt-get install python-opencv
sudo apt install python-sklearn
sudo apt install python3-sklearn
pip3 install matplotlib
pip3 install pydot-ng
pip3 install tensorflow
pip3 install keras
pip3 install scikit-learn
using
bash install.sh
and I got this , I think that I'm doing just a few things wrong , I think
E: The update command takes no arguments
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package
Reading package lists... Done
Building dependency tree
Reading state information... Done
............
Can someone help me please
Your shebang at the beginning of your script is for a boot script
You're using:
#!/bin/sh
When this script should call the bash environment with:
#!/bin/bash
That should solve your problem.
As sergio states these can be done in one liners like:
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y python3-pip python3-dev build-essential cmake git unzip pkg-config libopenblas-dev liblapack-dev python-numpy python-scipy python-matplotlib python aml libhdf5-serial-dev python-h5py graphviz python-opencv python-sklearn python3-sklearn
sudo pip3 install matplotlib pydot-ng tensorflow keras scikit-learn
At the very least utilize an array for more efficient bash programming like this:
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
aptDepends=(
python3-pip
python3-dev
build-essential
cmake
git
unzip
pkg-config
libopenblas-dev
liblapack-dev
python-numpy
python-scipy
python-matplotlib
python
aml
libhdf5-serial-dev
python-h5py
graphviz
python-opencv
python-sklearn
python3-sklearn
)
pipDepends=(
matplotlib
pydot-ng
tensorflow
keras
scikit-learn
)
sudo apt-get install -y "${aptDepends[#]}" && sudo pip3 install -y "${pipDepends[#]}"

Unable to import pymysql on python3, throws import error

Unable to import pymysl in python-3.6, on venv on a debian machine tried all possible options.Not getting any error while installing.
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python-dev default-libmysqlclient-dev
sudo apt-get install python3-dev
sudo pip3 install mysqlclient
sudo apt-get install python3-pymysql
sudo apt-get install python3.6-dev libmysqlclient-dev
sudo pip3 install pymysql
sudo pip3 install mysql-connector-python

Setting python3 PYTHONHOME

I installed python3 and pip3 using:
RUN apt install -y build-essential libssl-dev libffi-dev python3-dev
RUN apt install -y python3-pip
For some reason site-packages are showing up like this:
root#5d6f29f1d4e9:/usr/local/lib/python2.7# ls -a
. .. dist-packages site-packages
root#5d6f29f1d4e9:/usr/local/lib/python3.6# ls -a
. .. dist-packages
My only guess is that I should set PYTHONHOME to point to 3.x instead of 2.x? e.g.:
ENV PYTHONHOME /usr/local/lib/python3.6
(note I am root user in a docker container so just need one python version and I won't need virtualenv / venv).
Nah I don't think this was it. I did this:
RUN apt install -y build-essential libssl-dev libffi-dev python3-dev
RUN apt install -y python3-pip
ENV PYTHONHOME /usr/local/lib/python3.6
RUN pip3 install awscli
and it then failed with some unnecessary error when installing awscli, so setting this env var doesn't seem like the right thing to do.

How to install PYODBC in Databricks

I have to install pyodbc module in Databricks.
I have tried using this command (pip install pyodbc) but it is failed due to below error.
Error message
I was having the same issue for installation. This is what I tried and it worked.
Databricks does not have default ODBC Driver. Run following commands in a single cell to install MS SQL ODBC driver
%sh
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql17
Run this in notebook
dbutils.fs.put("/databricks/init/<YourClusterName>/pyodbc-install.sh","""
#!/bin/bash
sudo apt-get update
sudo apt-get -q -y install unixodbc unixodbc-dev
sudo apt-get -q -y install python3-dev
/databricks/python/bin/pip install pyodbc
""", True)
Restart the cluster
Import pyodbc in Code
I had some problems a while back with connecting using pyobdc, details of my fix are here: https://datathirst.net/blog/2018/10/12/executing-sql-server-stored-procedures-on-databricks-pyspark
I think the problem stems from PYTHONPATH on the databricks clusters being set to the Python 2 install.
I suspect the lines:
%sh
apt-get -y install unixodbc-dev
/databricks/python/bin/pip install pyodbc
Will work for you.
Update: Even simpler (though you will still need unixodbc-dev from above):
%sh
sudo apt-get install python3-pip -y
pip3 install --upgrade pyodbc
Right-click the Workspace folder where you want to store the library.
Select Create > Library.
Look this https://docs.databricks.com/user-guide/libraries.html for detailed information

Resources