Unable to import 'azure.functions' pylint(import-error) [3,1] and Unable to import '__app__modules.library_finder' pylint(import-error) [4,1] - visual-studio-code

I'm trying to test out a serverless Python Chatbot API in Microsoft Azure, but when I follow online guide https://towardsdatascience.com/creating-a-serverless-python-chatbot-api-in-microsoft-azure-from-scratch-in-9-easy-steps-2f1913fc9581
it gives these error :
Unable to import 'azure.functions' pylint(import-error) [3,1]
Unable to import '__app__modules.library_finder' pylint(import-error) [4,1]
any idea how to resolve this?
Regards

This error is coming from pylint. It seems that the linter is not pointed to the .env and therefore cannot validate the azure package! To solve it, you can try this:
In Visual Studio Code:
Locate the Python version in the status bar and click on it
Select the Azure workspace where your project resides
A list of Python versions show up for you. Pick the one that starts with ./.venv/ (In my case, it is: ./.venv/bin/python)
You might then get a popup saying the Linter pylint is not installed.
Click on Install button to install it and you should be good to go
Hope this helps

Related

Vs Code Issue: no code output. how do i fix this?

I am very new to coding and am trying to write a practice script for webscraping in VS Code Editor. But every time i run the script i get this issue of there being no real output. Can you please advise on what the issue is? Note: the pink boxes are just covering my nameenter image description here
I tried running the code and expected webscraped data from the link. I have tried many different scripts and the same issue happens. So there must be something wrong with the whole system i think
VSCode is an excellent IDE. When you start a new project (or open a folder in VSCode), it does not come with any build tools or compilers etc. You have to manually configure them. You have to set up the environment using different toolchains. Here are some instructions for Python
This is not a problem with VSCode but I am going to answer your question.
You can't webscrape indeed.com with requests and beatiful soup because it has bot protection using cloudflare. If you take a closer look to the response it returns the 403 Forbidden status code instead of 200 OK. You can scrape using a headless browser using selenium.
Here's an example
First install selenium and webdriver_manager
pip install selenium webdriver_manager
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
# Make sure you are not detected as HeadlessChrome, some sites will refuse access
options = ChromeOptions()
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = Chrome(options=options, service=Service(
ChromeDriverManager().install()))
# Make sure you are not detected as HeadlessChrome, some sites will refuse access
ua = driver.execute_script("return navigator.userAgent").replace(
"HeadlessChrome", "Chrome")
driver.execute_cdp_cmd("Network.setUserAgentOverride", {
"userAgent": ua})
driver.execute_script(
"Object.defineProperty(navigator,'webdriver',{get:()=>undefined});")
driver.get("https://www.indeed.com/companies/best-Agriculture-companies")
main = driver.find_element(By.ID, "main")

Machine not connecting to Github

I'm trying to follow along with a tutorial video and I am unable to get past the 1st step of creating the project using react next js. Within Visual Studio Code I enter the following then am giving the response -
after opening vscode and opening a terminal I type
-npx create-next-app -e with-tailwindcss ( then my projects name )
After I press enter, the files start to download, but then I receive an error as stated below
-Downloading files for example with-tailwindcss. This might take a moment.
? Could not download "with-tailwindcss" because of a connectivity issue between your machine and GitHub.
Do you want to use the default template instead? ยป (Y/n)
I am unable to start the project because I am receiving the error that there is a connectivity issue between my machine and github. I do not understand why because I have never seen this error before prior to using the command npx- create-next-app -e with-tailwindcss
If I type npx create (project name) I do not receive an error and there is no connectivity issue between my machine and github.
Does anyone know how to solve this? I have been browsing everywhere and cannot find the solution. Thank you !

Jupyterlab-dash needs to be included in built on Binder but then throws an error

