I am trying to deploy my pytorch application on zeet and my requirments.txt file contains this-
https://download.pytorch.org/whl/cpu/torch-1.3.1%2Bcpu-cp36-cp36m-linux_x86_64.whl
pickle-mixin
flask
simpletransformers
selenium
gunicorn
cloudpickle
When I try to build my application, I get the following error :
ERROR: torch-1.3.1+cpu-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
Build failed 😔
I tried using multiple different versions of the wheel, but none to be working, I even tried the windows build but that isnt working too and I tried all the solutions I could find online but none seem to be working.
EDIT : My build command is pip install -r requirements.txt and my python version is python 3.8
Any Help Would Be Appreciated!!
In your requirements, you have a wheel dedicated for python 3.6 but you are using python 3.8 - cp36-cp36m part of the name torch-1.3.1%2Bcpu-cp36-cp36m-linux_x86_64.whl, to be exact. You should provide only version of torch in your requirements.txt (recommended) and make sure that you are using the same version of Python when developing and deploying.
Name of the wheel is the convention that is described here. It encapsulates where the wheel can be used.
We are trying to import both MongoHook and GCSToLocalFilesystemOperator into our Airflow Project:
docs for MongoHook
docs for GCS Operator
...per this post, "Providers package is no longer included with Airflow, but you can separately install them with pip using the specific backport package"
I have had no luck with this. For our DockerFile, we started using this image from the puckel/docker-airflow repo on GitHub.
I've tried adding these two lines to our requirements.txt
apache-airflow-backport-providers-mongo
apache-airflow-backport-providers-google
...and I've tried adding these lines to our DockerFile:
&& pip install apache-airflow-backport-providers-mongo \
&& pip install apache-airflow-backport-providers-google \
...and we're getting the errors mentioned in the title. How can I install these into our docker image/container to use them in our Airflow project?
edit: checking quickly to see if the issue was that I simply wasn't rebuilding the image
edit2: rebuilding the image was needed; however, now we are receiving the error No module named 'airflow.utils.process_utils', which we get when importing GCSToLocalFilesystemOperator. Not sure why Airflow took providers out of the base install, this is very frustrating...
The answer to my original question was that I needed to rebuild the docker image (DOH).
The answer to my second question, I think, was that I was installing these packages twice (once with an explicit pip install in the Dockerfile, and once in the requirements.txt, which is also pip installed in the Dockerfile). When I removed the duplicate install, it seems to be working now.
I'm trying to deploy a Flak Restful API to azure.
I have set up continuous deployment with a Github repo.
The deployment is failing on one of the requirements.txt
returning the following error:
ValueError: ('Expected version spec in', 'azure-common ~=1.1.4', 'at', ' ~=1.1.4')
The application is running fine locally.
I'm new to the Azure platform and the config and deploy files are quite confusing I'm not sure if the problem is with these or the package in the virtual environment.
You need to update pip, as I guess the version is old enough to do not support the "~=" syntax in the setup.py of the packages you install.
For examples:
ValueError "Expected version spec" when installing local wheel via pip
How to fix error “Expected version spec in …” using pip install on Windows?
I'm trying to push an app to Heroku (first time) and it continues to fail when attempting to install on of the dependencies in the requirements.txt file.
The dependency is for the etsy-python library ("pip install etsy" fails).
Locally, I was able to get this to work by downloading and building the source. How can I get past this issue with Heroku?
requirements.txt:
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
etsy==0.3.1
geopy==0.94.2
httplib2==0.7.7
oauth2==1.5.211
python-etsy==0.1.2
python-twitter==0.8.4
requests==1.0.4
requests-oauth==0.4.1
simplejson==3.0.4
I was able to fix this by modifying the requirements.txt as follows:
Although the pypi package for Etsy is not working, the source is ok and builds without problems.
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
-e git+https://github.com/mcfunley/etsy-python.git#egg=etsy-python
geopy==0.94.2
httplib2==0.7.7
oauth2==1.5.211
python-etsy==0.1.2
-e git+https://github.com/bear/python-twitter.git#egg=python-twitter
requests==1.0.4
requests-oauth==0.4.1
simplejson==3.0.4
I'm getting this error when I try to install etsy locally:
ValueError: Invalid IPv6 URL
I'd say that the official py-etsy is outdated and broken, the Github repo was last updated a year ago: https://github.com/mcfunley/etsy-python. This library is more recent (5 months ago): https://github.com/priestc/python-etsy.
It's not on pypi, but clone it locally and include it in your project.
I'm unable to find a module in python ,though easy_install says its already installed.
Any idea how to resolve this isseue?
$ python -c "from flaskext.sqlalchemy import SQLAlchemy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named sqlalchemy
$ python -V
Python 2.7
$ sudo easy_install sqlalchemy
Searching for sqlalchemy
Best match: SQLAlchemy 0.7.7
Adding SQLAlchemy 0.7.7 to easy-install.pth file
Using /usr/lib/python2.7/site-packages
Processing dependencies for sqlalchemy
Finished processing dependencies for sqlalchemy
$ sudo pip install SQLAlchemy --upgrade Requirement already
up-to-date: SQLAlchemy in /usr/lib/python2.7/site-packages Cleaning
up...
Though pip says it's installed.But I can't find them in sys.path output.
$ sudo python -c "import sys;print sys.path" ['',
'/usr/lib/python2.7/site-packages/Flask_SQLAlchemy-0.15-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask-0.8-py2.7.egg',
'/usr/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg',
'/usr/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_WTF-0.5.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/WTForms-0.6.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_Mail-0.6.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/blinker-1.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/lamson-1.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/python_daemon-1.6-py2.7.egg',
'/usr/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/mock-0.8.0-py2.7.egg',
'/usr/lib/python2.7/site-packages/chardet-1.0.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/lockfile-0.9.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/Flask_FlatPages-0.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/Markdown-2.1.1-py2.7.egg',
'/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-i686.egg',
'/usr/lib/python2.7/site-packages/uWSGI-1.0.3-py2.7.egg',
'/usr/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-i686.egg',
'/usr/lib/python27.zip', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
'/usr/lib/python2.7/site-packages',
'/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
Did you install flask-sqlalchemy? It looks like you have SQLAlchemy installed but not the Flask extension. Try pip install Flask-SQLAlchemy in your project's virtualenv to install it from PyPI.
I just experienced the same problem. Apparently, there is a new distribution method, the extension code is no longer stored under flaskext.
Source: Flask CHANGELOG
This worked for me:
from flask_sqlalchemy import SQLAlchemy
Install Flask-SQLAlchemy with pip in your virtualenv:
pip install flask_sqlalchemy
Then import flask_sqlalchemy in your code:
from flask_sqlalchemy import SQLAlchemy
Okay,I have re-installed the package via pip even that didn't help. And then I rsync'ed the entire /usr/lib/python-2.7 directory from other working machine with similar configuration to
the current machine.It started working. I don't have any idea ,what was wrong with my setup. I see some difference "print sys.path" output earlier and now. but now my issue is resolved by this work around.
EDIT:Found the real solution for my setup. upgrading "sqlalchemy only doesn't solve the issue" I also need to upgrade flask-sqlalchemy that resolved the issue.
try this:
from flask.ext.sqlalchemy import SQLAlchemy
first install the library
pip install flask_sqlalchemy
after that
from flask_sqlalchemy import SQLAlchemy
put this in app.py file to get the access of database through SQLAlchemy
So here is an idea!
Since it seemed to work somewhere else.
install python-virtualenv
and optionally you can install virtualenv-wrapper (which is pretty cool to create projects and so on)
In each env, you might have different versions of eggs. In other word, you could have sqlalchemy 1 and sqlaclhemy 1.5 in two different envs and they won't conflict with each others. It seems that you have a problem with your currently installed eggs.
So here we go:
virtualenv --no-site-packages foo
source foo/bin/activate
The parameter --no-site-packages will create a virtualenv and not use the packages already installed on your computer. It's pretty much like a bare python install.
source foo/bin/activate loads the virtualenv.
It's not that really userfriendly. And that's why http://www.doughellmann.com/projects/virtualenvwrapper/ exists.
That said, you should see somthing like thant in your terminal "(foo)user#domain$:" once your virtualenv is activated. It means that you can go on!
Then you have to do.
python setup.py develop of your project. It should download and install dependencies of your project in the virtualenv located in foo. If you need to install anything else, please use pip or easy_install without using sudo. When using virtualenv, you almost never need to use sudo. Sudo will install package in your global python install while it's not required and not really desirable.
If something happens in your virtualenv, you can always delete it and create a new one. This is no big deal. No need to mess with anything. Doesn't work? start over, do pip install -U if needed, define the versions if needed and so on.
Last but not least, in the other answers, it seems that the import changed. If the new versions for flask-sqlalchemy is located somewhere else, you should update your import or install the version you used to use.
This code works perfectly:
import sqlalchemy
Maybe you installed the package in another version of the interpreter?
Also, like Shawley pointed out, you need to have the flask extension installed in order for it to be accessible.
I'm new comer, use python 3.8 and met the same problem. I installed with pip instead of pip3 because i thought the pip installer is the same for python2 and python3
so this is proper installation
pip3 install flask_sqlalchemy
Probably a stupid mistake; but, I experienced this problem and the issue turned out to be that "pip3 install sqlalchemy" installs libraries in user specific directories.
On my Linux machine, I was logged in as user1 executing a python script in user2's directory. I installed sqlalchemy as user1 and it by default placed the files in user1's directory. After installing sqlalchemy in user2's directory the problem went away.
Solution for me was to use:
from flask_sqlalchemy import SQLAlchemy
instead of
from flask.ext.sqlalchemy import SQLAlchemy
Very late to the party but hopefully this will help someone, was in the same situation for about a hour without any of the solutions mentioned above working. (On a Windows 10 machine).
In the Settings/Preferences dialog (Ctrl+Alt+S), from the side menu select Project: | Project Interpreter.
Check which packages you currently have installed (You need SQLAlchemy and Flask-SQLAlchemy). Double click on any package name, an 'Available Packages' menu will open.
Search for the missing package(s) and click install.
On Windows 10 # 2019
I faced the same problem. Turns out I forgot to install the following package:
pip install flask_sqlalchemy
After installing the package, everything worked perfectly. Hope, it helped some other noob like me.
I just experienced the same problem using the virtual environment.
For me installing the package using python from the venv worked:
.\venv\environment\Scripts\python.exe -m pip install flask-sqlalchemy
I am not sure if it is still relevant but try uninstalling sqlalchemy and then installing flask-sqlalchemy.
I guess if you have sqlalchemy, flask-sqlalchemy wont work.
Tried in Python 3.8
I also faced the same problem by a silly mistake. I have created a separate conda environment for flask from scratch. However, I tried to test the import of FlaskSQLAlchemy using IPython. Finally, I realized that it was the system-based python, not the one coming from conda env.
Always make sure that your sys.path contains the directory with flask_sqlalchemy.
I was using virtualenv, even if the flask_sqlalchemy was installed, I was still getting it, what I did was to deactivate virtual environment, delete the flask from global packages, and delete virtual environment, create fresh one, install requirements again. And it worked. Hope this helps.