Categories
Linux Mastering Development Ubuntu

Target WSGI script ‘/var/www/FlaskApp/flaskapp.wsgi’ cannot be loaded as Python module

Stuck here for days mod_wsgi (pid=16615): Target WSGI script ‘/var/www/FlaskApp/flaskapp.wsgi’ cannot be loaded as Python module. mod_wsgi (pid=16615): Exception occurred processing WSGI script ‘/var/www/FlaskApp/flaskapp.wsgi’. Traceback (most recent call last): File “/var/www/FlaskApp/flaskapp.wsgi”, line 7, in <module> from FlaskApp import app as application File “/var/www/FlaskApp/FlaskApp/__init__.py”, line 6, in <module> from Recognition import testCode,trainCode File “/home/example_2019/Recognition.py”, line 2, […]

Categories
Mastering Development

Unable to start Airflow Server – OSError: [Errno 2] No such file or directory

I setup Airflow locally using the Installation and Quickstart pages. I was able to originally get it up and running, and even follow the Tutorial. Then when trying my own example which required the following pip install ‘apache-airflow[gcp,google_auth]’ When I try to run webserver with airflow webserver -p 8080 I get the following error: Running […]

Categories
Development

Python script on ubuntu – OSError: [Errno 12] Cannot allocate memory

I am running a script on AWS (Ubunut) EC2 instance. It’s a web scraper that uses selenium/chromedriver and headless chrome to scrape some webpages. I’ve had this script running previously with no problems, but today I’m getting an error. Here’s the script: options = Options() options.add_argument(‘–no-sandbox’) options.add_argument(‘–window-size=1420,1080’) options.add_argument(‘–headless’) options.add_argument(‘–disable-dev-shm-usage’) options.add_argument(‘–disable-gpu’) options.add_argument(“–disable-notifications”) options.binary_location=’/usr/bin/chromium-browser’ driver = webdriver.Chrome(chrome_options=options) […]

Categories
Development System & Network

long_running_recognize() function raises an SSL exception when run in concurrent.futures.ThreadPoolExecutor

I use long_running_recognize from speech_v1p1beta1.SpeechClient(). I’ve encountered some problem when I run long_running_recognize in parallel using concurrent.futures.ThreadPoolExecutor. My error is following: exception calling callback for <Future at 0x7f4ed4443dd8 state=finished raised Error> Traceback (most recent call last): File “/usr/lib/python3.6/concurrent/futures/_base.py”, line 324, in _invoke_callbacks File “/data/venvs/archSpeechRecoVenv/lib/python3.6/site-packages/google/auth/transport/grpc.py”, line 75, in wrapped File “/usr/lib/python3.6/concurrent/futures/_base.py”, line 425, in result File […]

Categories
Development

Why do I get error Mapper mapped class Host->host could not assemble any primary key column even when I have column with primary key?

Why do I get this error saying: sqlalchemy.exc.ArgumentError: Mapper mapped class Host->host could not assemble any primary key columns for mapped table ‘host’. Even when I have a column with primary key. from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine Base = declarative_base() class Host(Base): __tablename__ = ‘host’ […]

Categories
Development Linux

Unable to complete install: ‘unsupported configuration: emulator ‘/usr/lib/xen-4.11/bin/qemu-system-i386′ not found’

Log: Unable to complete install: ‘unsupported configuration: emulator ‘/usr/lib/xen-4.11/bin/qemu-system-i386′ not found’ Traceback (most recent call last): File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 75, in cb_wrapper callback(asyncjob, *args, **kwargs) File “/usr/share/virt-manager/virtManager/create.py”, line 2119, in _do_async_install guest.installer_instance.start_install(guest, meter=meter) File “/usr/share/virt-manager/virtinst/installer.py”, line 419, in start_install doboot, transient) File “/usr/share/virt-manager/virtinst/installer.py”, line 362, in _create_guest domain = self.conn.createXML(install_xml or final_xml, 0) File “/usr/lib/python3/dist-packages/libvirt.py”, […]

Categories
Development

Assigning global variable that is pickable

I aplogize if this is an easy problem to fix, I’ve tried searching but couldn’t come up with a solution. I come from PHP, so maybe what I am trying to achieve is not possible, or it needs to be done differently in python. Okay, so I have a class called database.py which parses a […]

Categories
Development

Pytorch AttributeError: module ‘torch’ has no attribute ‘as_tensor’

$ python main.py –hetero Created directory results/ACMRaw_2020-01-13_01-20-26 Traceback (most recent call last): File “main.py”, line 101, in <module> main(args) File “main.py”, line 30, in main val_mask, test_mask = load_data(args[‘dataset’]) File “/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py”, line 225, in load_data return load_acm_raw(remove_self_loop) File “/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py”, line 189, in load_acm_raw pa = dgl.bipartite(p_vs_a, ‘paper’, ‘pa’, ‘author’) File “/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/convert.py”, line 260, in bipartite […]

Categories
Development

Sending post request through Postman works but not when using http

I am working on uploading an image to my server (right now it is just localhost). Below is the part of the code in my views.py that is causing the problem. valid_extensions = [‘jpg’, ‘jpeg’, ‘png’, ‘gif’] images = request.data.getlist(‘images[]’) #Error here I believe directory = os.path.join(os.getcwd(), ‘static’, ‘images’, ‘products’) for image in images: extension […]

Categories
Development

PyTorch and TensorFlow object detection – evaluate – object of type

I’m attempting to get this PyTorch person detection example running: https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html I’m using Ubuntu 18.04. Here is a summary of the steps I’ve performed: 1) Stock Ubuntu 18.04 install on a Lenovo ThinkPad X1 Extreme Gen 2 with a GTX 1650 GPU. 2) Perform a standard CUDA 10.0 / cuDNN 7.4 install. I’d rather not […]