I am trying to launch a Binder rep and import JupyterDash into it.
The Binder built worked.
In my Binder rep
enter link description here
My yml is:
name: plotly_dash
channels:
defaults
dependencies:
python
ipykernel
seaborn
pandas
matplotlib
numpy
plotly
jupyter-dash
dash
chart-studio
nbformat
ipywidgets
openpyxl
jupyter_server_proxy
However, I get the message:
jupyterlab-dash needs to be included in built
On my machine locally this is also the case and not a problem and works.
In Binder it throws an error:
If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').
If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.
As I see it JupyterDash is not prebuilt.
On
github.com/plotly/jupyter-dash
they say to include:
JupyterDash.infer_jupyter_proxy_config()
This does not work either and to make it work it requires some efforts on the server site, I guess. However I do not even think this would solve the problem.
What can I do to make the built work?
Thank you for any suggestions.
I posted this on Jupyter Discourse Forum too:
enter link description here

How to resolve Pymongo Runtime Error R6034 in Houdini

I'm working at a visual effects studio in which we use MongoDB/pymongo for our asset management. Our studio is using the SideFX software Houdini.
So far MongoDB has been a pleasure to work with in terms of programming, however whenever we connect to the MongoDB via pymongo from within Houdini, we're getting the following error:
Microsoft Visual C++ Runtime Library - Runtime Error!
Program: C:\houdini\17.5.293\bin\houdini.exe
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
This error occurs everytime when we import pymongo for the very first time, i.e. in a Python shell within Houdini, which is using Python 2.7. Once we click 'OK' on the error popup (it appears twice after clicking OK for the first time), the error disappears and we're able to connect successfully to the database.
The SideFX support team suggested that pymongo wasn't compiled with Visual Studio 2017, which is the compiler SideFX is using for their software.
Now we've been trying to debug this for a while now to no avail. Here's a rundown of what we tried:
update Windows10 to the latest and greatest
updating pymongo from 3.5.1 to 3.9.0
launching Houdini from different builds (16.5, 17.0, 17.5), we get the error in every version.(We're launching a vanilla Houdini session without any 'PYTHONPATH' or 'PATH' environment variables set)
interestingly enough my colleague imported pymongo into Houdini successfully on his private laptop last night without any errors occurring which leads me to believe that the error might be related to our system settings possibly?
I would love to find out how to get rid of this error message because it is really messing with our current pipeline. Any suggestions/help is welcome and much appreciated.
Please let me know if you need any additional information in order to debug this matter.
Thanks a lot in advance,
Manu
This post here helped me to resolve my issue:
Runtime error R6034 in embedded Python application
What happened is that we have a Python 2.7 install located at C:\Python27 which is being added as an environment variable 'path' in Windows.
Using the Process Explorer, I learned that this folder contains the file 'msvcr90.dll' which is conflicting with Houdini, since Houdini comes with its own Python installation that doesn't contain this dll file.
The solution is simple. When launching Houdini in a custom environment, strip the C:\Python27 from the 'path' environment variable so Houdini only fires up its own Python interpreter.

Problems for Hail0.2 working on Azure DataBrick

Hello? Anyone who can help for Hail 0.2 on Azure DataBrick?
After pip install lots of problems came out....
can't find Java Package , import hail.plot , hl.init()
According to document
https://docs.azuredatabricks.net/applications/genomics/tertiary/hail.html#create-a-hail-cluster
I've pip install hail
set ENABLE_HAIL=true in Cluster Environment Setting
However
import hail as hl
hl.init(sc, idempotent=True)
AttributeError: module 'hail' has no attribute 'init'
Also another document
https://docs.azuredatabricks.net/applications/genomics/tertiary/hail.html
import hail as hl
import hail.expr.aggregators as agg
hl.init(sc, idempotent=True)
ModuleNotFoundError: No module named 'hail.expr'
Anyone can give a solution?
Thanks a lot !!!
Are you using the genomics runtime? See https://learn.microsoft.com/en-us/azure/databricks/runtime/genomicsruntime#dbr-genomics to launch a cluster with the genomics runtime. Then Hail will be installed if you set the ENABLE_HAIL=true environment variable.
You may want to move to Azure HDInsight, and follow the instructions on the following page, under the Microsoft Azure section:
https://hail.is/docs/0.2/cloud/other_cloud_providers.html
This should get you up and running!