Building webrtc native on Ubuntu - python

I am having a hard time building webrtc-native on ubuntu. The Build instructions for webrtc are wayward and poor. I am following https://webrtc.org/native-code/development/.
Figured that I need to install the depot tools and run fetch v8. Then I did gclient sync. Did apt-get install ninja. Now I am stuck at python webrtc/build/gyp_webrtc. I get the following error
Traceback (most recent call last): File "webrtc/build/gyp_webrtc",
line 23, in
import gyp_chromium ImportError: No module named gyp_chromium
I badly need help here. Also, it seems that the community doesn't care much about helping to build native apps using webrtc. The focus is on upstream/Web APIs.

Please check https://github.com/HefnySco/node-webrtc-native
I hade very hard time. I used build-webrtc with some tweaks all listed on the above link.
The linked project goes one step forward and build a node component after building the webrtc lib.

WebRTC recently moved from gyp to gn as the default method to generate ninja files.
You should find the process to get started easier here: https://webrtc.org/native-code/development/

Related

Building an environment for Lambda development

I've built a web scraper in python using seleniumwire that runs fine on my local machine. I've adjusted it for AWS Lambda, but when I went to deploy I received lots of various errors with components that seleniumwire needs to run. After a lot of troubleshooting and creating lambda packages I've gotten stuck at this error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named '_cffi_backend'
Traceback (most recent call last):
I know that Lambda cannot support the arm architecture and I've been using docker to generate the required packages for this, however am stuck with this, as creating and using the package that contains the cffi module, still doesn't get me through.
So we come to my ask:
I'd like to create an environment on either my machine, or on an EC2 machine, or any other suggestions are welcome. Where I can have the same OS/environment that Lambda uses, that I can ssh/connect into, and 1. run my code to ensure it's working. 2. create a deployment package from that machine.
I really appreciate you reading this, and am grateful for your feedback.
I ended up creating an EC2 instance with AWS-Linux.
I then followed the instructions found here to build the layers needed for my code within the Linux environment. These instructions were amazing. Ultimately the issue for the layers was
Folder structure
Compiling on ARM architecture.
Experiment adding your dependencies as layers.
Here is a video of how you can create layers to add libraries and other dependencies on your lambda function.
Create layer lambda function

ModuleNotFoundError with one Prefect flow, but not the other

Cross-posting this question: https://github.com/PrefectHQ/prefect/discussions/6868
I have a minimal project using Prefect v1.3.1, which you can find here: https://github.com/b-long/aid . I'm having a little difficulty getting the deployment right, after migrating from native code to dockerized code. I am using the latest version of Prefect v1 and need to solve this before I'm able to migrate to Prefect 2.x
I'm using Poetry, but I'm pretty sure there's a pattern here that would apply to Hatch, Pipenv, Flit or other tooling. The problem is observed in registration which logs this toward the end:
ModuleNotFoundError: No module named 'aid'
The command '/bin/sh -c python /opt/prefect/healthcheck.py '["/opt/prefect/flows/basic-pandas-flow.prefect"]' '(3, 10)'' returned a non-zero code: 1
Traceback (most recent call last):
...
ValueError: Your docker image failed to build! Your flow might have failed one of its deployment health checks - please ensure that all necessary files and dependencies have been included.
If you're a Prefect Guru, I'm guessing you'll be able to solve this issue by reading the log file (see discussion linked above) and looking at my Dockerfile: https://github.com/b-long/aid/blob/main/Dockerfile.prefect
It looks like your package aid is relative to / root file system
COPY README.md aid/ /aid/
I believe it will work if you make it relative to /aid dir (your working dir is /aid and so init file need to be in /aid/aid/__init__.py)
COPY README.md /aid/
COPY aid/ /aid/aid
I answered directly on the GitHub issue. Let's keep the discussion there to make it easier to follow everything in one place.
Btw, great writeup on the GitHub issue, very helpful!

RDKit installation under Windows and Python3.7.4

RDKit could be a nice package if it wasn't so complicated to install.
Here on SO, there are several questions having problems with the installation of RDKit.
However, on different operating systems or different environments.
My configuration is:
Win10, Python 3.7.4, pip is installed, PATH is set, PYTHONPATH is set.
The installation of other modules is working fine via python -m pip install <package>.
I'm aware that the site recommends the fastest installation with Anaconda.
However, I don't have and don't want Anaconda.
On the webpage it says:
"Get the appropriate windows binary build from: https://github.com/rdkit/rdkit/releases".
However, there are no binaries of the latest versions.
This means, I would have to build it from source. I'm hesitating because the process seems to be pretty complicated, many extra installations with new problems and unknowns, and furthermore, the instructions seem to be outdated and incomplete for somebody who would build binaries from the source for the first time.
So, then I tried some unofficial binaries of RDKit.
If I unpack them and set the paths according to instructions, I get this error message:
>>> from rdkit import Chem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\xyz\Programs\RDKit\rdkit\__init__.py", line 2, in <module>
from .rdBase import rdkitVersion as __version__
ImportError: DLL load failed: The specified module could not be found.
So, finally my questions:
How to properly install RDKit with the above mentioned configuration?
What is the specified DLL which is missing?
Where is it expecting it and searching it?
Are these RDKit 3.6 binaries maybe incompatible with Python 3.7.4?
I'm pretty sure it is probably a "small" thing (a path here or a check there), but I'm stuck. Thank you for any hints.
Update:
Apparently, it is not just a "small" thing. Chances to get this to work are most likely very low.
In the meantime I found this:
https://github.com/rdkit/rdkit/issues/1812
https://github.com/rdkit/rdkit/issues/2389
If the author of rdkit writes (April 2019):
I would be happy to be able to do pip distributions of the RDKit, but
to the best of my knowledge no one has managed to figure out how to
make it actually work.
I'd be happy to accept a PR from someone who has figured this out, but
I am not likely to have the time to do this myself anytime in the near
future.
So, if anybody feels capable achieving this, please feel free.
I will invest time in something else or will have to switch to Anaconda if I want to use RDKit.
On the webpage you linked there is a section about missing DLLs:
"In Win7 systems, you may run into trouble due to missing DLLs, see one thread from the mailing list: http://www.mail-archive.com/rdkit-discuss#lists.sourceforge.net/msg01632.html You can download the missing DLLs from here: http://www.microsoft.com/en-us/download/details.aspx?id=5555"
Not sure if this helps

