installing cx_freeze on ubuntu - python

i have kubuntu 15.10 with python2.7 and python 3.4m installed
if i install cxfreeze with sudo apt-get cx_freeze it is installed with no issues but the problem is when i compile my python modules the are compiled for python2.7 not python 3
So i am trying to build cx_freeze from source and i am facing this error when i run sudo python3 setup.py build
here's the error
adding base module named weakref
running build
running build_py
running build_ext
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict
prototypes -g -fstack-protector-strong -Wformat -Werror=format
security -D_FORTIFY_SOURCE=2 -fPIC -Ibuild/temp.linux-x86_64-3.4
I/usr/include/python3.4m -c source/bases/Console.c -o
build/temp.linux-x86_64-3.4/source/bases/Console.o
x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64
3.4/source/bases/Console.o -L/usr/lib/python3.4/config-3.4m-x86_64
linux-gnu -lpython3.4 -o build/lib.linux-x86_64
3.4/cx_Freeze/bases/Console -Xlinker -export-dynamic -Wl,-O1 -Wl,
Bsymbolic-functions -lpthread -ldl -lutil -lm -lrt -lexpat -L/usr/lib
-lz -lexpat -s
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1'

Install zlib1g-dev :
sudo apt install zlib1g-dev
then install cx_freeze for python:
pip install cx_freeze
I've tried that on Ubuntu 18.04 and Python 3.6 and worked.

I had exactly the same problem. As suggested in this answer you just need to install the dependencies first:
pip3 install zlib1g-dev
Then sudo python3 setup.py build

Related

Running QuantLib python on 'apple silicon' Macbook

I am trying to run Quantlib-Python on a Macbook with M1 processor (Big Sur v11.3) following https://www.quantlib.org/install/macosx-python.shtml. I have managed to install Quantlib 1.22 and Python 3.9.4 via homebrew:
Pouring quantlib--1.22.arm64_big_sur.bottle.tar.gz into "/opt/homebrew/Cellar/quantlib/1.22"
However when I then try to install Quantlib-Python through pip I get:
ERROR: Could not find a version that satisfies the requirement QuantLib (from versions: none)
ERROR: No matching distribution found for QuantLib
From this it seems that whilst Quantlib 1.22 is ready for arm-based OSX, QuantLib-Python isn't.
Then I am trying to install from a released version as per the above link:
tar xzf QuantLib-SWIG-1.22.tar.gz
cd QuantLib-SWIG-1.22/Python
export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9'
export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9'
python setup.py build
But I get the following error:
cd QuantLib-SWIG-1.22/Python
export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9'
export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9'
python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -DNDEBUG -I/Users/USER/coding/project1/include -I/Users/USER/.pyenv/versions/3.9.4/include/python3.9 -I/opt/homebrew/Cellar/quantlib/1.22/include -c QuantLib/quantlib_wrap.cpp -o build/temp.macosx-11.3-arm64-3.9/QuantLib/quantlib_wrap.o -Wno-unused -O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9
In file included from QuantLib/quantlib_wrap.cpp:4730:
In file included from /opt/homebrew/Cellar/quantlib/1.22/include/ql/version.hpp:28:
/opt/homebrew/Cellar/quantlib/1.22/include/ql/qldefines.hpp:38:10: fatal error: 'boost/config.hpp' file not found
#include <boost/config.hpp>
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
I have tried quite a few workarounds for the boost issue, and looked over lots of other question/answers but yet to find a fix. Is it an issue with the flags? Has anyone had any luck getting QuantLib-Python to work on M1-based OSX?
Below worked for me on a MBP M1 Max:
brew install boost
brew install quantlib
download QuantLib-SWIG-1.24.tar
tar xzfv QuantLib-SWIG-1.24.tar
cd QuantLib-SWIG-1.24/Python
export CXXFLAGS='-O2 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -I/opt/homebrew/Cellar/boost/1.76.0/include'
export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9 -L/opt/homebrew/Cellar/boost/1.76.0/lib'
python setup.py build
python setup.py bdist_wheel
cd dist
pip install QuantLib-1.24-cp310-cp310-macosx_11_0_arm64.whl

trouble install mysqlclient on ubuntu18.04

