falcon gunicorn ImportError: No module named hparams - gunicorn

I have already been working on a source that I have already created using gunicorn and nginx so that multiple people can access it without any problems.
Previously, falcon was running as a .py, but https://www.digitalocean.com/community/tutorials/how-to-deploy-falcon-web-applications-with-gunicorn-and-nginx-on-ubuntu-16-04
There was a problem while referring to site
my program's name is demo_server.py
and that code includes
import argparse
import falcon
from hparams import hparams, hparams_debug_string
import os
from synthesizer import Synthesizer // model (train model)
and when I type like these
gunicorn -b localhost: 5000 demo: app --reload
, The following error appears.
Failed to read config file: demo_server.py Traceback (most recent call
last):   File
"/data/falcon_app/venv/lib/python3.5/site-packages/gunicorn/app/base.py",
line 93, in get_config_from_filename
    execfile_ (filename, cfg, cfg)   File "/data/falcon_app/venv/lib/python3.5/site-packages/gunicorn/compat.py",
line 72, in execfile
    return six.exec_ (code, * args)   File "demo_server.py", line 3, in
    from hparams import hparams, hparams_debug_string ImportError: No module named 'hparams'
How do I resolve this ImportError?
Thanks..

Most probably you have installed gunicorn which corresponds to python2.7 on your local machine and you had to use python3.x which contains site-packages to run your falcon application.
Try install gunicorn3
sudo apt install gunicorn3
and then
gunicorn3 demo_server:app
worked for me

Related

Assertion Error while using stanford-sentiment-treebank-roberta.2021-03-11.tar.gz in ALLENNLP

