Heroku Error: ModuleNotFoundError: No module named 'keras' - heroku

When I deploy my app in heroku there's not any trouble, but when I try to run the app I get the error:
ModuleNotFoundError: No module named 'keras'
I use pip and I'm working in virtualenv.
absl-py==0.7.0 asn1crypto==0.24.0 astor==0.7.1 attrs==18.2.0
backcall==0.1.0 bleach==3.1.0 certifi==2019.3.9 cffi==1.11.5
chardet==3.0.4 Click==7.0 cryptography==2.4.2 cycler==0.10.0
Cython==0.29.6 decorator==4.3.0 entrypoints==0.3
fix-yahoo-finance==0.0.22 Flask==1.0.2 Flask-WTF==0.14.2 gast==0.2.2
graphviz==0.10.1 grpcio==1.16.1 h5py==2.9.0 idna==2.8
ipykernel==5.1.0 ipython==7.4.0 ipython-genutils==0.2.0
ipywidgets==7.4.2 itsdangerous==1.1.0 jedi==0.13.2 Jinja2==2.10
jsonschema==3.0.0a3 jupyter==1.0.0 jupyter-client==5.2.4
jupyter-console==6.0.0 jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1 jupyter-core==4.4.0
jupyter-highlight-selected-word==0.2.0 jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1 jupyterlab==0.35.3
jupyterlab-server==0.2.0 Keras==2.1.6 Keras-Applications==1.0.6
Keras-Preprocessing==1.0.5 kiwisolver==1.0.1 lxml==4.3.0
Markdown==3.0.1 MarkupSafe==1.1.0 matplotlib==3.0.2 mistune==0.8.4
mkl-fft==1.0.10 mkl-random==1.0.2 multitasking==0.0.7
nbconvert==5.3.1 nbformat==4.4.0 notebook==5.7.4 numpy==1.15.4
pandas==0.23.4 pandas-datareader==0.7.0 pandocfilters==1.4.2
parso==0.3.1 patsy==0.5.1 pexpect==4.6.0 pickleshare==0.7.5
pipenv==2018.11.26 plotly==3.5.0 pmdarima==1.1.0
prometheus-client==0.5.0 prompt-toolkit==2.0.7 protobuf==3.6.1
ptyprocess==0.6.0 pycparser==2.19 Pygments==2.3.1 pyOpenSSL==18.0.0
pyparsing==2.3.1 pyrsistent==0.14.9 PySocks==1.6.8
python-dateutil==2.7.5 pytz==2018.9 PyYAML==3.13 pyzmq==17.1.2
qtconsole==4.4.3 requests==2.21.0 retrying==1.3.3
scikit-learn==0.19.2 scipy==1.1.0 seaborn==0.9.0 Send2Trash==1.5.0
simplejson==3.16.0 six==1.12.0 statsmodels==0.9.0 ta==0.3.8
tensorboard==1.12.2 tensorflow==1.12.0 termcolor==1.1.0
terminado==0.8.1 testpath==0.4.2 tornado==5.1.1 traitlets==4.3.2
urllib3==1.24.1 wcwidth==0.1.7 webencodings==0.5.1 Werkzeug==0.14.1
widgetsnbextension==3.4.2 wrapt==1.11.0 WTForms==2.2.1 xgboost==0.81
Heroku Error: ModuleNotFoundError: No module named 'keras'

Related

I am trying to use the discord.py integration but I am getting an error every time

