ImportError: cannot import name 'create_app' - flask-sqlalchemy

I am getting below error in centos 7 when run gunicorn where i dont see any problem for windows,
from platform import create_app
ImportError: cannot import name 'create_app'
from platform import create_app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
Using:
Python 3.6.5
Flask 1.1.1
Werkzeug 0.15.5
gunicorn (version 19.9.0)

Related

ModuleNotFoundError: No module named 'geo'

I am using the following libraries:
import pandas as pd
import numpy as np
import googlemaps
from geopy.geocoders import Nominatim
import sys
from dateutil import parser
from geo import *
import re
I already installed in the prompt:
pip install GoogleMaps
pip install geopy
pip install geopandas
conda install -c conda-forge geopandas
However, I am still having the following error:
> ModuleNotFoundError Traceback (most recent call
> last) <ipython-input-1-456abdb5bc33> in <module>
> 5 import sys
> 6 from dateutil import parser
> ----> 7 from geo import *
> 8 import re
ModuleNotFoundError: No module named 'geo'
I really appreciate any help to solve this error
Have you tried
pip install geo-py
?
https://pypi.org/project/geo-py/

How to import tensorflow in google colab

Google Colab seems throwing the below error while trying to import Tensorflow, while it was working okey couple of weeks ago
%tensorflow_version 1.x
import sys
import codecs
import tensorflow as tf
from tqdm import tqdm
from chardet import detect
from keras_radam import RAdam
from keras import backend as K
from keras_bert import load_trained_model_from_checkpoint
import os
import numpy as np
import pandas as pd
/usr/local/lib/python3.6/dist-packages/keras/__init__.py in <module>()
4 except ImportError:
5 raise ImportError(
----> 6 'Keras requires TensorFlow 2.2 or higher. '
7 'Install TensorFlow via `pip install tensorflow`')
8
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
NOTE : am running on TPU and alreadt tried !pip install tensorflow but reuirements are satisfaied
This should suffice i feel
%tensorflow_version 2.x
import tensorflow as tf
This has always worked for me in Google Colab. I think the issue is that you are giving %tensorflow_version as 1.x please try changing that to 2.x
I had to re-order my imports like below and used keras version 2.3.0
%tensorflow_version 1.x
import sys
import codecs
import tensorflow as tf
!pip install keras-bert
!pip install keras-rectified-adam
!pip install keras==2.3.0
from tqdm import tqdm
from chardet import detect
from keras_radam import RAdam
from keras import backend as K
from keras_bert import load_trained_model_from_checkpoint
import os
import numpy as np
import pandas as pd

ImportError: import tensorflow_model_analysis as tfma [ PYTHON on datalab]

I would like to add model analysis to my model but was unable to import the libraries:
I am using datalab environment.
import tensorflow as tf
!pip install tensorflow_model_analysis
import tensorflow_model_analysis as tfma
The error is:
ImportErrorTraceback (most recent call last)
<ipython-input-6-f85e4d8fbd99> in <module>()
----> 1 import tensorflow_model_analysis as tfma
/usr/local/envs/py2env/lib/python2.7/site-packages/tensorflow_model_analysis/__init__.py in <module>()
15
16
---> 17 from tensorflow_model_analysis import view
18 from tensorflow_model_analysis.api import tfma_unit as test
19 from tensorflow_model_analysis.api.model_eval_lib import * # pylint: disable=wildcard-import
ImportError: cannot import name view
Please advice what will be the right way to import the library.
Thanks,
eilalan
Working for me now with the following installation:
python 2.7 - to support apache beam
pip install pip==9.0.3 # I am not sure what is the reason, but essential for apache beam pipelines execution
pip install --upgrade tensorflow
pip install tensorflow-model-analysis
import tensorflow_model_analysis as tfma

GCP wont work after upgrading to OSX Mojave

After I upgraded to OSX Mojave (Developer beta 2) I get an error every time I use GCP and also at reinstalling it.
ERROR: gcloud failed to load: No module named zlib
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import display
from googlecloudsdk.calliope import display_taps
from googlecloudsdk.core.resource import resource_printer_base
from googlecloudsdk.core.resource import resource_projector
from apitools.base.py import encoding as protorpc_encoding
from apitools.base.py.base_api import *
from apitools.base.py import http_wrapper
import httplib2
from httplib2.python2.httplib2 import *
import gzip
import zlib
I have tried to reinstall python as well as zlib through brew; but it did not work.
Per page 3 of the release notes: https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf, you first need to install the package at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Then you need to reinstall python2 from brew:
brew reinstall python2
After that you can brew cask install google-cloud-sdk and it will work

Unable to import distributions module from Tensorflow (Dockerized)

I'm running the official TF docker repo using the Jupyter UI on localhost. It seems that TF is working in general, as I am able to import it, but when trying to import the distributions module I get an error:
print tf.__version__
import tf.distributions as dist
1.8.0
ImportErrorTraceback (most recent call last)
<ipython-input-3-4d440943cb46> in <module>()
1 print tf.__version__
----> 2 import tf.distributions as dist
ImportError: No module named tf.distributions
Try this
import tensorflow as tf
from tensorflow import distributions as dist
I don't think you can use import aliases for other import statements in python. I'm not too sure about this, but I think that's the problem.
FYI, I tested this on Python 3.5.2 and Tensorflow 1.8.0