I installed boost using apt-get. Programs see it fine when doing a bootstrap:
idf#ubvm:$ dpkg -s libboost-dev | grep Version
Version: 1.65.1.0ubuntu1
All of them are found:
idf#ubvm:$ whereis python
python: /usr/bin/python3.6m /usr/bin/python /usr/bin/python3.6m-config /usr/bin/python3.6-config /usr/bin/python2.7-config /usr/bin/python3.5 /usr/bin/python3.6 /usr/bin/python3.5m /usr/bin/python2.7 /usr/lib/python3.5 /usr/lib/python3.6 /usr/lib/python3.7 /usr/lib/python2.7 /etc/python /etc/python3.5 /etc/python3.6 /etc/python2.7 /usr/local/lib/python3.5 /usr/local/lib/python3.6 /usr/local/lib/python2.7 /usr/include/python3.6m /usr/include/python3.6 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz
When linking a program, I get this error:
/usr/bin/ld: cannot find -lboost_python-py35
/usr/bin/ld: cannot find -lpython3.5m
So I am trying to build boost 1.69 from source, to support python 3.5.
ls /usr/bin/python*
/usr/bin/python /usr/bin/python2-config /usr/bin/python3.6 /usr/bin/python3-config
/usr/bin/python2 /usr/bin/python3 /usr/bin/python3.6-config /usr/bin/python3m
/usr/bin/python2.7 /usr/bin/python3.5 /usr/bin/python3.6m /usr/bin/python3m-config
/usr/bin/python2.7-config /usr/bin/python3.5m /usr/bin/python3.6m-config /usr/bin/python-config
When I run bootstrap, it is detecting python 2.7
idf#ubvm:~/Downloads/boost_1_69_0$ ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... /usr
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
I then did a locate after installing ./b2 install:
idf#ubvm:$ locate libboost_python
/usr/lib/x86_64-linux-gnu/libboost_python-py27.a
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1
/usr/lib/x86_64-linux-gnu/libboost_python-py36.a
/usr/lib/x86_64-linux-gnu/libboost_python-py36.so
/usr/lib/x86_64-linux-gnu/libboost_python.a
/usr/lib/x86_64-linux-gnu/libboost_python.so
/usr/lib/x86_64-linux-gnu/libboost_python3-py36.a
/usr/lib/x86_64-linux-gnu/libboost_python3-py36.so
/usr/lib/x86_64-linux-gnu/libboost_python3-py36.so.1.65.1
/usr/lib/x86_64-linux-gnu/libboost_python3.a
/usr/lib/x86_64-linux-gnu/libboost_python3.so
How do I tell the system to also build the python 3.5(m) libraries as well as the 2.7?
Related
Does anyone have a way to install python 3.7 in latest stable Cygwin 32 or 64 bit that works out of the box without hacking? I've noticed that 3.6 works fine but 3.7 libraries don't behave and are missing key functionality.
I have usecases to have Cygwin for various scripts but want to use 3.7 for its improvements with type annotations. The new Linux runtime is not available on my servers so Cygwin is the only decent posix environment I can run in my windows servers.
[Update - 2022-03-30] I recently have successfully gotten Python 3.9 working on Cygwin. It does create proper python3 and pip3 executables out of the box. Only issues need to install cryptography==3.3.2 and pyopenssl<=21.0.0 due to rust dependency.
Although Timothy's answer is correct, the cleaner way to do this is to ensure Cygwins 'alternative' package is installed and run the following commands in order to have your Python versions switchable through the alternative system. This will also switch to the correct pip versions.
/usr/sbin/update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 0 --slave /usr/bin/pip3 pip3 /usr/bin/pip3.6
/usr/sbin/update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 10 --slave /usr/bin/pip3 pip3 /usr/bin/pip3.7
/usr/sbin/update-alternatives --install /usr/bin/python python /usr/bin/python3 10 --slave /usr/bin/pip pip /usr/bin/pip3
/usr/sbin/update-alternatives --set python3 /usr/bin/python3.7
/usr/sbin/update-alternatives --set python /usr/bin/python3
In case you still need deprecated Python 2.x versions you can add these accordingly as an alternative for 'python' via a 'python2' group.
The python37 packages will install correctly but will create an executable called python3.7 instead of python3 which can be confusing. I would guess that the Cygwin dev's wanted to allow two versions of python3 to be installed at the same time.
However, as its not recommended to have two versions of python3 installed at the same time, you can simply create the executable python3 as follows to correct this:
ln -s /usr/bin/python3.7 /usr/bin/python3
The same goes for python37-pip:
ln -s /usr/bin/pip3.7 /usr/bin/pip3
These instructions above will likely apply to other non-standard version of python on Cygwin although I have only tested Python37.
For those who need to install pyopenssl package, you will need the following cygwin packages: gcc-g++, libffi-devel, libssl-devel, python37-devel
For pandas, you will need python37-numpy package and be sure to upgrade it in pip before installing pandas as there is a known bug in numpy package version in cygwin:
pip3 install --upgrade numpy
pip3 install pandas
python3 defaults to python 3.6 but python 3.7 is available in packages. Once installed you can run using:
$ python3.7 -V
Python 3.7.3
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.
My OS (Arch Linux) recently updated Python from 3.5.2 to 3.6.0, now when running any terminal I get this message:
/usr/bin/python: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
Moreover I get these outputs
$ whereis python
python: /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3.6-config /usr/bin/python3.6m-config /usr/bin/python2.7-config /usr/bin/python /usr/bin/python2.7 /usr/lib/python3.6 /usr/lib/python3.5 /usr/lib/python2.7 /usr/include/python3.6m /usr/include/python2.7 /usr/share/man/man1/python.1.gz
$ which python
/usr/bin/python
$ python --version
Python 3.6.0
How can I fix this situation? Will this situation will have any impact on my created virtual envs or other programs?
Thanks in advance.
This article was very useful to solve the situation, only you need is to run:
$ sudo pip3.6 install -U pip
$ sudo pip3.6 install -U virtualenvwrapper
I want to execute python from php and I do have a script that works fine for default python interpreter. I have centos with default python 2.6.6 which is installed at /usr/bin/python and python 2.7.3 which is installed at /usr/local/bin/python2.7. You can see what is the default python version:
[root#me ~]# python -V
Python 2.6.6
[root#me ~]# python2.7 -V
Python 2.7.3
How do I make python 2.7.3 default python on my OS. So when i run python -V i should get 2.7.3?
I know it is bad. The alternative is to uninstall python 2.7.3 and I do not know how to do this.
Execute the below commands to make yum work as well as python2.7
echo "export PATH="/usr/local/bin:$PATH"" >> /etc/profile
source /etc/profile
mv /usr/bin/python /usr/bin/python.bak
update-alternatives --install /usr/bin/python python /usr/bin/python2.6 1
update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 2
update-alternatives --config python
sed -i "s/python/python2.6/g" /usr/bin/yum
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