Unable to install mod_wsgi package - django

I am trying to install mod_wsgi package using pip , in amazon linux 2 instance, but I keep facing an error:
Command:
python3 -m pip install mod_wsgi
OUTPUT/ERROR:
Defaulting to user installation because normal site-packages is not writeable
Collecting mod_wsgi
Using cached mod_wsgi-4.9.0.tar.gz (497 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2sfljsxd/mod-wsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2sfljsxd/mod-wsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-54w0mlq7
cwd: /tmp/pip-install-2sfljsxd/mod-wsgi/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2sfljsxd/mod-wsgi/setup.py", line 91, in <module>
'missing Apache httpd server packages.' % APXS)
RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Steps taken trying to resolve the error:
1.I tried running python setup.py egg_info, but kept getting the error setup.py doesnt exist
2.I tried finding setup.py , using the command find . -name setup.py, but nothing was returned
How do I solve this?
PS: I know you are only supposed to ask one question at a time but, if there is any tutorial that explains how to use apache and mod_wsgi , to launch a django project on ec2 instance on aws, please do link it, would highly appreciate it
Thank you!

Related

How shoud I fix ERROR with pip install psycopg2==2.7.*?

I am trying to put my app that I created on server www using heroku. But when I put to my terminal on Ubuntu pip install psycopg2==2.7.*, I get this error:
ERROR: Command errored out with exit status 1:
command: /home/marcin/Python/learning_log/ll_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c67buptz/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c67buptz/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-c67buptz/psycopg2/pip-egg-info
cwd: /tmp/pip-install-c67buptz/psycopg2/
Complete output (28 lines):
running egg_info
creating /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
/home/marcin/Python/learning_log/ll_env/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/home/marcin/Python/learning_log/ll_env/lib/python3.8/site-packages/setuptools/command/egg_info.py:643: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
Please extend command classes from setuptools instead of distutils.
warnings.warn(
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
What should I do?
You need some dependencies check this answer
https://stackoverflow.com/a/46877364/15208727
sudo apt install libpq-dev python3-dev
You should install pscopg2-binary and the push to heroku
pip install psycopg2-binary or pipenv install psycopg2-binary depending on your virtualenv

Installing tensorflow 1.14.0 on python2.7 on Ubuntu 20.04

I'm trying to install tensorflow 1.14.0 on my Ubuntu (20.04 LTS) machine.
I need the python version 2.7.
The cmd line I'm trying to execute is
$ sudo python2.7 -m pip install tensorflow==1.14.0
but it seems there is an issue with "grpcio". The output is the following one:
Collecting tensorflow==1.14.0
Using cached tensorflow-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl (109.2 MB)
Collecting backports.weakref>=1.0rc1
Using cached backports.weakref-1.0.post1-py2.py3-none-any.whl (5.2 kB)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python2.7/dist-packages (from tensorflow==1.14.0) (1.1.2)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==1.14.0) (1.16.0)
Collecting gast>=0.2.0
Using cached gast-0.5.3.tar.gz (23 kB)
Collecting grpcio>=1.8.6
Using cached grpcio-1.41.1.tar.gz (21.2 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0d4Nnx/grpcio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0d4Nnx/grpcio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zkUeEF
cwd: /tmp/pip-install-0d4Nnx/grpcio/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-0d4Nnx/grpcio/setup.py", line 256, in <module>
if check_linker_need_libatomic():
File "/tmp/pip-install-0d4Nnx/grpcio/setup.py", line 206, in check_linker_need_libatomic
stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I have already tried to upgrade pip (20.3.4) and setuptools (44.1.1).
I also tried to install grpcio from a repository by following this guide https://pypi.org/project/grpcio/, but I get the same error.
Do you have any suggestion?
Thank you!
I had the same exat issue as you, upgrading pip wouldn't work in my case either.
I was able to install tensorboard on my platform by installing an older version of grpcio (in my case pip install grpcio==1.20.1).
You will see some warnings on execution about some missing dynamic libraries which are ok for me, but you might want to try other grpcio version.

Django: ERROR: python setup.py egg_info Check the logs for full command output

I am newbie as developer and have developped a first project in Django
I try to deploy my project in a test server (Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-88-generic x86_64)) prepared by a sys admin in my team
Each time I try to install dependancies (pip install -r requirements.txt) it fail with the error below:
ERROR: Command errored out with exit status 1:
command: /home/test/envs/envTbm/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1uqfxt7j/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1uqfxt7j/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info
cwd: /tmp/pip-install-1uqfxt7j/psycopg2/
Complete output (7 lines):
running egg_info
creating /tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-1uqfxt7j/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I did not understand what could be the problem...

mysqlclient install in python3 on mac os

install mysqlclient in python3 system this error
command pip3 install mysqlclient
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/pip-egg-info
cwd: /private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/
Complete output (12 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
Did you install required prerequisites for mysqlclient?
macOS (Homebrew)
Install MySQL and mysqlclient:
Assume you are activating Python 3 venv
$ brew install mysql
$ pip install mysqlclient
If you don't want to install MySQL server, you can use mysql-client instead:
Assume you are activating Python 3 venv
$ brew install mysql-client
$ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
$ export PATH="/usr/local/opt/mysql-client/bin:$PATH"
$ pip install mysqlclient

python - errors installing spaCy (UnicodeDecodeError)

I am trying to install spaCy on Ubuntu in VirtualBox. I am following the instructions here: https://spacy.io/usage/#section-instructions
I type each of the following into the terminal as is; I do not navigate into any directories.
I try the first instruction:
pip install -U spacy
Which gives:
error: could not delete '/usr/local/lib/python2.7/dist-packages/spacy/pipeline.so': Permission denied
So after following advice on another question I instead try:
sudo pip install -U spacy
Which does not give me the error from before, but now I get the following:
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/spacy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0HIkOS-record/install-record.txt --single-version-externally-managed --compile failed with error code -9 in /tmp/pip_build_root/spacy
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
So if I then try to download the English package (ignoring the errors above):
python -m spacy download en
I get:
/usr/bin/python: No module named plac; 'spacy' is a package and cannot be directly executed
Not sure if this information is relevant: When I look in /usr/lib I find python2.7 and python3.4; each folder also contains a spacy folder. Probably because I tried the above commands with python3 as well as just python when trying to solve my problem.
Can someone help me solve this issue so I can install spaCy and make use of the English model?
Try updating pip:
$ pip install -U pip
Then try the Spacy install again.
I got the same error message during the Spacy install when it was in the process of installing numpy. The pip update fixed the problem and everything went smoothly after that, including Spacy's English language model download.