ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' (render.com) - django

I'm trying to deploy a simple CRUD Django app suing the service of render.com. I have set up the config based on their documentation, but when I try to deploy it, the error ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' comes up.
Build error
Feb 4 10:45:16 AM ==> Cloning from https://github.com/user/django-crud-app...
Feb 4 10:45:20 AM ==> Checking out commit ed701ede6bde3f7c7abd1378f656c7763b063917 in branch main
Feb 4 10:45:24 AM ==> Using Python version: 3.7.10
Feb 4 10:45:28 AM ==> Running build command 'pip3 install -r requirements.txt'...
Feb 4 10:45:29 AM ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Feb 4 10:45:29 AM WARNING: You are using pip version 20.1.1; however, version 23.0 is available.
Feb 4 10:45:29 AM You should consider upgrading via the '/opt/render/project/src/.venv/bin/python -m pip install --upgrade pip' command.
Feb 4 10:45:29 AM ==> Build failed 😞
Feb 4 10:45:29 AM ==> Generating container image from build. This may take a few minutes...
I have generated my requirements.txt
See Image Here
asgiref==3.6.0
autopep8==2.0.1
dj-database-url==1.2.0
Django==4.1.5
gunicorn==20.1.0
psycopg2-binary==2.9.5
pycodestyle==2.10.0
sqlparse==0.4.3
whitenoise==6.3.0
No sure what el to do.
I try to deploy a Django app with render.com

Related

SageMaker Studio Image - pip not found and no python 3 in terminal for Python 3 notebook instance

Launched Data Science Python 3 instance in the SageMaker Studio.
Launched a terminal from the Notebook menu "Launch terminal in current SageMaker image".
Tried to run pip but it says not found. Do I need to install pip by myself?
root#datascience-1-0-ml-t3-medium-1abf3407f667f989be9d86559395:~/# pip
bash: pip: command not found
Alto there is no Python3 available apparently from within the terminal.
root#datascience-1-0-ml-t3-medium-1abf3407f667f989be9d86559395:~# python3
bash: python3: command not found
root#datascience-1-0-ml-t3-medium-1abf3407f667f989be9d86559395:~# python --version
Python 2.7.16
root#datascience-1-0-ml-t3-medium-1abf3407f667f989be9d86559395:/usr/bin# ls -lrt | grep python
lrwxrwxrwx 1 root root 29 Mar 4 2019 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx 1 root root 9 Mar 4 2019 python2 -> python2.7
lrwxrwxrwx 1 root root 7 Mar 4 2019 python -> python2
-rwxr-xr-x 1 root root 1056 Mar 4 2019 dh_python2
-rwxr-xr-x 1 root root 3689352 Oct 10 2019 python2.7
lrwxrwxrwx 1 root root 23 Oct 10 2019 pdb2.7 -> ../lib/python2.7/pdb.py
However, the notebook says it is Python3.
from platform import python_version
print(python_version())
---
3.7.10
And can run pip in the cell.
Appreciate any explanation what is going on.
SageMaker Studio image terminals use conda for package management. The data science notebook uses the base environment. You can use pip once you switch to base (also note that the python version is 3.7).
root#datascience-1-0-ml-t3-medium-xx:~# conda env list
# conda environments:
#
base * /opt/conda
root#datascience-1-0-ml-t3-medium-xx:~# conda activate base
(base) root#datascience-1-0-ml-t3-medium-xx:~# pip show pip
Name: pip
Version: 21.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig#python.org
License: MIT
Location: /opt/conda/lib/python3.7/site-packages
Requires:
Required-by:
(base) root#datascience-1-0-ml-t3-medium-1abf3407f667f989be9d86559395:~# python --version
Python 3.7.10
I work at AWS and my opinions are my own.
Was stuck in the same issue in Sagemaker notebook instance. Followed the guide here and resolved it by running:
%pip install matplotlib
Attaching the screenshot for your reference:

Manually start uwsgi with python3.6 and python2 and django 2

