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
Related
I'm trying to build a Docker container with the following commands in Dockerfile:
FROM python:3.6.2
RUN apt-get update && apt-get install make
RUN pip install -U pip setuptools wheel
RUN python -m pip install -r model-requirements.txt --python-version 3.6 --no-deps --target python6_pakages
# Installing docker-ce
RUN apt-get update
RUN apt install apt-transport-https ca-certificates curl software-properties-common -y --force-yes
RUN apt-get install -y gnupg --force-yes
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
RUN curl -O https://download.docker.com/linux/debian/dists/buster/pool/stable/amd64/containerd.io_1.6.9-1_amd64.deb
RUN apt install ./containerd.io_1.6.9-1_amd64.deb
RUN apt-cache policy docker-ce
RUN apt-cache search docker-ce
RUN apt install docker-ce -y
RUN apt-get install -y cron vim iputils-ping curl g++ unixodbc-dev gnupg supervisor
The problem us that when building process reaches the line RUN apt install ./containerd.io_1.6.9-1_amd64.deb I get errors like the following:
I have no idea why this is happening. I've double-checked the download URL and the package is successfully downloaded every time. Can you help me with this error?
I got 2 errors while trying to install pip3 install face_recognition command failed building wheel for dlib and failed building wheel for face-recognition models on linux
Failed building wheel for face-recognition-models
Failed building wheel for dlib
Then it said it was successful face-recognotion-1 instead of without the 1 and scripts using module face_recognition still fails! How do I purge all opencv and face_recog and start again from scratch?
import face_recognition
The strangest error I'm not even trying to run that file as you can see but its referring to it like it depends onit
./test.py
Traceback (most recent call last):
File "./test.py", line 3, in <module>
import face_recognition
File "/home/jay/Documents/Scripts/PYTHON/Face_Recognition/Newest_2021/face_recognition_examples/face_recognition.py", line 14, in <module>
face_recognizer = cv2.face.LBPHFaceRecognizer_create()
NameError: name 'cv2' is not defined
I need to purge it all and start again without reinstalling the os how do U guarantee a fix for this issue please?
I'm on linux mint using python3
Any ideas?
I want to purge everything to do with opencv cmake pip face_recognition completely so it all can be done from the start without wiping the whole os.
Solved it with
#!/bin/bash
# (c)J~Net 2021
# jnet.sytes.net
#
# Use sudo or give exec perms! sudo chmod +x *.sh
# sudo -H ./reinstall.sh
# USE # YOUR OWN RISK! I ACCEPT NO LIABILITY FOR ANY DAMAGE CAUSED TO YOUR OS!
#
echo "Uninstalling Face Recog & Dlib"
echo ""
sudo pip3 uninstall face_recognition -y
sudo pip3 uninstall dlib -y
sudo pip2 uninstall face_recognition -y
sudo pip2 uninstall dlib -y
sudo pip uninstall face_recognition -y
sudo pip uninstall dlib -y
sudo apt-get --purge autoremove face_recognition
sudo apt-get --purge autoremove opencv
sudo apt-get --purge autoremove cmake
sudo apt-get --purge autoremove dlib
sudo apt-get --purge autoremove python-opencv
#
echo "Now Reinstalling For Python3 for use with OpenCV By J~Net 2021"
echo "Please, wait, this will take some time do not use computer for anything while its working!"
echo ""
sudo apt install -y cmake
#
git clone https://github.com/davisking/dlib.git
#
cd dlib
mkdir build; cd build; cmake ..; cmake --build .
#
cd ..
python3 setup.py install
pip3 install face_recognition
#
sudo apt install -y build-essential cmake pkg-config
sudo apt install -y libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt install -y libxvidcore-dev libx264-dev
sudo apt install -y libgtk-3-dev
sudo apt install -y libatlas-base-dev gfortran
sudo apt install -y python2.7-dev python3.5-dev
sudo apt install -y libx11-dev
sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
#
mkdir opencv
cd opencv
wget https://github.com/Itseez/opencv/archive/3.2.0.zip -O opencv-3.2.0.zip
unzip opencv-3.2.0.zip
cd opencv-3.2.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j $(nproc)
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo ""
echo "Setup Complete!"
echo ""
echo ""
echo "Reinstall Complete!"
echo ""
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[#]}"
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
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.