Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to configure python 3.7 from python 3.6. in apache2 ubuntu #839

Open
Ashish-12kumar opened this issue May 31, 2023 · 8 comments
Open

Comments

@Ashish-12kumar
Copy link

[Tue May 30 12:03:49.239449 2023] [wsgi:error] [pid 5670:tid 139636291550144] mod_wsgi (pid=5670): Target WSGI script '/gemnlp/apache/Gem_api/api.wsgi' cannot be loaded as Python module.
[Tue May 30 12:03:49.239521 2023] [wsgi:error] [pid 5670:tid 139636291550144] mod_wsgi (pid=5670): Exception occurred processing WSGI script '/gemnlp/apache/Gem_api/api.wsgi'.
[Tue May 30 12:03:49.241719 2023] [wsgi:error] [pid 5670:tid 139636291550144] Traceback (most recent call last):
[Tue May 30 12:03:49.241741 2023] [wsgi:error] [pid 5670:tid 139636291550144] File "/gemnlp/apache/Gem_api/api.wsgi", line 5, in
[Tue May 30 12:03:49.241743 2023] [wsgi:error] [pid 5670:tid 139636291550144] from api import app
[Tue May 30 12:03:49.241747 2023] [wsgi:error] [pid 5670:tid 139636291550144] File "/gemnlp/apache/Gem_api/api.py", line 3, in
[Tue May 30 12:03:49.241749 2023] [wsgi:error] [pid 5670:tid 139636291550144] import pandas as pd
[Tue May 30 12:03:49.241758 2023] [wsgi:error] [pid 5670:tid 139636291550144] ModuleNotFoundError: No module named 'pandas'

I am getting this error because mod_wsgi is using python 3.6 by default. i tried all the methods but nothing worked. all the tried commands were working successful but by default it was using python 3.6.

@Ashish-12kumar Ashish-12kumar changed the title not able to configure python 3.7 from python 3.6. not able to configure python 3.7 from python 3.6. in apache2 ubuntu May 31, 2023
@Ashish-12kumar
Copy link
Author

Ashish-12kumar commented May 31, 2023

i have mod_wsgi for python 3.6 but not for python 3.7 even I tried to install it for python 3.7 using pip install mod_wsgi. but this command is giving me below error :-

/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
Makefile:31: recipe for target 'src/server/mod_wsgi.la' failed
make: *** [src/server/mod_wsgi.la] Error 1

I have to deploy it in production

@GrahamDumpleton
Copy link
Owner

Not sure how you are getting an error which shows a Makefile as the pip install mod_wsgi method shouldn't use one.

Do note that if building mod_wsgi from source code or using pip install method, you must have the development package for Apache installed. What this package is called will depend on your Linux distro. The page at https://pypi.org/project/mod-wsgi/ says stuff about what the system packages are you might need. So make sure they are installed for your platform.

Anyway, initially I would suggest you ignore the system Apache. That is, don't manually configure it. Ensure the Apache core and devel packages are installed, use pip install mod_wsgi and then run mod_wsgi-express start-server to run your web application from the command line. Get that working first. The PyPi page has details.

@Ashish-12kumar
Copy link
Author

pip install mod_wsgi is not working. /usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
Makefile:31: recipe for target 'src/server/mod_wsgi.la' failed
make: *** [src/server/mod_wsgi.la] Error 1

can you please tell what does this error mean?

@GrahamDumpleton
Copy link
Owner

As I already indicated, you need to ensure that you have the Apache development packages installed. If you don't the files it requires for linking may be missing and strange errors like that could arise.

So what system Apache packages do you have installed?

To provide any more help, I need to see the complete output from running pip install. You may even need to provide the -v option to pip install so it shows verbose messages.

@Ashish-12kumar
Copy link
Author

i have installed all mentioned packages -> apache2-dev libapr1-dev libaprutil1-dev libtcnative-1-dev maven ant libthrift-dev librdkafka-dev

@GrahamDumpleton
Copy link
Owner

Then please provide the output from running pip install -v mod_wsgi.

@Ashish-12kumar
Copy link
Author

(gemenvtest1) root@azgemnlpUAT-VM:/gemnlp/apache/Gem_api# pip install -v mod_wsgi
Using pip 23.1.2 from /gemnlp/apache/Gem_api/gemenvtest1/lib/python3.7/site-packages/pip (python 3.7)
Collecting mod_wsgi
Using cached mod_wsgi-4.9.4.tar.gz (497 kB)
Running command python setup.py egg_info

WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by
all processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.

running egg_info
creating /tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info
writing /tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/dependency_links.txt
writing entry points to /tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/entry_points.txt
writing top-level names to /tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'docs/_build/html/_static/'
warning: no files found matching 'docs/_build/html/_static/css/
'
warning: no files found matching 'docs/_build/html/_static/font/'
warning: no files found matching 'docs/_build/html/_static/js/
'
warning: no files found matching 'docs/_build/html/_sources/*'
warning: no files found matching 'pyproject.toml'
adding license file 'LICENSE'
writing manifest file '/tmp/pip-pip-egg-info-sh70yfe1/mod_wsgi.egg-info/SOURCES.txt'
Preparing metadata (setup.py) ... done
Building wheels for collected packages: mod_wsgi
Running command python setup.py bdist_wheel

WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by
all processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.