I have tried many different ways of trying to get the discord_slash import to work but I keep getting the same error over and over again
The error in my code says:
ModuleNotFoundError: No module named 'discord_slash'
This is my code:
import discord
from discord_slash.utils.manage_components import create_select, create_select_option, create_actionrow
select = create_select(
options=[
create_select_option("Test 1", value="Test 1", emoji="😀"),
create_select_option("Test 2", value="Test 2", emoji="😃"),
create_select_option("Test 3", value="test 3", emoji="😄")
],
placeholder="Choose your option",
min_values=1,
max_values=2
)
action_row = create_actionrow(select)
client = discord.Client()
#client.event
async def on_message(message):
if message.content.lower().startswith():
await ctx.send(components=[action_row])
Have you downloaded the discord_slash library ? If not run this line in terminal:
pip install -U discord-py-slash-command
If this still doesn't work make sure pip is installing the module in the correct directory for your chosen IDE to access.
Here is more info on that:
Pip Install not installing into correct directory?.

Anaconda, unable to install last version of asammdf

I installed recently Anaconda and need to use asammdf.
Standard was 5.8.0 installed, I need 5.21.0.
Running the installer from https://anaconda.org/conda-forge/asammdf did not update the package.
Then I installed a new environnement and asammdf and dependencies from scratch. So I could get 5.19.16 installed, but still not the latest.
Running
conda install -c conda-forge asammdf
from the console returns me the following message:
All requested packages already installed.
But it's not true…
What am I doing wrong ?
In advance thank you for your help.
Here is result of pip freeze on os:
aenum==2.2.3
alabaster==0.7.12
anaconda-client==1.7.2
anaconda-navigator==1.9.12
anaconda-project==0.8.3
applaunchservices==0.2.1
appnope==0.1.0
appscript # file:///opt/concourse/worker/volumes/live/aa928f42-721f-468a-5637-76f7349085f8/volume/appscript_1594840167539/work
argh==0.26.2
argon2-cffi # file:///opt/concourse/worker/volumes/live/c4db8eed-7de0-4d68-400c-2ea7e21d3750/volume/argon2-cffi_1596828478065/work
asammdf==5.19.16
asn1crypto # file:///tmp/build/80754af9/asn1crypto_1596577642040/work
astroid # file:///opt/concourse/worker/volumes/live/b22b518b-f584-4586-5ee9-55bfa4fca96e/volume/astroid_1592495912194/work
astropy==4.0.1.post1
atomicwrites==1.4.0
attrs==19.3.0
autopep8 # file:///tmp/build/80754af9/autopep8_1596578164842/work
Babel==2.8.0
backcall==0.2.0
backports.functools-lru-cache==1.6.1
backports.shutil-get-terminal-size==1.0.0
backports.tempfile==1.0
backports.weakref==1.0.post1
beautifulsoup4==4.9.1
bitarray # file:///opt/concourse/worker/volumes/live/c6d4988e-d50d-45f2-57a8-6d845ccc7c1b/volume/bitarray_1597678765739/work
bitstruct==8.10.0
bkcharts==0.2
bleach==3.1.5
bokeh # file:///opt/concourse/worker/volumes/live/4dce277b-856c-418f-50a0-50eb18d48058/volume/bokeh_1593187628308/work
boto==2.49.0
Bottleneck==1.3.2
brotlipy==0.7.0
canmatrix==0+unknown
cantools==34.0.0
cchardet==2.1.4
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
click==7.1.2
cloudpickle # file:///tmp/build/80754af9/cloudpickle_1594141588948/work
clyent==1.2.2
colorama==0.4.3
conda==4.8.4
conda-build==3.18.11
conda-package-handling==1.7.0
conda-verify==3.4.2
contextlib2==0.6.0.post1
cryptography==2.9.2
cycler==0.10.0
Cython # file:///opt/concourse/worker/volumes/live/a8b919bf-06b6-4be5-60d8-71d16518c421/volume/cython_1594833990717/work
cytoolz==0.10.1
dask==2.11.0
decorator==4.4.2
defusedxml==0.6.0
diff-match-patch # file:///tmp/build/80754af9/diff-match-patch_1594828741838/work
diskcache==4.1.0
distributed # file:///opt/concourse/worker/volumes/live/0a62cbc9-591a-4d87-7487-c239010d690a/volume/distributed_1594750312816/work
docutils==0.16
entrypoints==0.3
et-xmlfile==1.0.1
fastcache==1.1.0
filelock==3.0.12
flake8==3.8.3
Flask==1.1.2
fsspec==0.7.4
future==0.18.2
gevent # file:///opt/concourse/worker/volumes/live/272caec7-c260-4aae-6e70-894795c188a9/volume/gevent_1593009579780/work
glob2==0.7
gmpy2==2.0.8
greenlet==0.4.16
h5py==2.10.0
HeapDict==1.0.1
html5lib # file:///tmp/build/80754af9/html5lib_1593446221756/work
idna # file:///tmp/build/80754af9/idna_1593446292537/work
imageio # file:///tmp/build/80754af9/imageio_1594161405741/work
imagesize==1.2.0
importlib-metadata # file:///opt/concourse/worker/volumes/live/84197498-cbc0-4436-7ce0-03c4490b7a28/volume/importlib-metadata_1593446431408/work
iniconfig # file:///tmp/build/80754af9/iniconfig_1596827328212/work
intervaltree # file:///tmp/build/80754af9/intervaltree_1594361675072/work
ipykernel # file:///opt/concourse/worker/volumes/live/73e8766c-12c3-4f76-62a6-3dea9a7da5b7/volume/ipykernel_1596206701501/work/dist/ipykernel-5.3.4-py3-none-any.whl
ipython # file:///opt/concourse/worker/volumes/live/7ea70a71-5624-4799-50b3-3b90e07922f3/volume/ipython_1593447385860/work
ipython-genutils==0.2.0
ipywidgets==7.5.1
isort==4.3.21
itsdangerous==1.1.0
jdcal==1.4.1
jedi==0.14.1
Jinja2==2.11.2
joblib # file:///tmp/build/80754af9/joblib_1594236160679/work
json5==0.9.5
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client # file:///tmp/build/80754af9/jupyter_client_1594826976318/work
jupyter-console==6.1.0
jupyter-core==4.6.3
jupyterlab==2.1.5
jupyterlab-server # file:///tmp/build/80754af9/jupyterlab_server_1594164409481/work
keyring # file:///opt/concourse/worker/volumes/live/9f4aa601-8a6f-42a7-4180-58f1f835bf99/volume/keyring_1593109772323/work
kiwisolver==1.2.0
lazy-object-proxy==1.4.3
libarchive-c==2.9
llvmlite==0.33.0+1.g022ab0f
locket==0.2.0
lxml # file:///opt/concourse/worker/volumes/live/0dfefafa-9e58-455e-535c-75e73a127cfd/volume/lxml_1594826856790/work
lz4 # file:///opt/concourse/worker/volumes/live/70907f0c-3bc5-43d1-77d3-0e51df042440/volume/lz4_1595342290641/work
MarkupSafe==1.1.1
matplotlib # file:///opt/concourse/worker/volumes/live/415740a8-e00a-411a-7129-aa05c3842a43/volume/matplotlib-base_1597876353062/work
mccabe==0.6.1
mistune==0.8.4
mkl-fft==1.1.0
mkl-random==1.1.1
mkl-service==2.3.0
mock==4.0.2
more-itertools==8.4.0
mpmath==1.1.0
msgpack==1.0.0
multipledispatch==0.6.0
natsort==7.0.1
navigator-updater==0.2.1
nbconvert==5.6.1
nbformat==5.0.7
networkx # file:///tmp/build/80754af9/networkx_1594377231366/work
nltk # file:///tmp/build/80754af9/nltk_1592496090529/work
nose==1.3.7
notebook # file:///opt/concourse/worker/volumes/live/4befab56-a4d7-490d-6835-d3c47a466e66/volume/notebook_1596838669687/work
numba==0.50.1
numexpr==2.7.1
numpy # file:///opt/concourse/worker/volumes/live/40d975a3-7e82-44c8-53df-feccdbce8b96/volume/numpy_and_numpy_base_1596233859108/work
numpydoc # file:///tmp/build/80754af9/numpydoc_1594166760263/work
olefile==0.46
openpyxl # file:///tmp/build/80754af9/openpyxl_1594167385094/work
packaging==20.4
pandas # file:///opt/concourse/worker/volumes/live/8386378f-860c-458e-6b3d-426dc3c0374b/volume/pandas_1596825862710/work
pandocfilters==1.4.2
parso==0.5.2
partd==1.1.0
path==13.1.0
pathlib2==2.3.5
pathtools==0.1.2
patsy==0.5.1
pep8==1.7.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow # file:///opt/concourse/worker/volumes/live/05b3bc99-cf9f-44f2-42cf-267ed3a55922/volume/pillow_1594307311725/work
pkginfo==1.5.0.1
pluggy==0.13.1
ply==3.11
prometheus-client==0.8.0
prompt-toolkit==3.0.5
psutil==5.7.0
ptyprocess==0.6.0
py # file:///tmp/build/80754af9/py_1593446248552/work
pycodestyle==2.6.0
pycosat==0.6.3
pycparser # file:///tmp/build/80754af9/pycparser_1594388511720/work
pycrypto==2.6.1
pycurl==7.43.0.5
pydocstyle # file:///tmp/build/80754af9/pydocstyle_1592848020240/work
pyflakes==2.2.0
Pygments==2.6.1
pylint # file:///opt/concourse/worker/volumes/live/42ede439-2571-4cb2-513c-394625d2381b/volume/pylint_1592496039330/work
pyodbc===4.0.0-unsupported
pyOpenSSL # file:///tmp/build/80754af9/pyopenssl_1594392929924/work
pyparsing==2.4.7
pyrsistent==0.16.0
PySocks==1.7.1
pytest==6.0.1
python-can==3.3.3
python-dateutil==2.8.1
python-jsonrpc-server==0.3.4
python-language-server==0.31.7
pytz==2020.1
PyWavelets==1.1.1
PyYAML==5.3.1
pyzmq==19.0.1
QDarkStyle==2.8.1
QtAwesome==0.7.2
qtconsole # file:///tmp/build/80754af9/qtconsole_1592848611704/work
QtPy==1.9.0
regex # file:///opt/concourse/worker/volumes/live/b2afe0bb-a615-4845-4439-4b4e32958733/volume/regex_1596829787473/work
requests # file:///tmp/build/80754af9/requests_1592841827918/work
rope==0.17.0
Rtree==0.9.4
ruamel-yaml==0.15.87
scikit-image==0.16.2
scikit-learn # file:///opt/concourse/worker/volumes/live/eab838ab-55a5-40d0-5cbd-f1854d35aa9d/volume/scikit-learn_1592503039331/work
scipy # file:///opt/concourse/worker/volumes/live/14622691-c324-4e90-5a99-87aced91207b/volume/scipy_1592930535761/work
seaborn==0.10.1
Send2Trash==1.5.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.15.0
snowballstemmer==2.0.0
sortedcollections==1.2.1
sortedcontainers==2.2.2
soupsieve==2.0.1
Sphinx # file:///tmp/build/80754af9/sphinx_1597428793432/work
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sphinxcontrib-websupport # file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work
spyder==4.0.1
spyder-kernels==1.8.1
SQLAlchemy # file:///opt/concourse/worker/volumes/live/701c360b-024a-4c1d-72ce-e82e6bfb4620/volume/sqlalchemy_1593446320654/work
statsmodels==0.11.1
sympy # file:///opt/concourse/worker/volumes/live/794b4585-6914-43d5-6dd6-9c84fb6d47ed/volume/sympy_1594236608820/work
tables==3.6.1
tblib==1.6.0
terminado==0.8.3
testpath==0.4.4
textparser==0.23.0
threadpoolctl # file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl
toml # file:///tmp/build/80754af9/toml_1592853716807/work
toolz==0.10.0
tornado==6.0.4
tqdm # file:///tmp/build/80754af9/tqdm_1596810128862/work
traitlets==4.3.3
typed-ast==1.4.1
typing-extensions # file:///tmp/build/80754af9/typing_extensions_1592847887441/work
ujson # file:///opt/concourse/worker/volumes/live/b0b42640-6047-4d8e-4be3-9ef9916c7708/volume/ujson_1592441805801/work
unicodecsv==0.14.1
urllib3 # file:///tmp/build/80754af9/urllib3_1597086586889/work
watchdog # file:///opt/concourse/worker/volumes/live/fe5d349c-1d61-4feb-6b8a-cbc5288b20a8/volume/watchdog_1593447347275/work
wcwidth # file:///tmp/build/80754af9/wcwidth_1593447189090/work
webencodings==0.5.1
Werkzeug==1.0.1
widgetsnbextension==3.5.1
wrapt==1.11.2
wurlitzer # file:///opt/concourse/worker/volumes/live/59acb45c-07e7-4304-57af-e84f3889d3ef/volume/wurlitzer_1594753863419/work
xlrd==1.2.0
XlsxWriter==1.2.9
xlwings==0.19.5
xlwt==1.3.0
xmltodict==0.12.0
yapf # file:///tmp/build/80754af9/yapf_1593528177422/work
zict==2.0.0
zipp==3.1.0
zope.event==4.4
zope.interface==4.7.1
Running:
conda create -n test-env python=3 asammdf
returns:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- asammdf
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.

Pyppeteer: Browser closed unexpectedly in AWS Lambda

I'm running into this error in AWS Lambda. It appears that the devtools websocket is not up. Not sure how to fix it. Any ideas? Thanks for your time.
Exception originated from get_ws_endpoint() due to websocket response timeout https://github.com/pyppeteer/pyppeteer/blob/ad3a0a7da221a04425cbf0cc92e50e93883b077b/pyppeteer/launcher.py#L225
Lambda code:
import os
import json
import asyncio
import logging
import boto3
import pyppeteer
from pyppeteer import launch
logger = logging.getLogger()
logger.setLevel(logging.INFO)
pyppeteer.DEBUG = True # print suppressed errors as error log
def lambda_handler(event, context):
asyncio.get_event_loop().run_until_complete(main())
async def main():
browser = await launch({
'headless': True,
'args': [
'--no-sandbox'
]
})
page = await browser.newPage()
await page.goto('http://example.com')
await page.screenshot({'path': '/tmp/example.png'})
await browser.close()
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Exception:
Response:
{
"errorMessage": "Browser closed unexpectedly:\n",
"errorType": "BrowserError",
"stackTrace": [
" File \"/var/task/lambda_handler.py\", line 23, in lambda_handler\n asyncio.get_event_loop().run_until_complete(main())\n",
" File \"/var/lang/lib/python3.8/asyncio/base_events.py\", line 616, in run_until_complete\n return future.result()\n",
" File \"/var/task/lambda_handler.py\", line 72, in main\n browser = await launch({\n",
" File \"/opt/python/pyppeteer/launcher.py\", line 307, in launch\n return await Launcher(options, **kwargs).launch()\n",
" File \"/opt/python/pyppeteer/launcher.py\", line 168, in launch\n self.browserWSEndpoint = get_ws_endpoint(self.url)\n",
" File \"/opt/python/pyppeteer/launcher.py\", line 227, in get_ws_endpoint\n raise BrowserError('Browser closed unexpectedly:\\n')\n"
]
}
Request ID:
"06be0620-8b5c-4600-a76e-bc785210244e"
Function Logs:
START RequestId: 06be0620-8b5c-4600-a76e-bc785210244e Version: $LATEST
---- files in /tmp ----
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
0%| | 0/108773488 [00:00<?, ?it/s]
11%|█▏ | 12267520/108773488 [00:00<00:00, 122665958.31it/s]
27%|██▋ | 29470720/108773488 [00:00<00:00, 134220418.14it/s]
42%|████▏ | 46172160/108773488 [00:00<00:00, 142570388.86it/s]
58%|█████▊ | 62607360/108773488 [00:00<00:00, 148471487.93it/s]
73%|███████▎ | 79626240/108773488 [00:00<00:00, 154371569.93it/s]
88%|████████▊ | 95754240/108773488 [00:00<00:00, 156353972.12it/s]
100%|██████████| 108773488/108773488 [00:00<00:00, 161750092.47it/s]
[W:pyppeteer.chromium_downloader]
chromium download done.
[W:pyppeteer.chromium_downloader] chromium extracted to: /tmp/local-chromium/588429
-----
/tmp/local-chromium/588429/chrome-linux/chrome
[ERROR] BrowserError: Browser closed unexpectedly:
Traceback (most recent call last):
  File "/var/task/lambda_handler.py", line 23, in lambda_handler
    asyncio.get_event_loop().run_until_complete(main())
  File "/var/lang/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/var/task/lambda_handler.py", line 72, in main
    browser = await launch({
  File "/opt/python/pyppeteer/launcher.py", line 307, in launch
    return await Launcher(options, **kwargs).launch()
  File "/opt/python/pyppeteer/launcher.py", line 168, in launch
    self.browserWSEndpoint = get_ws_endpoint(self.url)
  File "/opt/python/pyppeteer/launcher.py", line 227, in get_ws_endpoint
    raise BrowserError('Browser closed unexpectedly:\n')END RequestId: 06be0620-8b5c-4600-a76e-bc785210244e
REPORT RequestId: 06be0620-8b5c-4600-a76e-bc785210244e Duration: 33370.61 ms Billed Duration: 33400 ms Memory Size: 3008 MB Max Memory Used: 481 MB Init Duration: 445.58 ms
I think BrowserError: Browser closed unexpectedly is just the error you get when Chrome crashes for whatever reason. It would be nice if pyppeteer printed out the error, but it doesn't.
To track things down, it's helpful to pull up the exact command that pyppeteer runs. You can do that this way:
>>> from pyppeteer.launcher import Launcher
>>> ' '.join(Launcher().cmd)
/root/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome --disable-background-networking --disable-background-timer-throttling --disable-breakpad --disable-browser-side-navigation --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=site-per-process --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --headless --hide-scrollbars --mute-audio about:blank --no-sandbox --remote-debugging-port=33423 --user-data-dir=/root/.local/share/pyppeteer/.dev_profile/tmp5cj60q6q
When I ran that command in my Docker image, I got the following error:
$ /root/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome # ...
/root/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome:
error while loading shared libraries:
libnss3.so: cannot open shared object file: No such file or directory
So I installed libnss3:
apt-get install -y libnss3
Then I ran the command again and got a different error:
$ /root/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome # ...
[0609/190651.188666:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
So I needed to change my launch command to something like:
browser = await launch(headless=True, args=['--no-sandbox'])
and now it works!
Answering my own question.
Finally I was able to run Pyppeteer(v0.2.2) with Python 3.6 and 3.7 (not 3.8) after I bundled chromium binary in a lambda layer.
So in summary, it appears to work only when its configured to run with user provided chromium executable path and not with automatically downloaded chrome. Probably some race condition or something.
Got Chromium from https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-41/stable-headless-chromium-amazonlinux-2017-03.zip
browser = await launch(
headless=True,
executablePath='/opt/python/headless-chromium',
args=[
'--no-sandbox',
'--single-process',
'--disable-dev-shm-usage',
'--disable-gpu',
'--no-zygote'
])
Issue posted on repo https://github.com/pyppeteer/pyppeteer/issues/108
I have been trying to run pyppeteer in a Docker container and ran into the same issue.
Finally managed to fix it thanks to this comment: https://github.com/miyakogi/pyppeteer/issues/14#issuecomment-348825238
I installed Chrome manually through apt
curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
apt update -y && apt install -y google-chrome-stable
and then specified the path when launching the browser.
You also have to run it in headless and with args "--no-sandbox"
browser = await launch(executablePath='/usr/bin/google-chrome-stable', headless=True, args=['--no-sandbox'])
Hope this will help!
If anybody is running on Heroku and facing the same error:
Add the buildpack : The url for the buildpack is below :
https://github.com/jontewks/puppeteer-heroku-buildpack
Ensure that you're using --no-sandbox mode
launch({ args: ['--no-sandbox'] })
Make sure all the necessary dependencies are installed. You can run ldd /path/to/your/chrome | grep not on a Linux machine to check which dependencies are missing.
In my case, i get this:
libatk-bridge-2.0.so.0 => not found
libgtk-3.so.0 => not found
and then install dependencies:
sudo apt-get install at-spi2-atk gtk3
and now it works!

Local AWS serverless application model python application could not able to load jira module

Local AWS serverless application model python application could not able to load jira module. It is working fine if i use pycharm run option but whenever i use debug option it throws exception
my requirements.txt is as follows,
cherrypy
dash-table
dash
dash_core_components
dash_html_components
dash_renderer
flask
Jinja2
jira
jupyter-core
markupsafe
nltk
oauthlib[signedtoken]
pandas
pbr
plotly
pymongo
python-dateutil
requests
splunklib
boto3
botocore
sklearn
also tried with mentioning jira version like
jira==2.0.0/jira==1.0.8 etc
whole exception message
START RequestId: 52fdfc07-2182-154f-163f-5f0f9a621d72 Version: $LATEST
END RequestId: 52fdfc07-2182-154f-163f-5f0f9a621d72
REPORT RequestId: 52fdfc07-2182-154f-163f-5f0f9a621d72 Init Duration: 15853.40 ms Duration: 0.02 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 133 MB
{
"errorType": "Exception",
"errorMessage": "Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name jira was given, but was not able to be found.",
"stackTrace": [
" File \"/var/lang/lib/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n",
" File \"/var/lang/lib/python3.7/imp.py\", line 171, in load_source\n module = _load(spec)\n",
" File \"\u003cfrozen importlib._bootstrap\u003e\", line 696, in _load\n",
" File \"\u003cfrozen importlib._bootstrap\u003e\", line 677, in _load_unlocked\n",
" File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 728, in exec_module\n",
" File \"\u003cfrozen importlib._bootstrap\u003e\", line 219, in _call_with_frames_removed\n",
" File \"/var/task/app.py\", line 5, in \u003cmodule\u003e\n import project.helper as helper\n",
" File \"/var/task/project/helper.py\", line 15, in \u003cmodule\u003e\n import project.jira_helper as JiraHandling\n",
" File \"/var/task/project/jira_helper.py\", line 6, in \u003cmodule\u003e\n from qbojira import JiraController\n",
" File \"/var/task/qbojira/JiraController.py\", line 2, in \u003cmodule\u003e\n print (pbr.version.VersionInfo('jira').version_string())\n",
" File \"/var/task/pbr/version.py\", line 467, in version_string\n return self.semantic_version().brief_string()\n",
" File \"/var/task/pbr/version.py\", line 462, in semantic_version\n self._semantic = self._get_version_from_pkg_resources()\n",
" File \"/var/task/pbr/version.py\", line 449, in _get_version_from_pkg_resources\n result_string = packaging.get_version(self.package)\n",
" File \"/var/task/pbr/packaging.py\", line 874, in get_version\n name=package_name))\n"
]
}
I was getting the same issue when I tried to upload my code with packages on AWS lambda function. After much research, trial and errors, adding the idna packages along with the jira packages worked for me.
idna
idna-2.10.dist-info
jira
jira-2.0.0.dist-info

importerror on pip install after pypi install

ref: https://github.com/louking/loutilities/tree/0.14.7
I am getting an importerror after pip install of this package. When I use easy_install of the egg all is well. Any help on how to debug would be appreciated.
Used following commands to install this package to pypi, and pip install using "pip 18.1 from c:\users\lking\anaconda2\lib\site-packages\pip (python 2.7)"
python setup.py install
python setup.py sdist bdist_wheel
twine upload dist/loutilities-0.14.7.*
:
# later
pip install loutilities
When I run the project, see the following
NoAppException: While importing "run", an ImportError was raised:
Traceback (most recent call last):
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\venv\lib\site-packages\flask\cli.py", line 235, in locate_app
__import__(module_name)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\run.py", line 31, in <module>
app = create_app(Development(configpath), configpath)
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\__init__.py", line 82, in create_app
from contracts.views.frontend import bp as frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\__init__.py", line 18, in <module>
import frontend
File "C:\Users\lking\Documents\Lou's Software\projects\contracts\contracts\contracts\views\frontend\frontend.py", line 21, in <module>
from loutilities.flask_helpers.blueprints import add_url_rules
ImportError: No module named flask_helpers.blueprints
find_packages seems to be finding the appropriate packages:
from setuptools import find_packages
find_packages()
Out[4]: ['loutilities', 'tests', 'loutilities.flask_helpers']
setup.py:
#!/usr/bin/python
# [irrelevant comments deleted]
import glob
import pdb
# home grown
from loutilities import version
from setuptools import setup, find_packages
def globit(dir, filelist):
outfiles = []
for file in filelist:
filepath = '{0}/{1}'.format(dir,file)
gfilepath = glob.glob(filepath)
for i in range(len(gfilepath)):
f = gfilepath[i][len(dir)+1:]
gfilepath[i] = '{0}/{1}'.format(dir,f) # if on windows, need to replace backslash with frontslash
outfiles += [gfilepath[i]]
return (dir, outfiles)
setup(
name = "loutilities",
version = version.__version__,
packages = find_packages(),
# include_package_data = True,
scripts = [
'loutilities/agegrade.py',
'loutilities/apikey.py',
'loutilities/applytemplate.py',
'loutilities/filtercsv.py',
'loutilities/makerst.py',
],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires = [
'unicodecsv>=0.13.0',
],
# If any package contains any of these file types, include them:
data_files = ([
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
globit('doc/source', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', '*.py', ]),
globit('doc/build/html', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_sources', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_static', ['*.txt', '*.rst', '*.html', '*.css', '*.js', '*.png', ]),
globit('doc/build/html/_images', ['*.png', ]),
]),
entry_points = {
'console_scripts': [
'agegrade = loutilities.agegrade:main',
'apikey = loutilities.apikey:main',
'applytemplate = loutilities.applytemplate:main',
'filtercsv = loutilities.filtercsv:main',
'makerst = loutilities.makerst:main',
],
},
zip_safe = False,
# metadata for upload to PyPI
description = 'some hopefully useful utilities',
long_description=open("README.md").read(),
license = 'Apache License, Version 2.0',
author = 'Lou King',
author_email = 'lking#pobox.com',
url = 'http://github.com/louking/loutilities',
# could also include long_description, download_url, classifiers, etc.
)
After pip install loutilities I see an unknown directory loutilities at the top-level of my virtual environment. The directory contains a few *.pyc but not any subdirectory. I suspect import loutilities.flask_helpers tries to find a subdirectory loutilities/flask_helpers and fails.
I think the top-level directory is from the code
globit('loutilities', ['*.conf','*.pyc','*.pyd','*.dll','*.h','*.xlsx']),
I suspect there is a bug in globit() that puts the data in the wrong directory.

Resources