I just started to use uWSGI and Django. I want to invoke it manually.
I'm using python36, Django 2 and if I install uWSGI (pip install uwsgi) in venv and everything is ok.
Q1. When using outside of venv I first installed uWSGI:
pip install uwsgi -> 2.0.18 version
Installed plugins: sudo apt-get install python3-setuptools
Trying to run with python36:
uwsgi --plugin-dir=/usr/lib/uwsgi/plugins --plugin python3 --master --http :5000 --home ~/my_playground/webapps/ --chdir ~/my_playground/webapps/p_tscze/ --module p_tscze.wsgi:application
Plugins in /usr/lib/uwsgi/plugins:
/usr/lib/uwsgi/plugins$ ls | grep python3
asyncio_python36_plugin.so
asyncio_python3_plugin.so
python36_plugin.so
python3_plugin.so
Result obtained -> note python 2.7:
!!! UNABLE to load uWSGI plugin: ./python36_plugin.so: undefined symbol: uwsgi_legion_scrolls !!!
*** Starting uWSGI 2.0.18 (64bit) on [Wed May 29 18:04:24 2019] ***
compiled with version: 7.4.0 on 29 May 2019 15:30:14
os: Linux-4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019
nodename: start-tehnicka
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /usr/lib/uwsgi/plugins
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/anel/my_playground/webapps/p_tscze/
your processes number limit is 3618
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :5000 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:34279 (port auto-assigned) fd 3
Python version: 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Set PythonHome to /home/anel/my_playground/webapps/
ImportError: No module named site
So please can you let me know what I'm doing wrong?
Q2. When comparing the result of the admin page (./manage.py runserver) and result obtained using uwsgi frontend is not the same, why?
Thanks in advance
For future references:
wget https://projects.unbit.it/downloads/uwsgi-2.0.18.tar.gz
tar -xzvf uwsgi-2.0.18.tar.gz
cd uwsgi-2.0.18
python3 uwsgiconfig.py --build nolang #build binary with python3
python3 uwsgiconfig.py --plugin plugins/python nolang python36 # create a new binary
Run newly created binary uwsgi (we can link to this binary):
./uwsgi --plugin-dir=/home/anel/uwsgi-2.0.18 --plugin python36 --master --http :5000 --home ~/my_playground/webapps/ --chdir ~/my_playground/webapps/p_tscze/ --module p_tscze.wsgi:application

docker-compose on windows directory sync

