Python 3 cx-Freeze install - python-3.x

I tried to install cx_freeze, but when I run sudo python3 setup.py build I get an error:
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I know that I can install it using synaptic but that installed cx_Freeze into Python 2.6 but I need cx_Freeze for Python 3. I use Ubuntu 10.04

Sounds like libffi isn't installed. Try:
sudo apt-get install libffi-dev

Related

ModuleNotFoundError: No module named 'uaclient.entitlements' dpkg: error processing package ubuntu-advantage-tools (--configure):

Whenever i try sudo apt-get upgrade or try to install any other package i get the above error. Is there any way to solve it?? Using ubuntu 16.04
Removing python3-distro-info (0.14ubuntu0.2) ...
Setting up ubuntu-advantage-tools (27.0~16.04.1) ...
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
You should install opcua and opcua-client with default python command:
python -m pip install --upgrade opcua
python -m pip install --upgrade opcua-client
I have the same problem and try to solve then it work for me.
My environment:
OS: ubuntu 18.04 LTS
python version: 3.6.9(system default) , manual
install 3.8.7
System python path have been link to python 3.8 when I install python 3.8, so any process use python will call python 3.8 and use pip3.8 site-packages, not use system dist-packages(python 3.6). But python 3.8 uaclinet(install by pip) is different from uaclinet in dist-packages(ubuntu-advantage-tools provide). then I use apt upgrade
設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 1
處理時發生錯誤:
ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
So, I copy the uaclinet(in dist-packages) to python 3.8 site-packages and run upgrade again, then it works( maybe has compatibility problems )
設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
Affected packages: ubuntu-advantage-tools:amd64
I think if your use system python , you can use comment by Jan Wilamowski,
This problem appeared for me after upgrading to Ubuntu 18.04 from 16.04.
I updated opcua and opcua-client as suggested with python -m pip install, and also with pip3 install, to get it updated in python3 packages, and the problem remained.
I have system python3 installed in /usr/bin/python3 (version 3.6), and another version in /usr/local/bin/python3 (version 3.8) which is the default python3. I'm not sure why, but the uaclient.entitlements module can be loaded properly with /usr/bin/python3, but not with /usr/local/bin/python3
Instead of changing the location of the uaclient package, the following worked for me:
I used update-alternatives to choose which python3 will be used by default, either system python3 which is /usr/bin/python3.6, or the updated python3 which is installed in /usr/local/bin/python3.8 as described here:
https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/local/bin/python3 python3 /usr/local/bin/python3.8 2
Then, choose /usr/bin/python3.6 as the default by running:
sudo update-alternatives --config python3
A symlink is created as /etc/alternatives/python3 that points to the chosen default python3.
Since the way I set the alternatives results in /usr/local/bin/python3.8 as the automatic default python3, the symlink /usr/bin/python3 -> python3.6 is removed. But this symlink is still needed for dependencies/functions that use system python through /usr/bin/python3, so I added back the sym link:
sudo ln -s python3.6 /usr/bin/python3
By setting /usr/bin/python3.6 as the default instead of /usr/local/bin/python3.8, then uaclient.entitlements can be loaded properly. This worked for me to install and upgrade packages where this uaclient.entitlements ModuleNotFoundError was occurring. Just have to switch back to using /usr/local/bin/python3.8 when finished installing. But I think now that ubuntu-advantage-tools is configured by getting through this error, there doesn't seem to be a need to switch to /usr/bin/python3.6 as the default anymore for installing packages.
The answer in https://askubuntu.com/questions/1336425/no-module-named-uaclient-during-sudo-apt-upgrade-ubuntu-16-04 worked for me. Basically, I modified manually the post-installation and pre-remove script in /var/lib/dpkg/info/ubuntu-advantage-tools.postinst and /var/lib/dpkg/info/ubuntu-advantage-tools.prerm and replace python3 with the complete path /usr/bin/python3.5, and then the 'apt-get upgrade' didn't fail as before.
If you are not going to use ubuntu advantage tools then
sudo dpkg --remove --force-remove-reinstreq ubuntu-advantage-tools
but even tat failed for me... I had to
sudo rm /var/lib/dpkg/info/ubuntu-advantage-tools.prerm
because this script was blocking uninstall
i have tried to install:
python -m pip install --upgrade opcua
python -m pip install --upgrade opcua-client
but even that was failing for me on a second - client installation
finally after about 6 months I can do ubuntu update without error reporting.

Libev related error when installing gevent

