I've had trouble installing dlib, specifically the python verson, on my heroku app. I compiled everything fine on my local machine but when I push dlib.so and the build directory to heroku, whenever I try importing I get ImportError: libboost_python-py27.so.1.54.0: cannot open shared object file: No such file or directory. I made sure that dlib.so is in my LD_LIBRARY_PATH. What am I missing?
Dlib requires boost which can be hard to install successfully, as you have discovered.
The rule of thumb is to use Heroku Buildpacks to install such libraries.
To install Dlib, go to your Heroku dashboard, settings and click on Add Buildpack.
Depending on your python version you can use any of the two Buildpacks below;
For python 2.7.13
https://github.com/J-A-M-E-5/heroku14-buildpack-python-opencv-dlib.git
For python 3.6.1
https://github.com/J-A-M-E-5/heroku16-buildpack-python-opencv-dlib.git
Related
I am trying to make an application using python and gRPC as shown in this article - link
I am able to run the app successfully on my terminal but to run with a frontend I need to run it as a flask app, codebase. And I am doing all this in a virtual environment.
when I run my flask command FLASK_APP=marketplace.py flask run
This is the error I get
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/Users/alex/Desktop/coding/virt/lib/python3.8/site-packages/markupsafe/__init__.py)
On researching about this error I found this link - it basically tells us that currently I am using a higher version of MarkUpSafe library than required.
So I did pip freeze --local inside the virtualenv and got MarkUpSafe version to be MarkupSafe==2.1.0
I think if I change the version of this library from 2.1.0 to 2.0.1 then the flask app might run.
How can I change this library's version from the terminal?
PS: If you think changing the version of the library won't help in running the flask app, please let me know what else can I try in this.
If downgrading will solve the issue for you try the following code inside your virtual environment.
pip install MarkupSafe==2.0.1
I am deploying an application using heroku. In the python code I am using a NLP library called spacy.
I already deployed the app without any installed library, working perfectly.
I added the library in the requirements.txt of the app:
In my cmd, at the time of deployment I am using:
pip install -r requirements.txt
However, it runs an error:
intentionally avoided writing the code because of the sizeI also installed Microsoft C++ Build Tools and restarted cmd, but now it runs additional errors.
This is a screenshot of the files I am uploading:
Is there a way I can install the libraries remotely? I would like to avoid countless installations. Given the red code, am I doing something wrong or am I just missing packages?
(intentionally avoided writing the code because of the size)
That is a local error on your Windows machine, that should not occur on Heroku. The Heroku build pack should automatically install dependencies if you put requirements.txt at root. See https://devcenter.heroku.com/articles/python-pip
For fixing your local error, you need to install the C++ build tools as per the error message.
I am new to Django framework. I need to develop a chat function in my app. I am required to install uWSGI as websocket. As I am using Windows so I will install it using cygwin. I followed the instruction from some of the website and had successfully installed it ($ python3 setup.py install).
However, I couldn't find it in my python project. I have tried to install it in the python project site-packages and also the django python site-packages. Yet, I still couldn't find it in my installed packages. May I know what have done wrong or misunderstood the concept?
Cmd of cygwin
I am trying to develop a python package that is importable and also has entry_point to call from shell.
When trying to call the entry point I get:
pkg_resources.VersionConflict: (pysec-aws 0.1.dev1 (/Users/myuser/PycharmProjects/pysec-aws), Requirement.parse('pysec-aws==0.1.dev0'))
Essentially what I did before getting this error, is incrementing the version from 0.1.dev0 to 0.1.dev1 in setup.py, and running python setup.py sdist and then pip install -e .
What am I doing wrong? What is the proper way to install development versions of packages you are actively developing and bundling with setuptools?
The error is complaining that the application version does not match the version declared in setup.py. Try checking the __version__ set in your application.
You might consider using a single source for the version to avoid this problem. There are a number of different options outlined at https://packaging.python.org/guides/single-sourcing-package-version/. One simple technique, if there are not any external dependencies, is
import myapp
setup(
...
version=myapp.__version__
...
)
The only thing that fixed this issue was to create a new virtualenv.
Apparently my virtualenv/bin had compiled (.pyc) and non-compiled (.py) references to the old version for some reason - they were probably not upgraded / removed when I installed the new version.
Once I created a new virtualenv and re-installed required packages I was able to resolve this issue.
How do I install Python Flask without using pip?
I do not have pip, virtualenv nor easy_install.
The context of this question is that I am on a tightly controlled AIX computer. I cannot install any compiled code without going through several layers of management. However, I can install python modules.
Python 2.7 is installed.
I have some existing python code that generates a report.
I want to make that report available on a web service using Flask.
I am using bottle, but I am going to want to use https, and support for https under Flask seems much more straight forward.
I would like to put the flask library (and its dependencies) into my project much like bottle is placed into the project.
What I tried: I downloaded the flask tarball and looked at it. It had quite a bit of stuff that I did not know what to do with. For instance, there was a makefile.
Yes you can but it will be little difficult.
get flask source code from this and Extract it.
https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz
There will be a file with name setup.py in that you can see dependencies , I listed them here. download those packages and install them first.
'Werkzeug>=0.7', https://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-0.10.4.tar.gz
'Jinja2>=2.4', https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
'itsdangerous>=0.21' , https://pypi.python.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz
MarkupSafe==0.23 ,https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz
download all those from pypi and install using python setup.py install for every module.
Now you can install flask by running python setup.py install in the flask source code folder.
Now you system is acquainted with flask.
:-)
On Debian-based systems you can install with Apt.
For Python 3.x use:
sudo apt-get install python3-flask
For Python 2.x use:
sudo apt-get install python-flask
One way to go around the problem is to use another machine with pip installed on which you can download all dependencies.
On this first machine you would then run these commands below
$ mkdir myapp
$ pip install flask --target ./myapp
Then transfer the myapp folder to the AIX machine.
Then develop your program inside the myapp folder as this is the only place flask will be accessible. Unless you setup the environment path accordingly.
You can try with wheel pacakges .