I want to use mod_wsgi by python3.X, as I have installed it by sudo pip install mod_wsgi its pointing to python 2.7
i want to use by python 3.x but when i am trying to install mod wsgi by pip install mod_wsgi in my python 3.x env its showing
**creating build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/psutil x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=543 -DPSUTIL_LINUX=1 -I/usr/include/python3.5m -I/home/DJ/include/python3.5m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.5/psutil/_psutil_common.o psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/DJ/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-1qvj90cx/psutil/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-9x33xnc1-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/DJ/include/site/python3.5/psutil" failed with error code 1 in /tmp/pip-build-1qvj90cx/psutil/**
You haven't installed the system dev variant of the Python package in the system Python installation from which the Python virtual environment is created.
ohk can you plese help me on that to install dev
r u talking about python-dev if it is, its installed.
The error suggests otherwise.
If you are using Python 3, the package you want may be called python3-dev. Depends on the system being used as to what is it called.
What do you get if you run:
find / -name Python.h
Also, the output isn't even from installing mod_wsgi. It is from installing the psutil package.
Thanks python3-dev solved issue for installing the mod_wsgi in python3. but still if i am running the
mod_wsgi-express module-config
its in python 2.7. how i can move it to python3.x
When you run pip install mod_wsgi, you need to first have activated the Python virtual environment for Python 3. You must at some point have installed it using Python 2.
I would suggest you activate your Python 2 environment and uninstall mod_wsgi using:
pip uninstall mod_wsgi
Then activate the Python 3 environment and install it in that.
pip install mod_wsgi
Run:
which pip
to make sure you are picking up pip from the correct environment.
This worked Thanks for the quick reply.
Hi Even after installing python3-devel.x86_64 packages, pip install mod_wsgi is still failing with the below error:
used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(myreadline.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /root/proj/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uuejrxm9/mod-wsgi/setup.py'"'"'; file='"'"'/tmp/pip-install-uuejrxm9/mod-wsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-657qt3zc/install-record.txt --single-version-externally-managed --compile --install-headers /root/proj/include/site/python3.8/mod-wsgi Check the logs for full command output.
Any help in installing mod_wsgi is much appreciated. as my virtual environment is having python3.x and mod_wsgi installed through yum is refering python2.x . Bcz of which apache server is running into " ImportError: No module named site "
This is a closed issue. Please don't ask new questions on closed issues, especially issues which are unrelated.
Your issue is also already covered in the documentation. See:
- https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#mixing-32-bit-and-64-bit-packages
Your Python installation has not been installed with a shared library. You need to reinstall your Python installation with shared libraries provided.
Also read:
- http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html
which also covers the requirement and how to install Python correctly from source code.
If you still can't resolve your problem, create a new issue, don't use this old issue.