I am trying to install the Python package gevent with pip3 install gevent; the OS is Amazon Linux 2. The installation starts, but then at some point it stops with this error:
subprocess.CalledProcessError: Command '(cd "/tmp/pip-build-mqpe4eb2/gevent/deps/libev" && sh ./configure -C > configure-output.txt )' returned non-zero exit status 1
Some months ago it used to work, which is why my first thought was the error might be related to a recent version release. However, installing an older version with pip3 install gevent==20.04.0 resulted in the same error.
I have same problem , just upgrade the pip using following command has resolved
pip3 install --upgrade pip
pip3 install --upgrade setuptools

Gcc error, No such file or directory "Python.h" -- installing pyAudio on centOS7

I have python 3.6.8 installed on CentOS7 and I'm trying to install pyaudio with
sudo python3.6 -m pip install pyaudio
This format worked to install a number of other things right beforehand, but if I try to use it here i get the following error
src/_portaudiomodule.c:28:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
pip install pyaudio yeilds the same results
I have read the question and answer here but I still cannot figure it out
Any advice in installation? Thank you in advance!
fatal error: Python.h: No such file or directory
It looks like pyaudio is compiling some C code who require Python.h, to fix your issue check this answer https://stackoverflow.com/a/21530768/9799292
(also, "pip install pyaudio" prints "bash: pip: command not found")
To fix this try to install pip by running this command
sudo yum install python3-pip

Python 3.7 - Issues Installing Scikit-Learn

I am currently encountering below issues when trying to install any version of Scikit Learn (0.19.0 or 0.19.1 or 0.19.2) for Python 3.7 or 2.7 on Linux - RHEL / Centos 7 OS.
Few months back I could successfully install scikit-learn under python 2.7 without issues. When I re-run the installation of scikit-learn package under python 2.7 its failing with the same below error.
I have installed all the required OS and Python package dependencies prior to installing the scikit-learn
I have installed all the prerequisite - OS packages - blas-devel , lapack-devel , atlas-devel.
Python Version - 3.7
/usr/local/bsb-python37 - Custom Location in which I configured and installed Python 3.7
Steps I followed to install Python and Python Packages.
Installed Python with below steps - Followed the same procedure for Python 2.7 and 3.7
Install Python 2.7
bash "build-and-install-python2.7" do
cwd '/tmp/python'
code <<-EOH
tar -xvf Python-2.7.14.tgz --no-same-owner / tar -xvf Python-3.7.0.tgz --no-same-owner
sleep 10
cd Python-2.7.14 / cd Python-3.7.0
./configure --prefix=/usr/local/bsb-python27 (and bsb-python37)
make && make altinstall
EOH
not_if { ::File.exist?('/usr/local/bsb-python27/bin/python2.7') }
end
Package Installation Steps
Install scikitlearn
bash "scikitlearn-install" do
cwd '/tmp/python'
code <<-EOH
tar xzvf scikit-learn-0.19.0.tar.gz or scikit-learn-0.19.1.tar.gz or scikit-learn-0.19.2.tar.gz
sleep 10
cd scikit-learn-0.19.1 or cd scikit-learn-0.19.1 or scikit-learn-0.19.2
/usr/local/bsb-python27/bin/python2.7 setup.py install --prefix=/usr/local/bsb-python27
EOH
not_if " /usr/local/bsb-python27/bin/python2.7 -c 'import sklearn;' "
end
Few months back when I installed scikit-learn under Python 2.7 I didn't run into any issues. Now when I re-try to install the scikit learn under Python 2.7 I am running into the same issue and the earlier successful installed version of scikit learn is corrupted.
Error Message :
/usr/local/bsb-python37/bin/python3.7 setup.py install --prefix=/usr/local/bsb-python37
Partial import of sklearn during the build process.
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/usr/local/bsb-python37/lib', '/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
blis_info:
customize UnixCCompiler
libraries blis not found in ['/usr/local/bsb-python37/lib', '/usr/local/lib64', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
error: Command "g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/bsb-python37/lib/python3.7/site-packages/numpy-1.14.5-py3.7-linux-x86_64.egg/numpy/core/include -I/usr/local/bsb-python37/lib/python3.7/site-packages/numpy-1.14.5-py3.7-linux-x86_64.egg/numpy/core/include -I/usr/local/bsb-python37/include/python3.7m -c sklearn/cluster/_dbscan_inner.cpp -o build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o -MMD -MF build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o.d" failed with exit status 1
Any help is greatly appreciated. I tried to google around and did all that I could try. No luck.
I have just used pip install sklearn as an alternative. It worked for me.

Error installing pscopg2

I have OS X Sierra and I'm trying to install psycopg2 version 2.6.2 within a virtual environment using virtualenv and Python 3.4. On the step "Running setup.py install for psycopg2" I get this error message:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
I found that installing psycopg2 version 2.7.3.1 fixed the problem. So this bug must have been fixed in version 2.7 and above:
http://initd.org/psycopg/docs/news.html

Resources