pythonanywhere import error "No module named flask.ext.security" - importerror

I installed flask-security like so:
pip3.5 install --user flask-security==1.7.5
And I can see it:
17:14 ~/mysite $ pip3.5 freeze | grep -i flask
Flask==0.11.1
Flask-Admin==1.4.2
Flask-Babel==0.11.1
Flask-Bcrypt==0.7.1
Flask-Bootstrap==3.3.6.0
Flask-HTTPAuth==3.1.2
Flask-Login==0.3.2
Flask-Mail==0.9.1
Flask-Principal==0.4.0
Flask-RESTful==0.3.5
Flask-Script==2.0.5
Flask-Security==1.7.5
Flask-SQLAlchemy==2.1
Flask-WTF==0.12
But log says:
Error running WSGI application
ImportError: No module named flask.ext.security
File "/var/www/joegillon_pythonanywhere_com_wsgi.py", line 16, in <module>
from app import app as application
File "/home/joegillon/mysite/app.py", line 3, in <module>
from flask.ext.security import Security, SQLAlchemyUserDatastore
Thoughts?

Is your web app configured to run in Python 3.5? Is it using a virtualenv?

Related

ERROR: gcloud failed to load: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'

I am trying to install gcloud CLI on macOS 64-bit(x86_64) by following these instructions: https://cloud.google.com/sdk/docs/install
When I run ./google-cloud-sdk/install.sh I get this error:
Welcome to the Google Cloud CLI!
Traceback (most recent call last):
File "/Users/benkula/./google-cloud-sdk/bin/bootstrapping/install.py", line 30, in <module>
from googlecloudsdk import gcloud_main
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py", line 37, in <module>
from googlecloudsdk.command_lib.util.apis import yaml_command_translator
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/apis/yaml_command_translator.py", line 39, in <module>
from googlecloudsdk.command_lib.iam import iam_util
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/command_lib/iam/iam_util.py", line 85, in <module>
binaryauthorization_message_v1alpha2 = core_apis.GetMessagesModule(
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/apis.py", line 339, in GetMessagesModule
return __import__(api_def.apitools.messages_full_modulepath,
ModuleNotFoundError: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'
./google-cloud-sdk/bin/gcloud init shows a similar error:
ERROR: gcloud failed to load: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.command_lib.util.apis import yaml_command_translator
from googlecloudsdk.command_lib.iam import iam_util
binaryauthorization_message_v1alpha2 = core_apis.GetMessagesModule(
return __import__(api_def.apitools.messages_full_modulepath,
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
/Applications/Xcode.app/Contents/Developer/usr/bin/python3
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk/
Python executable seems to be where it should be, so I don't think that's the problem. I can see it when I run ls /Applications/Xcode.app/Contents/Developer/usr/bin/.
python3 -V shows Python 3.8.9.
What can I do to install gcloud CLI successfully?
I used this command instead, and it worked for me:
curl https://sdk.cloud.google.com | bash
Found here: https://cloud.google.com/sdk/docs/downloads-interactive.

Import error: cannot import name 'label_cython'

I am a new user for Ubuntu16.04 as well as caffe.
Few days ago I was working with Intel Movidius with the ncappzoo thingy and it worked. Afterward I tried to download the toolkit and API to play with. As I was verifying the installation of the toolkit, I found that the function importing caffe can no longer work. It keeps giving me this error.
I tried googling but find no solution. The $PYTHONPATH was check and verified. I also reinstalled the scikit-image.
Here's the block of gibberish thingy it bounced back to me :
File "<stdin>", line 1, in <module>
File "/workspace/SDK/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/workspace/SDK/caffe/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/workspace/SDK/caffe/python/caffe/io.py", line 4, in <module>
from skimage.transform import resize
File "/usr/local/lib/python3.5/dist-packages/skimage/transform/__init__.py", line 1, in <module>
from .hough_transform import (hough_line, hough_line_peaks,
File "/usr/local/lib/python3.5/dist-packages/skimage/transform/hough_transform.py", line 3, in <module>
from .. import measure
File "/usr/local/lib/python3.5/dist-packages/skimage/measure/__init__.py", line 6, in <module>
from ._regionprops import regionprops, perimeter
File "/usr/local/lib/python3.5/dist-packages/skimage/measure/_regionprops.py", line 7, in <module>
from ._label import label
File "/usr/local/lib/python3.5/dist-packages/skimage/measure/_label.py", line 1, in <module>
from ._ccomp import label_cython as clabel
ImportError: cannot import name 'label_cython'
Any idea what went wrong?
We are able to make use of all the apps/networks available from ncappzoo without any issues.
Our configuration is as follows:
movidius#osboxes:~$ python --version
Python 2.7.12
movidius#osboxes:~$ echo $PYTHONPATH
:/opt/movidius/caffe/python
movidius#osboxes:~$ lscpu | grep "Model name"
Model name: Intel(R) Core(TM) i5-5300U CPU # 2.30GHz
movidius#osboxes:~$ lsb_release -a
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
Assuming that you have downloaded the ncsdk and then installed it. If not,
First we need to install 'ncsdk' which enable rapid prototyping, validation, and deployment of deep neural networks
please follow the links mentioned below to install ncsdk
(It includes software tools, API and examples)
https://developer.movidius.com/start
https://movidius.github.io/ncsdk/install.html
once the ncsdk installation is suceessfull, then you can make use of all the apps/networks available in ncappzoo.

pyql is not accessable after its installation from native for Ubuntu14.04 python2.7

After installing pyql from the package source(according to its own wizard described in this file) on Ubuntu 14.04 into /usr/local/lib/python2.7/dist-packages/ folder, all tests finished with success. This folder includes all additional installed packages, which are accessible, from the python using native import command.
But, this specific installation python don’t see, and I cannot import anything from it.
Have you any idea, what I need to define in addition?
Thanks,
Yigal B.
There are results of my sys.path:
import sys
print(sys.path)
['/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
python -c 'from quantlib.settings import __quantlib_version__; print __quantlib_version__'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named quantlib.settings
Can you post the content of you sys.path? And the output of
python -c 'from quantlib.settings import __quantlib_version__; print __quantlib_version__'

Trying to Install AWS CLI, stuck on a step

Im trying to install aws for the mac command line, I guess I dont understand what I need to do I installed the aws bundle with wget on the terminal, unziped it did everything, but when I need to configure my credentials nothing comes up when I put aws configure..
Here are the Instructions:
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html
Here is what is ouputed
an$ aws configuration
Traceback (most recent call last):
File "/usr/local/bin/aws", line 15, in <module>
import awscli.clidriver
File "/usr/local/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 31, in <module>
from awscli.help import ProviderHelpCommand
File "/usr/local/aws/lib/python2.7/site-packages/awscli/help.py", line 20, in <module>
from docutils.core import publish_string
File "/usr/local/aws/lib/python2.7/site-packages/docutils/core.py", line 20, in <module>
from docutils import frontend, io, utils, readers, writers
File "/usr/local/aws/lib/python2.7/site-packages/docutils/frontend.py", line 41, in <module>
import docutils.utils
File "/usr/local/aws/lib/python2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
import docutils.io
File "/usr/local/aws/lib/python2.7/site-packages/docutils/io.py", line 18, in <module>
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/usr/local/aws/lib/python2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/usr/local/aws/lib/python2.7/locale.py", line 511, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/aws/lib/python2.7/locale.py", line 443, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Any Ideas_?
try adding below lines to ~/.bash_profile:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Installing AWSCLI in Windows Machine
I had similar issue with Windows 10 (64 bit). Python 3.5 and Python 2.7 are installed in my PC. I was getting ImportError: No module named awscli.clidriver.
Then I added %USERPROFILE%\AppData\Roaming\Python\Python35\Scripts in environment path variable and removed Python 2.7 from the environment path variable. Now I can successfully use awscli.
I have created a step by step AWSCLI installation guide in this Github repository: https://github.com/arsho/installation/tree/master/awscli_installation.
I had to install EKS supported version and I ended up getting it to work with ignoring six:
$ pip3 install awscli --ignore-installed six
In my case nothing worked, untill i gave more permissions, i run aws command with a non root user
chown amzadm.root /usr/bin/aws
chown amzadm.root -R /usr/lib/python2.6/site-packages/
chown amzadm.root -R /usr/lib/python2.6/site-packages/awscli/
I fixed this by adding a line to the 'aws' script just before the import (line 19). So now the file reads:
sys.path.append('/Users/<username>/.local/lib/aws/lib/python2.7/site-packages/')
import awscli.clidriver
This work for me. In /.barshrc file
export AWS_DEFAULT_OUTPUT="json"

Eclipse using multiple Python interpreters with execnet

I'm using the execnet package to allow communication between Python scripts interpreted by different Python interpreters.
The following code (test_execnet.py):
import execnet
for python_version in ('python', 'python3'):
try:
gw = execnet.makegateway("popen//python="+python_version)
ch = gw.remote_exec('channel.send(1/3)')
res = ch.receive()
print(python_version, ': ', res, sep ="")
except:
print('problems with ', python_version)
Runs perfectly in the command-line Terminal, showing the following output:
$ python3 test_execnet.py
python: 0
python3: 0.333333333333
However, if I try to run the same code from within the Eclipse IDE, I get the following error:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 4, in <module>
File "<string>", line 2, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/execnet/gateway_base.py", line 8, in <module>
import sys, os, weakref
File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/os.py", line 380, in <module>
from _abcoll import MutableMapping # Can't use collections (bootstrap)
File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/_abcoll.py", line 54
class Hashable(metaclass=ABCMeta):
^
SyntaxError: invalid syntax
problems with python
problems with python3
NOTE:
Eclipse Version: 3.6.0
PyDev Interpreter configured for the project: python3
"Preferences/Interpreter - Python"'s Python Interpreters:
python (/usr/bin/python)
python3 (/Library/Frameworks/Python.Framework/Versions/3.1/Resources/Python.app/Contents/MacOS/Python
EDIT:
I write a code to show the os.environ like this:
for python_version in ('python', 'python3'):
try:
import os
for item in os.environ:
print(item, '= ', os.environ[item])
except:
print('problems with ', python_version)
I got the following outputs:
eclipse_output.txt
terminal_output.txt
A FileMerge comparison of the files can be found at eclipse_output.txt vs. terminal_output.pdf.
Any hints?
Thanks
seems like pydev does site-customizations and particularly modifies things for interactive/console usage (judging from a very quick skim of http://github.com/aptana/Pydev/blob/master/plugins/org.python.pydev/pysrc/pydev_sitecustomize/sitecustomize.py ). This is not useful or fitting for execnet-mediated processes.
You could try to "del os.environ['PYTHONPATH']" before you invoke execnet.makegateway, or, to be more careful, just delete the sitecustomize part of it.
hth,
holger
'import site' failed; use -v for traceback
I have seen that when python was unable to find its landmark. Which that indicates there is a PYTHONHOME problem.
Check out http://docs.python.org/using/cmdline.html#envvar-PYTHONHOME maybe eclipse is screwing your environment up.
Edit:
Looked at your env dumps, looks like eclipse is definitely messing with PYTHONPATH, which will cause your child python processes to not work correctly.
Basically what you have going on here is eclipse starts a python v2 instance with a PYTHONPATH pointing to the python v2 directories. Then you spawn a python v3 process which tries to load its landmark from the python v2 directories...
You need to find a way to have eclipse not mess with the PYTHONPATH. I am not sure what eclipse is trying to do by doing that, but it is certainly no friend when you want to spawn new python processes.