I have created a virtual ubuntu machine and installed ALLENNLP,
In that and tried example from ALLENNLP demo website
I have executed below code
from allennlp.predictors.predictor import Predictor
import allennlp_models.tagging
predictor = Predictor.from_path("myLocalPath/stanford-sentiment-treebank-roberta.2021-03-11.tar.gz")
predictor.predict("a very well-made, funny and entertaining picture.")
which gave me below error.
>>> predictor.predict("a very well-made, funny and entertaining picture.")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/.local/lib/python3.8/site-packages/allennlp/predictors/text_classifier.py", line 24, in predict
return self.predict_json({"sentence": sentence})
File "/home/.local/lib/python3.8/site-packages/allennlp/predictors/predictor.py", line 54, in predict_json
instance = self._json_to_instance(inputs)
File "/home/.local/lib/python3.8/site-packages/allennlp/predictors/text_classifier.py", line 40, in _json_to_instance
return self._dataset_reader.text_to_instance(sentence)
File "/home/.local/lib/python3.8/site-packages/allennlp_models/classification/dataset_readers/stanford_sentiment_tree_bank.py", line 114, in text_to_instance
assert isinstance(
AssertionError
But when I executed below code
from allennlp.predictors.predictor import Predictor
import allennlp_models.tagging
predictor = Predictor.from_path("myLocalPath/sst-roberta-large-2020.06.08.tar.gz")
predictor.predict("a very well-made, funny and entertaining picture.")
It worked.
Only difference between above two code is version of roberta-large train data
I have installed latest version of ALLENNLP in my virtual machine
I don't have NVIDIA graphic card in my virtual machine could this be a reason?
But then how come other version is working?
Please help
Allen NLP version was the issue it was ALLENNLP 2.1.0, It worked with ALLENNLP version 2.4.0.
Use command "pip install allennlp"
and then "pip install allennlp-models"
instead of "pip install allennlp==[some version] allennlp-models==[some version]"
or make sure you have version greater than or equal to 2.4.0.

I am encountering module loading problem in mysql

I will work with mysql, but it gives this error anyway. I did delete the module but it did not change, I loaded it differently, I could not solve the modules.
Traceback (most recent call last):
File "C:\Users\INAL\Desktop\Son Scriptler\mysql\mysql.py", line 1, in <module>
import mysql.connector
File "C:\Users\INAL\Desktop\Son Scriptler\mysql\mysql.py", line 1, in <module>
import mysql.connector
ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
You might not have the mysql-connector did you try installing it using pip?
pip3 install mysql-connector
The problem was that my project name was mysql.py and I solved the problem by changing the project name.

pygame py2app Library not loaded: #loader_path/.dylibs/libSDL-1.2.0.dylib

I wouldn't call myself a programmer and am unfamiliar with Mac and Linux, so any links or pointers to additional background would help greatly. I've started with the most basic pygame I could google, (from https://realpython.com/pygame-a-primer/). The test.py and test.app runs on my VM but not on anyone else's real Macs.
test.py file
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
setup.py file
from setuptools import setup
APP = ['test.py']
DATA_FILES = []
OPTIONS = {}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
command to create the test.app
$ python3 setup.py py2app
The test.app runs fine on the VM, but whenever the test.app runs on a real Mac (tested 2, one ran on Catalina ver???) this error message appears:
Traceback (most recent call last):
File "/Applications/test.app/Contents/Resources/__boot__.py", line 101, in <module>
_run()
File "/Applications/test.app/Contents/Resources/__boot__.py", line 84, in _run
exec(compile(source, path, "exec"), globals(), globals())
File "/Applications/test.app/Contents/Resources/test.py", line 1, in <module>
import pygame
File "pygame/__init__.pyc", line 120, in <module>
File "pygame/base.pyc", line 14, in <module>
File "pygame/base.pyc", line 10, in __load
File "imp.pyc", line 343, in load_dynamic
ImportError: dlopen(/Applications/test.app/Contents/Resources/lib/python3.7/lib-dynload/pygame/base.so, 2): Library not loaded: #loader_path/.dylibs/libSDL-1.2.0.dylib
Referenced from: /Applications/test.app/Contents/Resources/lib/python3.7/lib-dynload/pygame/base.so
Reason: image not found
2020-05-02 11:27:50.309 test[931:15836] test Error
----------------------------
Working environment: VirtualBox 6.1, macOS Sierra (Version 10.12) with the following:
$ pip list
Package Version
----------- ----------
altgraph 0.17
certifi 2020.4.5.1
macholib 1.14
modulegraph 0.18
pip 20.1
py2app 0.21
pygame 1.9.6
setuptools 39.0.1
wheel 0.34.2
$ brew list --versions
freetype 2.10.1
gdbm 1.18.1
jpeg 9d
libmikmod 3.3.11.1
libogg 1.3.4
libpng 1.6.37
libtiff 4.1.0
libvorbis 1.3.6
openssl#1.1 1.1.1g
pkg-config 0.29.2_3
python 3.7.7
readline 8.0.4
sdl 1.2.15_1
sdl2 2.0.12_1
sdl_image 1.2.12_7
sdl_mixer 1.2.12_3
sdl_ttf 2.0.11_1
sqlite 3.31.1
webp 1.1.0
xz 5.2.5
Any ideas or pointers would be greatly appreciated. The actual program is an OhHell card game which supports Windows clients (via pyinstaller), but I'm also trying to support a Mac client to play with my friends on a Mac. Similar to the test.py and test.app (ohhell.py and ohhell.app) runs on the VM Mac but same issue/error occurs with real macs. I've just included the simplest code snippet that I was able to google that reproduced the exact error message.
-john
Workaround Solution: Linking to a dynamic library on a Mac with full path and What path does #loader_path resolve to?. Using the '$ install_name_tool -change "#loader_path/.dylibs/libSDL-1.2.0.dylib" "/Applications/test.app/Contents/Frameworks/libSDL-1.2.0.dylib" base.so' resolved the Library not loaded: loader_path/.dylibs/libSDL-1.2.0.dylib errors. I assume this hard codes the path, but with my friends it's fine to tell them to make sure it resides in the /Applications folder.
However a secondary problem came up, 'pygame.error: File is not a Windows BMP file'. I used py2app, so the pygame delete and reinstall threads didn't seem like a feasible solution (pygame unnecesary w/py2app), so switching the images to uncompressed bitmap (256 colors) worked.
For those curious, I did try Pyinstaller for Mac but that presented a whole new set of problems.

ImportError: No module named google.appengine.ext

I have just got the release pipeline working with Google's push to deploy on App Engine.
I released that some of my unit tests were failing.
======================================================================
ERROR: Failure: ImportError (No module named google.appengine.ext)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/var/jenkins/workspace/deployment_5175583809994752_1410355681821/tests.py", line 9, in <module>
from cfc.search.nosqlhelper import set_meeting_date
File "/var/jenkins/workspace/deployment_5175583809994752_1410355681821/cfc/search/nosqlhelper.py", line 3, in <module>
from cfc.models.event import Event
File "/var/jenkins/workspace/deployment_5175583809994752_1410355681821/cfc/models/event.py", line 3, in <module>
from google.appengine.ext import ndb
ImportError: No module named google.appengine.ext
----------------------------------------------------------------------
Ran 1 test in 0.270s
I tried to run the following from python REPL in the VM containing Jenkins provisioned automatically via release pipeline in Google Developer Console.
from google.appengine.ext import ndb
I got the following error.
ImportError: No module named google.appengine.ext
I logged into the VM and noticed that the files are located at for instance:
var/lib/docker/aufs/mnt/bbc6deda44e4806c5c0e377df6f1109733e382e8531c1c9ed440084d8e98e3fe/google-cloud-sdk/platform/google_
appengine/google/appengine/ext/ndb/utils.py
How do I se the path universally in the VM ?

ImportError: No module named exceptions

i'm trying to install kitsune in the ubuntu terminal. I am not able to initialize the database. When i give the command ./manage.py syncdb --migrate , i get the following error
Error: Tried importing 'settings_local.py' and 'settings.py' but neither could be found (or they're throwing an ImportError). Please come back and try again later.Traceback (most recent call last):
File "./manage.py", line 30, in <module>
from kitsune import settings # Assumed to be in the same directory.
File "/home/user/kitsune/kitsune/settings.py", line 740, in <module>
import djcelery
File "/usr/local/lib/python2.7/dist-packages/djcelery/__init__.py", line 22, in <module>
from celery import current_app as celery # noqa
File "/usr/local/lib/python2.7/dist-packages/celery/five.py", line 307, in __getattr__
module = __import__(self._object_origins[name], None, None, [name])
File "/usr/local/lib/python2.7/dist-packages/celery/_state.py", line 20, in <module>
from celery.utils.threads import LocalStack
File "/usr/local/lib/python2.7/dist-packages/celery/utils/__init__.py", line 24, in
<module>
from celery.exceptions import CPendingDeprecationWarning, CDeprecationWarning
File "/usr/local/lib/python2.7/dist-packages/celery/exceptions.py", line 13, in <module>
from billiard.exceptions import ( # noqa
ImportError: No module named exceptions
I can't find the exceptions file in billiard. How do I fix this error?
I had this error with fabric. The error message was the same:
ImportError: No module named exceptions
It turned out to be my fabric was out of date. The error was resolved by upgrading fabric to the latest version (1.10) with:
$ sudo pip install fabric --upgrade
For your information, I am running Ubuntu 12.04 64-bit with Python 2.7.3
Exceptions should be a python file in a directory called billiard, for example, you create a file called exceptions.py and add the classes and methods that you need .. this can work around the problem.
You should follow kitsune installation process described in http://kitsune.readthedocs.org/en/latest/hacking_howto.html
There is a link to separate chapter on vendor-packages http://kitsune.readthedocs.org/en/latest/vendor.html#vendor-chapter. You should install all the vendor packages needed by kitsune including billiard and celery (your errors).