running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/mod_wsgi
copying src/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi
creating build/lib.linux-x86_64-cpython-37/mod_wsgi/server
copying src/server/apxs_config.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server
copying src/server/environ.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server
copying src/server/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server
creating build/lib.linux-x86_64-cpython-37/mod_wsgi/server/management
copying src/server/management/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server/management
creating build/lib.linux-x86_64-cpython-37/mod_wsgi/server/management/commands
copying src/server/management/commands/runmodwsgi.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server/management/commands
copying src/server/management/commands/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/server/management/commands
creating build/lib.linux-x86_64-cpython-37/mod_wsgi/docs
copying docs/_build/html/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/docs
creating build/lib.linux-x86_64-cpython-37/mod_wsgi/images
copying images/init.py -> build/lib.linux-x86_64-cpython-37/mod_wsgi/images
copying images/snake-whiskey.jpg -> build/lib.linux-x86_64-cpython-37/mod_wsgi/images
running build_ext
building 'mod_wsgi.server.mod_wsgi-py37' extension
creating build/temp.linux-x86_64-cpython-37
creating build/temp.linux-x86_64-cpython-37/src
creating build/temp.linux-x86_64-cpython-37/src/server
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/mod_wsgi.c -o build/temp.linux-x86_64-cpython-37/src/server/mod_wsgi.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
src/server/mod_wsgi.c: In function ‘wsgi_socket_sendv’:
src/server/mod_wsgi.c:11063:44: warning: signed and unsigned type in conditional expression [-Wsign-compare]
(nvec < iov_max ? nvec : (int)iov_max));
^
src/server/mod_wsgi.c: In function ‘wsgi_scan_headers’:
src/server/mod_wsgi.c:11222:30: warning: signed and unsigned type in conditional expression [-Wsign-compare]
buflen = buffer ? buflen : sizeof(x);
^
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_apache.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_apache.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_buckets.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_buckets.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_convert.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_convert.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_daemon.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_daemon.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_interp.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_interp.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_logger.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_logger.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_memory.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_memory.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_metrics.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_metrics.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_restrict.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_restrict.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_server.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_server.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_stream.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_stream.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_thread.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_thread.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/gemnlp/apache/Gem_api/gemenvtest1/include -I/usr/local/include/python3.7m -c src/server/wsgi_validate.c -o build/temp.linux-x86_64-cpython-37/src/server/wsgi_validate.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include
gcc -pthread -shared build/temp.linux-x86_64-cpython-37/src/server/mod_wsgi.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_apache.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_buckets.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_convert.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_daemon.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_interp.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_logger.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_memory.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_metrics.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_restrict.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_server.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_stream.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_thread.o build/temp.linux-x86_64-cpython-37/src/server/wsgi_validate.o -Wl,--enable-new-dtags,-R/usr/local/lib -Wl,--enable-new-dtags,-R/usr/local/lib/python3.7/config-3.7m-linux -o build/lib.linux-x86_64-cpython-37/mod_wsgi/server/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so -L/usr/local/lib -L/usr/local/lib/python3.7/config-3.7m-linux -lpython3.7m
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ceval.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
error: command '/usr/bin/gcc' failed with exit code 1
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /gemnlp/apache/Gem_api/gemenvtest1/bin/python3.7 -u -c '
exec(compile('"'"''"'"''"'"'

This is -- a caller that pip uses to run setup.py

- It imports setuptools before invoking setup.py, to enable projects that directly

import from distutils.core to work with newer packaging standards.

- It provides a clear error message when setuptools is not installed.

- It sets sys.argv[0] to the underlying setup.py, when invoking setup.py so

setuptools doesn'"'"'t think the script is -c. This avoids the following warning:

manifest_maker: standard file '"'"'-c'"'"' not found".

- It generates a shim setup.py, for handling setup.cfg-only projects.

import os, sys, tokenize

try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)

file = %r
sys.argv[0] = file

if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = ""
setup_py_code = "from setuptools import setup; setup()"

exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/tmp/pip-install-q62ubj19/mod-wsgi_9738fd1ad57b47c590ed0cf50839e900/setup.py'"'"',), "", "exec"))' bdist_wheel -d /tmp/pip-wheel-wx9oozbr
cwd: /tmp/pip-install-q62ubj19/mod-wsgi_9738fd1ad57b47c590ed0cf50839e900/
Building wheel for mod_wsgi (setup.py) ... error
ERROR: Failed building wheel for mod_wsgi
Running setup.py clean for mod_wsgi
Running command python setup.py clean

WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by
all processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.

running clean
removing 'build/temp.linux-x86_64-cpython-37' (and everything under it)
removing 'build/lib.linux-x86_64-cpython-37' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.7' does not exist -- can't clean it
removing 'build'
Failed to build mod_wsgi
ERROR: Could not build wheels for mod_wsgi, which is required to install pyproject.toml-based projects

@GrahamDumpleton
Copy link
Owner

So the real error of importance is:

/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ceval.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC

The prior output even has a big warning that your Python installation doesn't have a shared library.

WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by
all processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.

So that error is exactly because of that.

As the warning says so, you need to reinstall your custom Python installation so it has a shared library. Better still, use any system package for Python instead as they are compiled correctly with a shared library.

If you are installing Python yourself from source code, go read:

The post is old now and so you will have to adapt information in it for recent Python versions, but it mentions the specific problem about lack of Python shared library. The mod_wsgi docs even warn about this problem at:

Are you installing Python yourself from source code or not? Or are you using a installer such as pyenv? If you are using pyenv, see https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with---enable-shared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants