Module object has no attribute [CANTERA] - python

I've been trying out the simpliest basics of Cantera.
I'm using Cantera 2.2.1 installed on CAE Linux (Xubuntu 12.04) along with iPython.
I first import:
import cantera as ct
Then I try creating a gas:
gas = ct.Solution('gri30.xml')
That is just a tutorial copycat. Yet it seems not to work at all. What i get is
AttributeError: 'module' object has no attribute 'Solution'
I wish to know what can a reason behind this all be.

Related

How would I deal with an attribute error with mediapipe solutions?

I get an attribute error if I use the function:
def faceDetection():
if results.detections:
for detection in results.detection:
print(id, detection)
AttributeError: type object 'SolutionOutputs' has no attribute
'detections'
is the error I get if I try running, specifically it calls it on the results.detections: line
it works fine in this youtube tutorial
at 1:43:56
I don't really know how to read the github code but here's the link
I do have
mpFD = mp.solutions.face_detection # FD = face_detection
fD = mpFD.FaceDetection()
defined before the function already.
Is this an issue with my code or is it something else?
This error depends on the Python version you are using. You need to use the version minimum Python 3.9 but most probably you are using Python 3.6.
It would be better to create an environment with conda by specifying Python version and install mediapipe in there and try to run your code again. The error will disappear.
Here is an example how to establish environment to run mediapipe examples.
It wasn't a problem with the mediapipe library, but I hadn't initialized results as the faceDetections solutions, but I had results as a value for the hands solution module.

Pycharm helpers folder on mac (AttributeError: 'FigureCanvasInterAgg' object has no attribute 'renderer')

I'm having the exact same issue as described in this question: AttributeError: 'FigureCanvasInterAgg' object has no attribute 'renderer'
Basically, I try to convert a pyplot fig to a numpy array:
X = np.array(fig.canvas.buffer_rgba())
however I get the following error:
'FigureCanvasAgg' object has no attribute 'renderer'
The error seems to be PyCharm specific and could apparently be solved by manipulating the "backend_interagg.py" file in the "helpers" folder in the PyCharm installation directory.
However, I can't locate the helpers folder for PyCharm on mac. Could you tell me how to navigate to the required folder to make the suggested changes (see link above)?
Thanks a lot!

Problem when importing PySCIPOpt. AttributeError: type object 'pyscipopt.scip.Expr' has no attribute '__div__'

I want to use python interface for SCIP; I installed PySCIPOpt following these steps.
I'm using SCIP7, PySCIPOpt 3, and python 3.7. SCIP's interactive shell alone works well. However, when I try to import pyscipopt, I get the following error
File "src/pyscipopt/scip.pyx", line 1, in init pyscipopt.scip
AttributeError: type object 'pyscipopt.scip.Expr' has no attribute 'div'
My operating system is Linux Mint 19.2
I tried to test the installation as suggested, and I get the errors in the image
The problem seems to be an update in cython. It should be fixed in the current master of PySCIPOpt. See also https://github.com/SCIP-Interfaces/PySCIPOpt/issues/397
python is very sensitive for syntax , Like upper case etc..
so may be you try :
import PySCIPOpt instate import pyscipopt

StochPy missing module when using PyDev in Eclipse

I use PyDev in Eclipse for Python coding. I need to use the Stochpy package. I already have it installed and it works fine in the Command Prompt. However, it gives me "AttributeError: 'module' object has no attribute 'SSA'" error when running in Eclipse.
Why is that?
The code is as simple as:
import stochpy
smod = stochpy.SSA()
The second line gives me error:
AttributeError: 'module' object has no attribute 'SSA'
Thanks!

error while using FREAK

I'm trying to create Descriptor extractor using FREAK. but
at the following line:
freakExtractor = cv2.DescriptorExtractor_create('FREAK')
I get an error saying:
freakExtractor = cv2.DescriptorExtractor_create('FREAK')
AttributeError: 'module' object has no attribute 'DescriptorExtractor_create'
can someone tell me what is the exact problem and why i'm getting this error?
I'm using ubuntu 12.10 with opencv 2.4.3 and python 2.7.
I think,
cv2.DescriptorExtractor_create('FREAK')
is not a part of python interface, just use the latest opencv for that then it will work or you simply can write the code in c++ which is availabe in that version in c++.

Categories