centOS 7 - difficulties with installing Python 3 - python

I have a brand new centOS 7 VM that am trying to install Python 3 (currently 3.6.0) on. I am following a guide from Daniel Eriksson (https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/)
but I'm running into an Pemission denied error when running the make && make altinstall command.
The last section of the error I'm getting is here:
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -fPIC -DPy_BUILD_CORE -o Programs/_testembed.o ./Programs/_testembed.c
gcc -pthread -Wl,-rpath /usr/local/lib -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o -L. -lpython3.6m -lpthread -ldl -lutil -lm
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,#EXENAME#,/usr/local/bin/python3.6m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones; ->
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
cp python-config.py python-config; \
fi
if test "no-framework" = "no-framework" ; then \
/bin/install -c python /usr/local/bin/python3.6m; \
else \
/bin/install -c -s Mac/pythonw /usr/local/bin/python3.6m; \
fi
/bin/install: cannot create regular file ‘/usr/local/bin/python3.6m’: Permission denied
make: *** [altbininstall] Error 1
I don't usually work with Linux, so I'm not exactly sure where to look for or what to try next. Any help on this appreciated. Thank you

The issue is with the permission required when running the command to install the package.
Use
sudo make && sudo make altinstall
instead of:
sudo make && make altinstall

Related

fatal error: 'fst/types.h' file not found

I'm trying to install openfst like so:
wget http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.8.2.tar.gz
tar zxvf openfst-1.8.2.tar.gz
cd openfst-1.8.2
./configure --enable-python
make
sudo make install
but during the Python installation step, I get:
Making install in python
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -fno-exceptions -Wno-deprecated-declarations -DHAVE_CONFIG_H -I./../../include -I/Users/colin/opt/miniconda3/envs/logos/include/python3.8 -fexceptions -g -O2 -MT pywrapfst_la-pywrapfst.lo -MD -MP -MF .deps/pywrapfst_la-pywrapfst.Tpo -c -o pywrapfst_la-pywrapfst.lo `test -f 'pywrapfst.cpp' || echo './'`pywrapfst.cpp
libtool: compile: g++ -std=c++17 -fno-exceptions -Wno-deprecated-declarations -DHAVE_CONFIG_H -I./../../include -I/Users/colin/opt/miniconda3/envs/logos/include/python3.8 -fexceptions -g -O2 -MT pywrapfst_la-pywrapfst.lo -MD -MP -MF .deps/pywrapfst_la-pywrapfst.Tpo -c pywrapfst.cpp -fno-common -DPIC -o .libs/pywrapfst_la-pywrapfst.o
pywrapfst.cpp:643:10: fatal error: 'fst/types.h' file not found
#include <fst/types.h>
^~~~~~~~~~~~~
1 error generated.
I don't really understand why, given that seemingly we just installed the necessary fst components?
Is this an issue with the conda installation or something else?
I'm using Miniconda with conda version 4.13.0
Any pointers would be appreciated!
I think the problem is the openfst itself:
OpenFst no longer produces a fst/types.h
If you just want to use wrapped python or not a C++ dev, you should use anaconda package: OpenFST anaconda as #kotatsuyaki suggest. Or you can install from source with version 1.7.x

Xgboost installation on Mac

