im unable to import sqlalchemy and psycopg2 libraries into my python code while using VSCode tool. it throws the following errors:
(module) sqlalchemy
Import "sqlalchemy" could not be resolved from sourcePylancereportMissingModuleSource
No quick fixes available
Import "psycopg2" could not be resolved from sourcePylancereportMissingModuleSourc
heres the code:
Related
Im trying to use vimbapython. every time I run anything that imports vimba import vimba the following error occurs:
from .c_binding import call_vimba_c, VIMBA_C_VERSION, VIMBA_IMAGE_TRANSFORM_VERSION, \
ImportError: attempted relative import with no known parent package
modules and drivers are all freshly installed.
Did anybody encountered something like that?
After installing azure servicebus from pypl( azure-servicebus 7.3.4 ) using pip, i am trying those provided sample code from https://pypi.org/project/azure-servicebus/.
It gives error:
from azure.servicebus import ServiceBusClient
ImportError: cannot import name 'ServiceBusClient' from partially initialized module 'azure.servicebus' (most likely due to a circular import) (C:\python\lib\site-packages\azure\servicebus_init_.py)
I am using windows10.
other azure services like FaceAPI and CustomVision libraries are working fine.
Just this ServiceBus is throwing error.
I am new to azure in python. Any kind help of help is highly appreciable.
Make sure you don’t have any of your working .py file named like ServiceBusClient.py or ServiceBusMessage.py or azure_servicebus.py which can conflict with Python/ServiceBus package installed files.
If you are using Python 3.8.9, you can try installing the lower version of azure-servicbus as answered by Frank Gong
pip install azure-servicebus==7.0.0
You can refer to ImportError: cannot import name '...' from partially initialized module '...' (most likely due to a circular import), Circular Import Error while importing create_engine in Sqlalchemy, and ImportError: cannot import name 'ServiceBusClient' from 'azure.servicebus'
You can refer to the available Azure Service Bus libraries for Python
I am completely new to this Databricks.
In Databricks i have tried running the following packages in its python notebook
# Library Section
import psycopg2
import pandas as pd
import numpy as np
import sqlalchemy
from sqlalchemy import create_engine
from io import StringIO
import os
import smtplib
import time
from email.mime.text import MIMEText
import datetime
All these packages are running fine when i am running the cell individually. But when i am trying to run the packages on the auto schedule mode, its giving the error
ModuleNotFoundError: No module named 'sqlalchemy'
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<command-4076398358532638> in <module>
8 import pandas as pd
9 import numpy as np
---> 10 import sqlalchemy
11 from sqlalchemy import create_engine
12 from io import StringIO
ModuleNotFoundError: No module named 'sqlalchemy'
Absolutely no idea what is this problem all about. Can someone please help me with this.
Edit 1: i installed the following libraries in Databricks
psycopg2
sqlalchemy
flask_SQLAlchemy
but still the same problem
When you say I had installed the following libraries in Databricks, How exactly have you installed sqlalchemy library?
By default, Databricks clusters will not have sqlalchemy library installed on the runtime selected.
You need to install the sqlalchemy library explicitly and run the above command.
pip install SQLAlchemy
I am new to using Python for machine learning and I am trying to learn ZhuSuan using Spyder.
I have downloaded and installed Zhusuan as descibed here: https://zhusuan.readthedocs.io/en/latest/.
I have also tried installing the additional dependencies required for the examples by following the instructions here: https://github.com/wmyw96/ZhuSuan.
I then try and run an example script (eg https://github.com/thu-ml/zhusuan/blob/master/examples/bayesian_neural_nets/bayesian_nn.py), importing the modules as with the code:
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import tensorflow as tf
from six.moves import range, zip
import numpy as np
import zhusuan as zs
from examples import conf
from examples.utils import dataset
However, on execution, I receive the following error:
File "C:/*******/bayesian_nn.py", line **, in <module>
from examples import conf
ModuleNotFoundError: No module named 'examples'
I would be very grateful if anyone could anyone help identify where I have gone wrong with loading or importing the example modules.
Many thanks in advance.
Ross
I have solved the problem. The additional dependencies had not installed correctly for some reason. Running a full reinstall fixed the problem, and the program now runs successfully with the original code. Thanks to Carlos for his comment.
I've deployed my application to AWS Lambda with Zappa. The deployment went fine without any issues. But when I try to reach the app via AWS API Gateway I get a 500 response.
The logs says
Unable to import module 'handler': No module named builtins
The environment runs on Python 2.7. I've added future to the Pipfile but it still won't work.
When I check the code in Lambda I can see the following code
from __future__ import unicode_literals
import base64
import boto3
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import traceback
import zipfile
from builtins import str
I can't find what can be wrong. Does anyone have a clue?
I solved the problem. I'm using pipenv to install my packages, but for some reason the packages wasn't installed inside the virtual environment, which made Zappa to not include them to AWS Lambda. I had to install them manually in PyCharm by going through Settings > Project > Project Interpreter and add the packages there. Thanks for your help.