ImportError: No module named queue - Flask app on Cloud Foundry

I am trying to push a flask app (Python 3.5) to Cloud Foundry (CF). The application takes a POST request (text file) and returns a message. It works locally (tested via Postman). However, when attempting to push it to CF, it gives the error -
ImportError: No module named queue
Here is my code which contains queue.
import queue as Queue
self._batch_queue = Queue.Queue(self.BATCH_QUEUE_MAX)
self._example_queue = Queue.Queue(self.BATCH_QUEUE_MAX * self._hps.batch_size)
I've tried the solutions suggested here, but neither of these solve my problem. I think the issue is with the Python in CF not having queue package. (I could be wrong).
Anyone ideas on how to go about solving this will be very appreciated. Thanks in advance!
As mentioned in the comments by #KlausD, it seems like you have the wrong version of Python installed. On Cloud Foundry, you would set the version by including a file called runtime.txt in the root of your project (i.e. the directory from which you're running cf push).
https://docs.cloudfoundry.org/buildpacks/python/index.html#runtime
That file is used to tell the Python buildpack which version of Python to install for you. Suggestions would be python-3.5.x or python-3.6.x which would install the latest 3.5 or 3.6 release. You can specify an exact version like python-3.5.5 but it's not recommended as it's easy to forget to update that file when new versions of Python come out.
You can see which versions of Python are supported by the buildpack here.
https://buildpacks.cloudfoundry.org/#/buildpacks/python/v1.6.17
(Note that link goes to the latest version of the buildpack at the time I wrote this, it will get out of date. In the future, just click the most recent version of the buildpack to see what ships with it).

"SignatureError: Failed to verify signature" - Okta, pySAML2

For three days, I have been pulling my hair out trying to wrap my head around Okta & SAML.
On my local machine (OSX Mavericks), I am able to successfully follow the steps listed here: http://developer.okta.com/docs/guides/pysaml2
Things work.
But moving everything over to our production server, which is a CentOS box, running nearly identical code, I am faced with this "SignatureError: Failed to verify signature" error.
Traceback (most recent call last):
auth_response = saml_client.parse_authn_request_response(SAMLResponse, entity.BINDING_HTTP_POST)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/client_base.py\", line 599, in parse_authn_request_response binding, **kwargs)
response = response.loads(xmlstr, False, origxml=origxml)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 510, in loads self._loads(xmldata, decode, origxml)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 335, in _loads **args)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1756, in correctly_signed_response
class_name(response), origdoc)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1571, in _check_signature
raise SignatureError(\"Failed to verify signature\")
SignatureError: Failed to verify signature
I have scoured the internet looking for a way to troubleshoot this error. I am new to SAML and Okta.
My assumption is that this has something to do with xmlsec1 acting differently on our production machine. But the versions are identical. There are many dependencies so I'm not sure where the problem might be.
Has anyone ran into this error? Any thoughts on what I might be able to try?
I know this is a little late, but in case someone else runs into this:
pysaml2 provides a lot of logging using python's built in logging, I defined a handler for saml2.sigver and that gave a lot of info. In those logs I found this:
Error: unable to load xmlsec-openssl library. Make sure that you have
this it installed, check shared libraries path (LD_LIBRARY_PATH)
envornment variable or use "--crypto" option to specify different
crypto engine.
Turns out I needed to install xmlsec1-openssl.
Hope this helps someone in the future.
Dealing with xmlsec1 can be extremely frustrating!
The main thing that I suggest doing is enabling debugging in PySAML2, and/or setting the PYSAML2_KEEP_XMLSEC_TMP environment variable, and/or manually enable this code path in sigver.py - the general idea is to get a look at xmlsec1 command that PySAML2 is calling and have PySAML2 leave the temporary files around so that you can test the commands yourself.
As I recall, most of the issues that I've run into in the past involved PySAML2 not finding the xmlsec1 binary. The get_xmlsec_binary() function in sigver.py is responsible for finding the xmlsec1 binary. I suggest that you take a look at the code in get_xmlsec_binary() and make sure that it is looking in the right places on your system.
Depending on the operational system you will also need to install additional libraries.
In my case, I got the issue on a CentOS server, so I needed to install more 2 dependencies in addition to xmlsec1:
yum install libffi-devel xmlsec1 xmlsec1-openssl
This solved my problem.
You should also have a look on Okta's documentation. They have a guide on how to use PySAML2 to add support for Okta (via SAML) to applications written in Python.
https://developer.okta.com/code/python/pysaml2/

Categories

Resources