I am trying to install mysqlclient on ubuntu 18.04 for a Django project but having problem installing mysql. Here is the information from the terminal:
pip install mysqlclient
Collecting mysqlclient
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -
Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/opt/lampp/include/mysql -I/opt/lampp/include/mysql/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:29:10: fatal error: mysql.h: No such file or directory`enter code here`
#include "mysql.h"
^~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
You'll have to install the MySQL headers.
sudo apt install libmysqlclient-dev
(and stop using Python 2.7, it's out of support in a month)

/usr/bin/ld: cannot find -lffi while installing cffi 1.11.5 package

enter code hereI'm trying to install paramiko module in my linux server. The pip is blocked on the server, So i am manually copying the package zips and installing them from setup.py
when i try installing paramiko i get
error: Could not find suitable distribution for Requirement.parse('pynacl>=1.0.1')
so i download the PyNaCl package, but i get
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.1.0')
pynacl needs cffi 1.1.0 above:
so while installing cffi1.11.5 i get the below error:
[root#homecffi-1.11.5]# python3.5 setup.py install
running install
---
---
installing library code to build/bdist.linux-x86_64/egg
--
--
building '_cffi_backend' extension
gcc -pthread -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.1/include -I/usr/local/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.5/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_callback’:
c/_cffi_backend.c:5911: warning: ‘ffi_prep_closure’ is deprecated (declared at /usr/local/include/ffi.h:341)
gcc -pthread -shared build/temp.linux-x86_64-3.5/c/_cffi_backend.o -L$(libdir)/../lib64 -lffi -o build/lib.linux-x86_64-3.5/_cffi_backend.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Can anyone help me with this?
If this is a Debian or Ubuntu machine,
sudo apt install libffi-dev
and then try again.
For other distributions, the installation method and package name may be different.

No OCR tool found in python

I have downloaded Mayan EDMS-Electronic Document Management System from GitHub and I configured project using Django server. I had added the required libraries based on requirement. Now the project runs with error
ocr.exceptions.OCRError: No OCR tool found
When I searched this error, I found Pyocr looks for the OCR tools (Tesseract, Cuneiform, etc) installed on your system and just tells you what it has found.
Then I tried to install tesseract using the command -->pip install tesseract-ocr.
I got this error
Requirement already satisfied: cython in ./venv2/lib/python2.7/site-packages (from tesseract-ocr) (0.28.4)
running bdist_wheel
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-l1RrwO/python2.7-2.7.14=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c tesseract_ocr.cpp -o build/temp.linux-x86_64-2.7/tesseract_ocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
tesseract_ocr.cpp:600:10: fatal error: leptonica/allheaders.h: No such file or directory
#include "leptonica/allheaders.h"
please help me to solve this issue. Thanks in advance.
Tesseract is installed on the OS using the apt-get command. The command you are using (PIP) is for installing Python packages, that is the reason for the error.
For reference: http://docs.mayan-edms.com/en/stable/topics/deploying.html#deploying
If using a Debian or Ubuntu based Linux distribution, get the executable requirements using:
sudo apt-get install g++ gcc ghostscript gnupg1 graphviz libjpeg-dev libmagic1 \
libpq-dev libpng-dev libreoffice libtiff-dev poppler-utils postgresql \
python-dev python-pip python-virtualenv redis-server sane-utils supervisor \
tesseract-ocr zlib1g-dev -y

Installing SciPy version 0.11 in Ubuntu with apt-get [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Installing SciPy with pip
I want to install a new version of SciPy which is 0.11.0 and the current version which I have is 0.9.0.
It is installed by this command:
sudo apt-get install python-scipy
I have tried installing 0.11.0 from sources, but I could not.
Is there already an apt-get for 0.11.0?
EDIT 1
Following is the error when I build from source or do an easy install.
Setup script exited with error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared
build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
/usr/lib/pymodules/python2.7/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent
module 'numpy.distutils' not found while handling absolute import
from numpy.distutils import log
EDIT 2
That issue has been resolved, and the error is now the following.
gcc: build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.c
/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-2.7/build/src.linux-
x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lg2c -o
build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-
x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
EDIT 3
I have asked this question [here], but the issue is not solved yet.
Any thoughts?
If you have all the basic prerequisites installed as described in the INSTALL.txt file, it should be fairly straightforward by doing a:
sudo python setupy.py install
from within the directory where you extracted the scipy0.11.0 tarball. This should make the library inside your current default Python version.
You can check whether you have the prerequisites by just running:
sudo apt-get install python python-dev libatlas3-base-dev gcc gfortran g++
as explained again in the INSTALL.TXT.

Categories

Resources