I have compiled and run without an issue python3 on a rpi 3. Now It fails after the compilation to use pip on an rpi 4
These are the steps of the compilation
version=3.9.5
mkdir ~/temp
wget -O ~/temp/Python-$version.tar.xz https://www.python.org/ftp/python/$version/Python-$version.tar.xz
cd ~/temp
tar xf Python-$version.tar.xz
cd Python-$version
./configure --enable-optimizations --with-openssl=/usr/lib/ssl
make -j -l 4
sudo make altinstall
and whereis ssl.h shows
ssl: /usr/lib/ssl /etc/ssl /usr/share/man/man7/ssl.7ssl.gz
but still configure complains
checking for openssl/ssl.h in /usr/lib/ssl... no
checking whether compiling and linking against OpenSSL works... no
checking for --with-ssl-default-suites... python
checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2
I can confirm later pip complains about ssl.
Any idea why python compilation should not include properly ssl ?
if some one comes across this
./configure --enable-optimizations --enable-shared
make -j -l 4
sudo make altinstall
sudo ldconfig
did work for me. However still not sure if that is a valid solution
Related
I am working on a shared server without root access. I have spent hours to get openssl and libffi working with python on the server. I figured it out once, but then it broke because I moved the directories, so I decided to start it over. Here is the documentation I wrote for myself to set this up:
// Pthon3.8.2 setup on bluehost -currently libffi is still broken
mkdir install-workspaces
cd install-workspaces
mkdir openssl
cd openssl
wget https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1.tar.gz
tar xvf openssl-1.1.1.tar.gz
cd openssl-1.1.1
//in order to run wsgi we might need to say "shared" instead of "no-shared"
./config --prefix=/home/user/local/lib/openssl --openssldir=/home/user/local/lib/openssl no-shared zlib-dynamic
make
make test
make install
cd ../../
mkdir libffi
cd libffi
wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz
tar xzf libffi-3.2.1.tar.gz
cd libffi-3.2.1
//I dont know if --disable-docs does anything, but I used the command and the install worked
./configure --prefix=/home/user/local/lib/libffi/ --disable-docs
make
make install
cd ../../
mkdir python
cd python
wget http://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
tar -xvf Python-3.8.2.tar.xz
cd Python-3.8.2
vim Modules/Setup
//press [i]
/* //remove the comments on the lines below and change the SSL= to be your openssl directory
SSL=/home/user/local/lib/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
*/
//press [esc] type ":wq" and press enter
export LD_LIBRARY_PATH=/home/user/local/lib/openssl/lib
PKG_CONFIG_PATH=/home/user/local/lib/libffi/lib/pkgconfig
./configure --with-openssl=/home/user/local/lib/openssl --prefix="/home/user/local/lib/python" --enable-optimizations LDFLAGS='-L/home/user/local/lib/libffi/lib64 -R/home/user/local/lib/libffi/lib64' --enable-shared
make
make altinstall //<- important for _ctypes
Is there any way I can path to libssl.so.1.1 when using ./configure in python?
I'm trying to build Python 3.6.4 from LFS 8.2-systemd so I run the configure command:
./configure --prefix=/usr \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-ensurepip=yes
followed by make -j.
However, at this point the module "pyexpat" is not found by Python, but the file exists in /usr/lib/libexpat.so.
After reading building Python from source with zlib support, I created a symlink:
ln -s /usr/lib /usr/lib/x86_64-gnu-linux
If i run make install, I get an error:
ModuleNotFoundError: No module named pyexpat
My expat lib version is 2.2.5.
I'm doing the compilation inside env -i chroot /mnt bash
and my environment just contains a valid PATH and LX_ALL=POSIX variables.
I ran into this same problem for python 3.6.8 , when I initially configured using:
./configure --prefix=/opt/python-3.6/ --enable-optimizations
However, when I retried using the command in the BLFS book:
./configure --prefix=/opt/python-3.6/ --enable-shared --with-system-expat --with-system-ffi --with-ensurepip=yes
My pyexpat started working.
That being said, I think it may be helpful to just retry, since my second command is functionally identical to yours.
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
To make python3 use the new installed python 3.6 instead of the default 3.5 release, run following 2 commands:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
Finally switch between the two python versions for python3 via command:
sudo update-alternatives --config python3
After selecting version 3.6:
python3 -V
I run below commands after unzipping that python 3.6 tar.xz file.
./configure
make
make install
Error log:
ranlib libpython3.6m.a
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lrt -lm
if test "no-framework" = "no-framework" ; then \
/usr/bin/install -c python /usr/local/bin/python3.6m; \
else \
/usr/bin/install -c -s Mac/pythonw /usr/local/bin/python3.6m; \
fi
/usr/bin/install: cannot create regular file `/usr/local/bin/python3.6m': Read-only file system
make: *** [altbininstall] Error 1
When i run ./configure followed by make , and then make install i run into this error!
Have you tried running the above commands using sudo powers?
original answer: https://askubuntu.com/q/865554/667903
sudo make install
or
If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run
sudo apt-get update
sudo apt-get install python3.6
Your filesystem seems to be read-only. You have to remount the partition where /usr/local/bin/ is located with write permissions
The syntax for mount is
mount -o remount,rw /partition/identifier /mount/point
Let's say you have / on /dev/sda2
mount -o remount,rw / /dev/sda2
should fix your problem.
To check your mount points:
cat /etc/fstab or df
To check the permissions:
cat /proc/mounts
Try after installing build essentials whic contains compilers,package dev tools and libs:
sudo apt-get install build-essential
I'm trying to install the new Python (3.6, released just a few weeks back) from source on openSUSE 42.2. Everything
./configure --prefix /home/paul/2017 --enable-optimizations
make
make install
appears to work just fine, but when I call the shiny new interpreter I get this error:
Python 3.6.0 (default, Jan 9 2017, 22:01:27)
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/home/paul/.pythonrc", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
Now, the module is there, it is installed under $PREFIX/lib64/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so.
Only the interpreter is not looking there (it is completely ignoring lib64, I checked with -vv).
Update: To be clear, this does not only affect readline but everything under lib64, most notably the modules under lib-dynload.
This appears to be a known issue, see the Python bugtracker. It's a fairly lengthy exchange ending in
Is there agreement on what needs doing here? I'd like to see this into 3.5 before it reaches its 10th birthday :)
This leaves me a bit confused. Is this supposed to be resolved?
I do not remember ever running into this issue before, so I wonder if it is a 3.6 regression.
And obviously, any fix would be most welcome.
Update: for the time being I can work around the issue by symlinking everything under lib64 into lib. Obviously, that is not an ideal solution; at the very least it defeats the purpose of introducing lib64 (being able to have 32 and 64 bit versions side-by-side) in the first place.
I'd much prefer something in a config file.
The opensuse openSUSE:Factory python3x has patches for that.
Links:
Python 3.6 Python 3.8 Python 3.9
Spec files are usually a good starting point.
Note: the install step would install a python3 in /usr/local/bin. Changing that to altinstall avoids shadowing the system-wide python3.
Install
Create a downloads variable pointing to a directory where all downloaded files (python source and factory patches) will be saved
export downloads=/usr/local/build/downloads
In a user writable directory:
tar --no-same-owner -xvf $downloads/Python-3.6.4.tar.xz
cd Python-3.6.4
patch -p1 < $downloads/python-3.6.0-multilib-new.patch
patch -p0 < $downloads/python-3.3.0b1-localpath.patch
patch -p0 < $downloads/python-3.3.0b1-curses-panel.patch
# mind this step, otherwise
# none of the modules in `lib-dynload` could be imported !
autoreconf -i
mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 \
--with-fpectl --enable-shared --with-system-ffi \
--with-system-expat --enable-loadable-sqlite-extensions
make -j $(nproc)
# altinstall, not install (see above)
sudo make altinstall
Uninstall
To get rid of the installed files:
sudo rm -rf /usr/local/lib64/python3.6/
sudo rm -f /usr/local/lib64/libpython3.6m*
sudo rm -f /usr/local/lib64/libpython3.so
sudo rm -f /usr/local/lib64/pkgconfig/python-3.6*
sudo rm -f /usr/local/bin/python-3.6*
For python3.7
tar --no-same-owner -xvf $downloads/Python-3.7.3.tar.xz
cd Python-3.7.3
patch -p1 < $downloads/python-3.7.3-python-3.6.0-multilib.patch
patch -p1 < $downloads/python-3.7.3-distutils-reproducible-compile.patch
patch -p0 < $downloads/python-3.7.3-python-3.3.0b1-localpath.patch
patch -p0 < $downloads/python-3.7.3-00251-change-user-install-location.patch
# do not forget !
autoreconf -i
mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 --enable-shared --with-system-ffi --with-system-expat --enable-loadable-sqlite-extensions
make -j $(nproc)
sudo make altinstall
For python 3.8
tar --no-same-owner -xvf $downloads/Python-3.8.1.tar.xz
cd Python-3.8.1/
patch -p1 < $downloads/python-3.8.1-F00102-lib64.patch
patch -p1 < $downloads/python-3.8.1-F00251-change-user-install-location.patch
patch -p1 < $downloads/python-3.8.1-SUSE-FEDORA-multilib.patch
patch -p1 < $downloads/python-3.8.1-distutils-reproducible-compile.patch
patch -p1 < $downloads/python-3.8.1-python-3.3.0b1-localpath.patch
# do not forget !
autoreconf -i
mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 --enable-shared \
--with-system-ffi --with-system-expat \
--enable-loadable-sqlite-extensions
make -j $(nproc)
# altinstall, not install (see above)
sudo make altinstall
Ok, I found a solution: If one configures with the --enable_shared option the problem somehow goes away. Good enough for me.
My server is running CentOS 5.8 and uses PYTHON 2.4
I installed an alternate version of PYTHON 2.7 to use to install node.js
I have followed several different tutorials to get to this point and need a little help to finish
i am in the node directory and used this command for configure
/usr/bin/env python2.7 ./configure
when I ran the make command there was an error.
File "../../tools/js2c.py", line 387
except Error as e:
^
SyntaxError: invalid syntax
make[1]: *** [/root/node/out/Release/obj/gen/libraries.cc] Error 1
make[1]: Leaving directory `/root/node/out'
make: *** [node] Error 2
I believe that's because it's using the 2.4 version of python. How can I force the make and make install command use my alternate install of python 2.7?
I'm a complete beginner to linux commands.
I accomplished this by doing the following. Full process
yum update -y
yum -y groupinstall "Development Tools"
installed git ... followed this (https://stackoverflow.com/a/8327476/888640)
Installed alternate version of PYTHON
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xvzf Python-2.7.2.tgz
cd Python-2.7.2
./configure
make altinstall
cd
use the correct python version
mv /usr/bin/python /usr/bin/python.old
ln -s /usr/local/bin/python2.7 /usr/bin/python
install node
cd node
./configure
make
make install
change back to normal version of python
mv /usr/bin/python.old /usr/bin/python