Running the django tutorial for docker compose, but the command to init the django project is not working as expected.
$ docker-compose run web django-admin.py startproject composeexample .
[31mERROR[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
In windows "interactive" mode is not supported so I modified the command to run in "detached" mode.
$ docker-compose run -d web django-admin.py startproject composeexample .
Creating network "djangotest_default" with the default driver
...
Successfully built 0fb90648c1d8
[33mWARNING[0m: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
djangotest_web_run_1
This seems to create the boxes.. but my current directory shows no new files (from the django-admin command).
$ ls
docker-compose.yml Dockerfile requirements.txt
How do I get the container output to sync with the current working directory as expected?
The fix was to uninstall Windows 10 and install a *nix system. The files then appear as per the tutorial.
~/docker/django-test $ ll
total 60
drwxr-xr-x 4096 Sep 24 00:47 ./
drwxr-xr-x 4096 Sep 24 00:40 ../
drwxr-xr-x 4096 Sep 24 00:47 composeexample/
-rw-r--r-- 209 Sep 24 00:41 docker-compose.yml
-rw-r--r-- 146 Sep 24 00:41 Dockerfile
-rwxr-xr-x 812 Sep 24 00:47 manage.py*
-rw-r--r-- 16 Sep 24 00:41 requirements.txt

Python3 uWSGI stops instantly

I am having a an issue where I can't get uwsgi to run on my machine. I keep getting this:
/usr/bin$ sudo service ppuwsgi start
>>ppuwsgi start/running, process 17452
/usr/bin$ sudo service ppuwsgi status
>>ppuwsgi stop/waiting
I think I might be having a similar issue as this guy here. However, I didn't install from source. I saw that the machine came with python3.4. But I did do
sudo apt-get install libpq-dev python3-dev
and maybe even
sudo apt-get install python-dev
I want to think I don't have python installed twice. And I have no idea how to check and see. I opened up my usr/local/bin and saw uwsgi and some pip stuff but no python.
Lastly, here is my /etc/init/ppuwsgi.conf
# file: /etc/init/ppuwsgi.conf
description "uWSGI server for PingPlot"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/local/bin/uwsgi --home /home/ubuntu/web/app/ --socket /home/ubuntu/web/ppuwsgi.sock --chmod-socket --module wsgi --pythonpath /home/ubuntu/web/ -H /home/ubuntu/.virtualenvs/pingplot --logto /home/ubuntu/web/logs/uwsgi.log
The sock file and log file seem to get created as well (the log file is empty). I don't know what the deal is.
Edit:
So I opened up user/bin/ and here are all the python things I have.
EDIT: I LIED
I am getting stuff in the error log. I just couldn't see it because I opened vim without sudo. Here is the error log:
*** Starting uWSGI 2.0.8 (64bit) on [Thu Dec 11 05:36:59 2014] ***
compiled with version: 4.8.2 on 09 December 2014 02:42:22
os: Linux-3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014
nodename: ip-172-31-9-208
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 15925
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
chmod() socket to 666 for lazy and brave users
uwsgi socket 0 bound to UNIX address /home/ubuntu/web/ppuwsgi.sock fd 3
Python version: 2.7.6 (default, Mar 22 2014, 23:03:41) [GCC 4.8.2]
Set PythonHome to /home/ubuntu/.virtualenvs/pennypledge
ImportError: No module named site
Based on the error log. I changed my version of Python. I uninstalled uwsgi and pip and then reinstalled it using python3 pip.
sudo apt-get install python3-pip
sudo pip install uwsgi
Then I was able to get uwsgi running.

Run django project on cherokee + uwsgi

That have:
1) ubuntu 11.10
2) cherokee (https://launchpad.net/~cherokee-webserver/+archive/ppa) (version 1.2.101)
installed like this:
sudo apt-get install cherokee
sudo apt-get install libcherokee-mod-rrd
sudo apt-get install cherokee-doc
3) uwsgi (version 0.9.8.1-1)
installed like this:
sudo apt-get install uwsgi uwsgi-plugin-python
4) Django 1.3.1 (sudo pip install django)
Run:
1) add example.com to hosts file (example.com 127.0.0.1)
2) create uwsgi.xml
<uwsgi>
<pythonpath>/var/www/vtest/</pythonpath>
<pythonpath>/var/www/</pythonpath>
<app mountpoint="/">
<script>django_wsgi</script>
</app>
</uwsgi>
and django_wsgi.py
import os
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
application = django.core.handlers.wsgi.WSGIHandler()
3)
/var/www$ sudo django-admin.py startproject vtest
/var/www$ sudo chown -R www-data:www-data vtest/
Move file uwsgi.xml, django_wsgi.py to /var/www/vtest and chmod +x django_wsgi.py
4) add virtual server in cherokee-admin vservers -> add -> platforms -> uwsgi choise uwsgi.xml document root /var/www/vtest
in console:
ps -A | grep uwsgi
6352 ? 00:00:00 uwsgi
if run uwsgi command in console:
/var/www/vtest$ /usr/bin/uwsgi -s 127.0.0.1:59238 -x /var/www/vtest/uwsgi.xml
tmp = /
[uWSGI] parsing config file /var/www/vtest/uwsgi.xml
*** Starting uWSGI 0.9.8.1-debian (32bit) on [Sun Jan 15 13:28:42 2012] ***
compiled with version: 4.6.1 on 28 June 2011 10:38:32
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
uwsgi socket 0 bound to TCP address 127.0.0.1:59238 fd 3
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 6515, cores: 1)
in browser example.com:
500 Internal Server Error
what could be the cause of the error? And this line: "no app loaded. going in full dynamic mode" in the console.
you have not loaded the python plugin with
<plugins>python</plugins>