I am trying to install xgboost on my mac (10.12.5) and after several attempts I did not succeed. I follow different tuto trying to modifi gcc variable by adding gcc-6 but I have the same problem.
So what I did:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/minimum.mk ./config.mk; make -j4
I have the following error:
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/learner.o src/learner.cc >build/learner.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/logging.o src/logging.cc >build/logging.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/c_api/c_api.o src/c_api/c_api.cc >build/c_api/c_api.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/c_api/c_api_error.o src/c_api/c_api_error.cc >build/c_api/c_api_error.d
/bin/sh: /usr/local/bin/g++: No such file or directory
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/logging.o] Error 127
make: *** [build/c_api/c_api.o] Error 127
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/c_api/c_api_error.o] Error 127
My gcc version is:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I really need your help. For the moment I use pip install xgboost to use the library but I know it's not the right way to use this library.
Thank you for your help
ps: sorry if my english is not ok, i am not fluent
Using Docker images helps the best in such cases since it encapsulates the environment. You can install Docker from here. If you want to work using xgboost library, you can pull image using the following command,
docker pull datmo/xgboost:cpu
After this, you can run containers using this image and mount necessary files in order to run the same environment.
You can also use datmo CLI in order to easily setup environment and also version control your machine learning models.
Try This it worked for
$ brew install gcc-5
$ brew install cmake
$ pip install xgboost
I was able to install xgboost on my mac by using conda.
Try "conda install py-xgboost". This worked for me.

installing cx_freeze on ubuntu

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

I've got a CPython C++ module with C++11 code, but I can't seem to build on travis-ci

This project work fine on my local Ubuntu 12.04 and Mac OSX 10.10 (with fink python) machines. I can't seem to figure out how to configure the .travis.yml to get the .cpp files to build with g++-4.8 (4.9 or 5.x) would be fine too.
Project: https://github.com/schwehr/libais
My most recent failed attempt:
language: python
python:
- "2.7"
- "3.4"
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
install:
- sudo apt-get install -qq gcc-4.8 g++-4.8
- python setup.py install
script:
- python setup.py test
Gives:
gcc -pthread -fno-strict-aliasing -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/python/2.7.9/include/python2.7 -c src/libais/ais_py.cpp -o build/temp.linux-x86_64-2.7/src/libais/ais_py.o -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: error: unrecognized command line option ‘-std=c++11’
The key portion of my setup.py:
EXTRA_COMPILE_ARGS = []
if sys.platform in ('darwin', 'linux', 'linux2'):
EXTRA_COMPILE_ARGS = ['-std=c++11']
AIS_MODULE = Extension(
'_ais',
extra_compile_args=EXTRA_COMPILE_ARGS,
Thanks Dominic. I tried printing things and that was helpful. That got me thinking that I could just get explicit and force python to use the correct compiler. That makes it easier to see what is happening.
install:
- sudo apt-get install -qq gcc-4.8 g++-4.8
- CC=g++-4.8 python setup.py install
Which works.

Python 2.7.6 error when building from source: gcc.orig: directory": No such file or directory

I've been provisioned a very bare-bones RHEL 4.4 at work; e.g., it didn't have java or gcc installed.
I have followed this guide to install python 2.7.6 on another VM (RHEM 4.6) successfully. However on this new vm, I cannot make without getting this error:
gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE \
-DSVNVERSION="\"`LC_ALL=C echo Unversioned directory`\"" \
-DHGVERSION="\"`LC_ALL=C `\"" \
-DHGTAG="\"`LC_ALL=C `\"" \
-DHGBRANCH="\"`LC_ALL=C `\"" \
-o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
gcc.orig: directory": No such file or directory
<command-line>: warning: missing terminating " character
./Modules/getbuildinfo.c: In function â_Py_svnversionâ:
./Modules/getbuildinfo.c:63: error: missing terminating " character
./Modules/getbuildinfo.c:63: error: expected expression before â;â token
make: *** [Modules/getbuildinfo.o] Error 1
I tried what was suggested in this unrelated bug report:
SVNVERSION="Unversioned directory"
./configure
make
but received the same error.
I saw this question on super user, which suggests to check the output of the svnversion command in the Modules directory, but I don't have svn or svnversion on this machine. It also suggests to edit the function _PY_svnversion in Modules/getbuildinfo.c, which I did but received the same error.
Any ideas?
Ok I found the answer in my case:
issue configure which will create a new Makefile
edit the Makefile with vi.
search for SVNVERSION and set it to
SVNVERSION= ""
make will then work.

Categories

Resources