I was a little addicted to installing Python3.3 + mod_wsgi3.4 on Sakura VPS (CentOS), so a retrospective memo

Preface

When installing python3.3 for the first time, it looks like this ↓ (See some site.)

$ ./configure --prefix=/usr/local
$ make
$ make altinstall

I was trying to create a pyramid project by putting virtualenv in this environment, so I tried to build apache + mod_wsgi again for deployment.

It seems to be useless unless python3.3 is rebuilt ...

For the time being, recompile python3.3 with additional parameters

$ cd /path/to/Python-3.3.0
$ ./configure CFLAGS=-fPIC --enable-shared --prefix=/usr/local
$ make
$ make install
$ echo $?

It seemed like there was no problem so far ... but

$ python3.3
python3.3: error while loading shared libraries: libpython3.3m.so.1.0: cannot open shared object file: No such file or directory
$ 

It says that the so file cannot be found. It was certainly in / usr / local / lib, so this time I added the path to /etc/ld.so.conf and escaped with ldconfig.

So, I try to install mod_wsgi without thinking about anything ...

$ wget http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
$ tar zxvf mod_wsgi-3.4.tar.gz
$ cd mod_wsgi-3.4
$ ./configure CFLAGS=-fPIC --with-python=/usr/local/bin/python3.3
$ make
(Omission)
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.3/config -lpython3.3 -lpthread -ldl -lutil -lm
/usr/bin/ld: cannot find -lpython3.3
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
$

I got an unexpected error and stopped. I checked what the file status is after reinstalling python.

$ ls -lt /usr/local/lib/python3.3/
(Abbreviation)
drwxr-xr-x  4 root root   4096 Feb  3 23:57 concurrent
drwxr-xr-x  2 root root   4096 Feb  3 23:57 config-3.3m
-rw-r--r--  1 root root  49499 Feb  3 23:57 configparser.py
(Abbreviation)

I'm not sure if the build was special, apparently in the form /usr/local/lib/python3.3/config-3.3m instead of /usr/local/lib/python3.3/config It seems that a directory will be created. So next

$ ls -lt /usr/local/bin/
(Abbreviation)
lrwxrwxrwx 1 root root      16 Feb  3 23:57 python3-config -> python3.3-config
lrwxrwxrwx 1 root root      17 Feb  3 23:57 python3.3-config -> python3.3m-config
lrwxrwxrwx 1 root root       9 Feb  3 23:57 python3 -> python3.3
-rwxr-xr-x 1 root root    1970 Feb  3 23:57 python3.3m-config
(Abbreviation)
-rwxr-xr-x 2 root root   13347 Feb  3 23:57 python3.3
-rwxr-xr-x 2 root root   13347 Feb  3 23:57 python3.3m
(Abbreviation)

Since python3.3 and python3.3m existed and -config was finally looking at python3.3m-config, I guess that the specification of -lpython3.3 is bad. So, finally I decided to rewrite the Makefile generated at configure like this

< LDFLAGS =  -L/usr/local/lib -L/usr/local/lib/python3.3/config 
< LDLIBS =  -lpython3.3 -lpthread -ldl  -lutil -lm
---
> LDFLAGS =  -L/usr/local/lib -L/usr/local/lib/python3.3/config-3.3m
> LDLIBS =  -lpython3.3m -lpthread -ldl  -lutil -lm
$ make
(Abbreviation)
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.3/config-3.3m -lpython3.3m -lpthread -ldl -lutil -lm
$ 
$ make install

Oh, make finished normally. So install it as it is above. I was able to restart apache without any problems.

Supplement

I haven't confirmed if mod_wsgi works well yet.

Recommended Posts

I was a little addicted to installing Python3.3 + mod_wsgi3.4 on Sakura VPS (CentOS), so a retrospective memo
When I tried to scrape using requests in python, I was addicted to SSLError, so a workaround memo
Memo (March 2020) that I was addicted to when installing Arch Linux on MacBook Air 11'Early 2015
A note I was addicted to when making a beep on Linux
I wrote AWS Lambda, and I was a little addicted to the default value of Python arguments
A memo with Python2.7 and Python3 on CentOS
I was addicted to Flask on dotCloud
What I was addicted to Python autorun
A story I was addicted to when inserting from Python to a PostgreSQL table
A story I was addicted to trying to install LightFM on Amazon Linux
I was addicted to creating a Python venv environment with VS Code
I was addicted to trying Cython with PyCharm, so make a note
Building a Python environment on a Sakura VPS server
Summary of points I was addicted to running Selenium on AWS Lambda (python)
A note I was addicted to when running Python with Visual Studio Code
A story that I was addicted to when I made SFTP communication with python
I set up TensowFlow and was addicted to it, so make a note
I was soberly addicted to calling awscli from a Python 2.7 script registered in crontab
I was addicted to scraping with Selenium (+ Python) in 2020
A story that I was addicted to at np.where
A Python beginner was addicted to registering his own package on PyPI, February 2017 version
A memo when Django was released on VPS (preparation)
What I was addicted to when using Python tornado
What I was addicted to when migrating Processing users to Python
[Fixed] I was addicted to alphanumeric judgment of Python strings
Notes on installing Python on CentOS
A story that I was addicted to calling Lambda from AWS Lambda.
The record I was addicted to when putting MeCab on Heroku
I installed Taiga.IO on CentOS7 (I made a script while I was there)
What I was addicted to when introducing ALE to Vim for Python
[Python] I tried to implement stable sorting, so make a note
What I was addicted to with json.dumps in Python base64 encoding
[Python] A memo that I tried to get started with asyncio
A note I was addicted to when creating a table with SQLAlchemy
Homework was a pain, so I do management accounting with Python
I was addicted to confusing class variables and instance variables in Python
[Python] When I tried to make a decompression tool with a zip file I just knew, I was addicted to sys.exit ()
[Fabric] I was addicted to using boolean as an argument, so make a note of the countermeasures.
A memo when using systemd to keep a Python script running as a daemon on CentOS 7 at all times.
Create a python environment on centos
Build a python3 environment on CentOS7
I was addicted to multiprocessing + psycopg2
Two things I was addicted to building Django + Apache + Nginx on Windows
I want to tweet on Twitter with Python, but I'm addicted to it
I was addicted to running tensorflow on GPU with NVIDIA driver 440 + CUDA 10.2
[Python memo] I want to get a 2-digit hexadecimal number from a decimal number
A story I was addicted to trying to get a video url with tweepy
Use Python from Java with Jython. I was also addicted to it.
I was addicted to not being able to use Markdown on pypi's long_description
The file name was bad in Python and I was addicted to import
[Python] I was addicted to not saving internal variables of lambda expressions
A memorandum because I stumbled on trying to use MeCab in Python
Suddenly I needed to work on a project using Python and Pyramid, so a note of how I'm studying
I put Python 2.7 in Sakura VPS 1GB.
I was addicted to pip install mysqlclient
I want to build a Python environment
Connecting from python to MySQL on CentOS 6.4
A little more detail on python comprehensions
I tried using pipenv, so a memo
What I was addicted to when creating a web application in a windows environment
Three things I was addicted to when using Python and MySQL with Docker