ffmpeg still not working on heroku [discord.py] - python-3.x

I have tried all the methods I found on Internet. Here is the screenshot of my heroku builds:
Here are the modules I imported:
import asyncio
import functools
import itertools
import math
import random
import discord
import youtube_dl
from async_timeout import timeout
from discord.ext import commands
from dotenv import load_dotenv
import os
This is the requirements.txt file:
discord.py
PyNaCl==1.3.0
dnspython==1.16.0
async-timeout==3.0.1
python-dotenv
youtube_dl
And I get the following in the heroku logs:
2021-01-04T17:29:40.235769+00:00 app[worker.1]: ffmpeg: error while loading shared libraries: libvpx.so.5: cannot open shared object file: No such file or directory
Where is the problem

Related

ProQEXAFS: ImportError: cannot import name 'donaich' from 'lmfit.lineshapes'

I'm trying to get the ProXAS_v2.43 running for the evaluation of QEXAFS data. I installed the necessary packages the manual provided, but when I try to start the program I get the following error: ImportError: cannot import name 'donaich' from 'lmfit.lineshapes' (C:\Users\sq0346\Anaconda3\lib\site-packages\lmfit\lineshapes.py)
All packages required listed by conda search , should be present.
Mainly: Pandas, Scipy, Numpy-indexed, Xraylarch
Full error:
File
~\Anaconda3\envs\py38\Lib\site-packages\ProQEXAFS-GUI-master\ProXAS-2.43\ProXAS_v2.43.py:9
in
import tkinter, time, os, psutil, subprocess, sys, shutil, ast, codecs, re, larch, gc, peakutils.peak, itertools
File ~\Anaconda3\lib\site-packages\larch_init_.py:47 in
from . import builtins
File ~\Anaconda3\lib\site-packages\larch\builtins.py:21 in
from . import math
File ~\Anaconda3\lib\site-packages\larch\math_init_.py:4 in
from .utils import (linregress, realimag, as_ndarray,
File ~\Anaconda3\lib\site-packages\larch\math\utils.py:11 in
from .lineshapes import gaussian, lorentzian, voigt
File ~\Anaconda3\lib\site-packages\larch\math\lineshapes.py:16 in
from lmfit.lineshapes import (gaussian, lorentzian, voigt, pvoigt, moffat,
ImportError: cannot import name 'donaich' from 'lmfit.lineshapes'
(C:\Users\sq0346\Anaconda3\lib\site-packages\lmfit\lineshapes.py)
Updating XRaylrach to version 0.9.60 resolved it, but produced a new error:
File
~\Anaconda3\Lib\site-packages\ProQEXAFS-GUI-master\ProXAS-2.43\ProXAS_v2.43.py:9
in
import tkinter, time, os, psutil, subprocess, sys, shutil, ast, codecs, re, larch, gc, peakutils.peak, itertools
File ~\Anaconda3\lib\site-packages\larch_init_.py:48 in
from .version import date, version, release_version
ImportError: cannot import name 'release_version' from
'larch.version'
(C:\Users\sq0346\Anaconda3\lib\site-packages\larch\version.py)
Update xraylarch to its latest version. That will fix the misspelled import.

ModuleNotFoundError: No module named 'plotly' but it work from workspace

i have read all the posts related to this topic but i could not find the solution for my case.
In my ubuntu 20.04 I have installed plotly through the command:
pip3 install plotly
and if i launch python3 from command line and if i run:
import plotly.graph_objects as go
it works perfectly. But if i launch the same command from python script "test.py":
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import cgi
import cgitb
from datetime import date, timedelta
import datetime
import time
import numpy as np
import pandas as pd
import os
import calendar
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt
import plotly.graph_objects as go
it returns the error log:
ModuleNotFoundError: No module named 'plotly'
Anyone can help me? many thanks
Ok, i resolved the issue by installing the module as a root user because in this way Python will try to search for the module’s name in the root directory and not in the usr one
thank you everyone

How to handle importing a package import if it doesn't exist

import os
import re
import fitz # requires fitz, PyMuPDF
import pdfrw
import subprocess
import os.path
import sys
from PIL import Image
In my case fitz doesn't exist since it needs PyMuPDF. Is there a way to tell python to download dependencies and install them if they don't exist?
I am new to python and learning a lot. Apologizes in advance
Using Python 3.9.4
Platform that I am developing on is macOS but will be deploying on Windows
Editor is VSCode
Using try-catch to handle missing package
Ex:
import subprocess
def install(package):
subprocess.call(['pip', 'install', package])
try:
import fitz # requires fitz, PyMuPDF
except:
install('fitz')
A better practice would be to handle this before your code is executed. Example: using a requirements.txt file with all the dependent packages. And running the file before code execution.

Terminal Command to install imported module of a module

Lets assume I have a module say utility.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os
import random
import sys
import threading
import numpy as np
import tensorflow as tf
.....
I'd like to import this in my drive.py. I have it saved in my local directory and have in my first line
from . import utility
Is that possible, to issue a command in terminal to find the non-local modules ( tensorflow, numpy, etc), and install them using pip?
Any workaround would be appreciated.
CS
If you mean that you'd like the command to parse the file's imports and install missing dependancies automatically, then no it is not possible.
There are modules that are not imported with the pip's package name. For example the package facebook-sdk is imported as import facebook, making impossible to deduct the package name from the import.

TensorFlow Object Detection API - error = "This call to matplotlib.use() has no effect because the backend has already been[...]"

I'm trying to get the TensorFlow Object Detection API on Windows. I use Python 3.6.5 (64bits).
After running the following program:
Here is the part of the code which generates the warning:
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
import cv2
cap = cv2.VideoCapture("video.mp4")
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
I have this warning message :
Warning (from warnings module):
File "C:\Users\leahj\AppData\Local\Programs\Python\Python36\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\visualization_utils.py", line 25
import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statements
UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
Can anybody help me please ?
The line import matplotlib; matplotlib.use('Agg') is hardcoded in object_detection\utils\visualization_utils. I don't know the reason for this; usually a package should allow the user to choose the backend.
Unless there is any other problem arising from the use of object_detection the easiest is probably to live with this warning.

Resources