No module named 'PyQt6.QtWidgets' - pyqt6

I get the above message when I try to use QtWidgets. Has anyone else had this issue and solved it? Just to clarify I have installed PyQt6 using and there is no issue when I
python3 -m pip install PyQt6
and there is no issue when I try
import PyQt6
so the issue is something to do with QtWidgets.
Since downloading I tried
app = PyQt6.QtWidgets.QApplication([])
and I received the error "ModuleNotFoundError: No module named 'PyQt6.QtWidgets'"
I can't find any information on how to solve this so can anyone help?
I am using macOS 12.5.1 and python 3.9.15.

Try this import statement instead:
import PyQt6.QtWidgets
some packages have kind of 'subpackages'(like QtWidgets) you have to import specifically.
I do not know the reasoning behind this, but it is done in bigger packages.

Related

PackageNotFoundError: bokeh after compiling with pyinstaller

I have a python project that imports bokeh, and I use pip install bokeh to install bokeh 3.0.3 version, and everything works fine. However, after I compile this project using pyinstaller, the executable file crashes at launch with the following error:
importlib.metadata.PackageNotFoundError: bokeh
Also the way I'm importing bokeh functionalities into my project is like this:
from bokeh.io import output_file, show
I have searched around, but haven't been able to find any useful clue on how to solve this issue. I would appreciate any help on this.
Python versoin 3.8.13
Pyinstaller version: 5.7.0
I have also tried using conda to install bokeh, but it does not make any difference.
You may find this issue useful for your case.
https://github.com/pyinstaller/pyinstaller/discussions/6033
In your case there is the need to include the "--copy-metadata bokeh" command when you are running pyInstaller or use the copy_metadata() function in your spec file.
For more details refer to the github issue as it goes a little more in detail.

Error while Using OpenAerostruct and OpenMDAO together

When I run the code given in the document on combined aero and structure I go this error:
AttributeError: 'module' object has no attribute 'matlib'
Based on the previous answer I had got, I tried to install the updated version of 'matplotlib' , but this has not solved the problem. Any help will greatly help me as I am a FORTRAN era person and a new convert to Python.
It looks like you're trying to use an intel compiled version of python and numpy can't find an necessary underlying library. Something is messed up in your python/numpy install.
This has nothing to do with OpenAeroStruct or OpenMDAO. If you can't fix your install, I suggest trying out the Anaconda python distribution, which should have everything precompiled correctly.
I don't have enough rep to comment, but please view this answer as a comment and I'll edit it once I can answer more properly.
That sounds like a numpy installation issue. Could you please post the entire error trace that you get when you try running the command?
Additionally, what system are you on (Windows, Mac, Linux), how did you install Python, and have you tried any other Python-based code that you can get to work successfully?
Edit: the most recent version of OpenAeroStruct has been modified to avoid this issue altogether.

Flutter application could not be compiled, because its dependencies could not be established

Here is the import statement in 'main.dart'
import 'package:firestoreflutter/lib/ui/listveiw_note.dart';
and i can confirm that the file exists! However when i go to compile i get the error message:
Your application could not be compiled, because its dependencies could not
be established.
The following Dart file:
/home/jedaa/workspace/flutter_apps/studio/firestoreflutter/lib/main.dart
refers, in an import, to the following library: /home/jedaa/workspace/flutter_apps/studio/firestoreflutter/lib/lib/ui/listveiw_note.dart
Unfortunately, that library does not appear to exist on your file system.
Of course it does not exist, and the import statement does not say to look there .. viz: /lib/lib/ui !!!!
What is going on here?? Can somebody help me out as i cannot find a solution.
Thank you.
You have typo error in your import, this is the correct import
import 'package:firestoreflutter/lib/ui/listview_note.dart'
Please confirm. Thanks
Try taking out the lib in your import. This is because firestoreflutter automatically puts in a lib for you, causing the two libs to be seen in the error
You can try "sudo chmod -R 775 xxx/studio" to the entire studio

AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'

I have a created a tkinter app for Convolution neural network to identify images. I am trying to compile the py file with pyinstaller but i am receiving this error:
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'
i have also attached the screenshot of the error
Just re-start in case you are using Jupyter notebook. It worked for me. Also make sure, you are working in correct python environment.
This problem just happened to me when i try to create an app of an uncompleted project for testing purpose.
I have pandas imported, but i didnt call it in my script.
Removing the import line or call pandas was the solution.
You need to have cython too,
pip install cython or conda install cython
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas program.py
I solved it using
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas myScript.py
and it is working now
The other solutions did not work for me but what did is:
add import pandas at the very top of conftest.py
add ignore:numpy\.ufunc size changed.+:RuntimeWarning to the filterwarnings option of pytest.ini
upgraded freezegun to the latest version

How to import pyFirmata correctly?

I'm working on a project that involves experimenting with Arduino Mega and I'm learning about it from this book https://books.google.co.uk/books/about/Python_Programming_for_Arduino.html?id=O0PfBgAAQBAJ&printsec=frontcover&source=kp_read_button&redir_esc=y#v=onepage&q&f=false
I'm in a stage where I need to import pyfirmata library but for whatever reason it keeps throwing an import error.
I installed the library using pip3 and when that didn't help I built it from source therefore I'm quite confident that I've got it in my system. I even got a file path where it is installed. Within my Python site-packages directory.
The book is favouring Python 2.7 but I figured I can make this work in Python 3 as well. I tried import pyfirmata, from pyfirmata import Arduino and in both cases I get import error.
It shouldn't be that hard to get this to work. What should I try ?
#!/usr/bin/python
# Import required libraries
import pyfirmata
from time import sleep
I also tried replacing the first line with the exact file path of the directory but no effect.
you did everything needed with python but you also need to open Arduino IDE and press files, examples, Firmata, StandardFirmata then transfer the code to your board. Your board will now easily communicate with Python through the module Pyfirmata.

Resources