Hello I seem to be having trouble importing opencv on my deployed flask app on Heroku!
I've referred to similar posts such as this this
"ImportError: libSM.so.6: cannot open shared object file: No such file or directory " but can't seem to figure out the next steps on windows.
This is what I've done so far:
1. gone to Heroku -> App -> Settings -> Buildpacks -> added Python buildpack
2. Added a Aptfile.txt to my directory with the following packages on each line (read this somewhere not sure if it makes any sense)
libsm6 , libxrender1 ,libfontconfig1, libice6
Notes:
My openCV version-- opencv-python==3.4.3.18
I'm on windows so the sudo commands recommended in the other post answers dont work
Thanks in advance!
Use opencv-python-headless it's out of libSM6 dependency.
pip install opencv-python-headless
put this line in requirments.txt
opencv-python-headless==4.2.0.32
Related
I'm following this link Deploy to Production
After having deployed the whl file on the server, then installed it through pip, if I run pip list the package is present. But in a python console I can't import it.
Is there any reason ?
Following this tutorial packaging-projects, is it mandatory to upload the package as explained in the "Uploading the distribution archives" section ?
Thanks
I followed the link in my 1st post to create a package and I discovered the tree files was not correct. So I rearranged it and now it's fine
I have created flask server for my app, which I want to run on raspbian, on raspberry pi. When trying to start with flask run I've got info that libgcc_s.so.1 must be installed for pthread_cancel to work Aborted.
It looks like server has been started, but just after that it has been immediately stopped.
Tryed already to install libgcc-8-dev via apt-get install but no success.
Also found that library can be downloaded from here: https://packages.debian.org/cgi-bin/search_contents.pl?word=libgcc_s.so.1&searchmode=searchfiles&case=insensitive&version=stable&arch=i386
but I have no idea which one should I pick and how to install it properly (where to place it and how to link it)?
If you using something like openCV, then try to find out its headless version.
For me that problem was coming due to openCV. Then I install its headless version and it works fine.
Example:- sudo pip3 install opencv-python-headless
I found this script (tutorial) on GitHub (https://github.com/amyoshino/Dash_Tutorial_Series/blob/master/ex4.py) and I am trying to run in my local machine.
Unfortunately I am having and Error
I would really appreciate if anyone can help me to run this script.
Perhaps this is something easy but I am new in coding.
Thank you!
You probably just need to pip install the dash-core-components library!
Take a look at the Dash Installation documentation. It currently recommends running these commands:
pip install dash==0.38.0 # The core dash backend
pip install dash-html-components==0.13.5 # HTML components
pip install dash-core-components==0.43.1 # Supercharged components
pip install dash-table==3.5.0 # Interactive DataTable component (new!)
pip install dash-daq==0.1.0 # DAQ components (newly open-sourced!)
For more info on using pip to install Python packages, see: Installing Packages.
If you have run those commands, and Flask still throws that error, you may be having a path/environment issue, and should provide more info in your question about your Python setup.
Also, just to give you a sense of how to interpret this error message:
It's often easiest to start at the bottom and work your way up.
Here, the bottommost message is a FileNotFound error.
The program is looking for the file in your Python37/lib/site-packages folder. That tells you it's looking for a Python package. That is the directory to which Python packages get installed when you use a tool like pip.
We are receiving an error:
ImportError: No module named OAuth2Client
We have noticed scores of questions around this topic, many unanswered and at least one answer that describes the solution of copying over files from the Google App Engine SDK.
This approach, however, seems tedious because all the dependencies are unclear. If we copy over oauth2client then run, the next error is another module that is missing. Fix that, then another module is missing, etc., etc.
What is ironic is that we can see all the files and modules needed, listed from Google App Engine SDK right in PyCharm but they seem inaccessible to the script.
Is there no better way to pull in all the files that oauth2client needs for Python to work on App Engine?
I have this problem and solved by installing oauth2client with pip3:
pip3 install --upgrade oauth2client
As per the google-api-python documentation, try this
pip install --upgrade google-api-python-client oauth2client
The answer is to "vendor" in the file(s).
We found a quick way to solve this based on this documentation https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring
and this SO answer.
Create a new folder called "lib" in the same folder as your app.yaml file. (You can name it something else. Just use that name below.)
Create an empty file called appengine_config.py in the same folder as your app.yaml file
Add two lines to that appengine_config.py file:
from google.appengine.ext import vendor
vendor.add('lib')
From terminal, navigate to the directory which contains that file and execute the following command:
sudo pip install -t lib google-api-python-client
The import error will disappear and you will have all the sub-dependent modules as well.
Install WHL file
pip install oauth2client-4.1.3-py2.py3-none-any.whl
Run this
sudo python -m pip install oauth2client
I'm having problems pushing my Django app to Heroku. There seems to be an error with installing PIL. I've traditionally had a problem with PIL b/c I'm on Windows, so using pip install or easy_install doesn't work because it can't find "vcvarsall.bat"
So as a quick solution, I went to this site and ran teh .exe version of PIL to install. I had problems getting PIL onto my virtual environment, so when creating the virtual environment, I use this
virtualenv --system-site-packages venv
Now I'm using
git push heroku master
and I'm getting this back
Downloading/unpacking PIL==1.1.7 (from -r requirements.txt)
Could not find any downloads that satisfy the requirement PIL==1.1.7 (line 2))
...
Heroku push rejected, failed to compile Python/Django app
! [remote rejected] m aster -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com...'
How can I get past PIL?
I remember having this problem with pip finding PIL. Try using this line instead of PIL=1.1.7 in requirements.txt
http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
Also, you can always remove any module from requirements.txt and replace it with a copy of the module code in your Django root.
For example, with the PIL thing, you could have used that link to download the code, unzipped it, and pasted the PIL inside the resulting Imaging-1.1.7 folder into your Django project root. Would've worked just the same.
In general you want to avoid this if possible because it increases the size of your code deployment, but you can do it. It'll help you get around these issues so you can keep working for now at least.
One case where it might actually be preferable to include the code, rather than just using requirements.txt, is when you are working with a library or module that is poorly documented, and you want to have immediate and quick access to the source code from inside your editor. Probably wouldn't do it on a production server, but for dev that can be very convenient.