ModuleNotFoundError: No module named 'Quartz' - python

I'm trying to work on python3 and using mac. I have installed pyobjc-core and pyobjc, but the error said Quartz not found. I'm very new to this kind of installing. Is there any solution?
Here is my error from pycharm:
Traceback (most recent call last):
File "/Users/Thyme/PycharmProjects/DinosourBot/venv/lib/python3.6/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module>
import Quartz
ModuleNotFoundError: No module named 'Quartz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Thyme/PycharmProjects/DinosourBot/Bot.py", line 2, in <module>
import pyautogui
File "/Users/Thyme/PycharmProjects/DinosourBot/venv/lib/python3.6/site-packages/pyautogui/__init__.py", line 110, in <module>
from . import _pyautogui_osx as platformModule
File "/Users/Thyme/PycharmProjects/DinosourBot/venv/lib/python3.6/site-packages/pyautogui/_pyautogui_osx.py", line 7, in <module>
assert False, "You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html"
AssertionError: You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html
Process finished with exit code 1

In case anyone stumbles here use:
pip install pyobjc-framework-Quartz

I have solved the problem by
installing pyobjc-framework-Quartz,
it's provided by pycharm

I'd suggest it's best to install all of pyObjC, rather than just specific frameworks. Invariably, if you're working with Quartz, you're going to need various CoreFoundation objects and constants at the very least. To say nothing of AppKit, or other frameworks, depending on what you're doing.
pip install pyobjc (or pip3) should install everything and let you import Quartz. (It works for me on several pythons!)

Related

How do I install GNU Radio in a Python virtualenv

I am trying to get gnuradio to work in a virtualenv. I want to keep my system somewhat clean and my project needs Python 3.9, but my system Python is 3.8 (Ubuntu 20.04.4 LTS).
I install it using sudo apt install gnuradio, but then it ends up in the system dist-packages and I can't import it in my virtualenv. The imports work fine when running the system Python.
I have tried to recreate my virtualenv to use system packages:
python3.9 -m venv --system-site-packages venv
This at least made my virtualenv able to find gnuradio, but when I try importing stuff it fails in several different ways.
>>> from gnuradio import uhd
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 21, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 68, in <module>
_prepare_uhd_python()
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 26, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
>>> import pmt
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 34, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 38, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
I have struggled with this for several days now and found no solution. Is it even possible to run GNU Radio from within a virtualenv?
I have struggled with this for several days now and found no solution.
Your distro's GNU Radio package is built against your distro's python, so you can't use it with a different python.
So, this is expected.
Is it even possible to run GNU Radio from within a virtualenv?
Sure, you'd need to build it from that virtualenv as well, and tell cmake -DCMAKE_INSTALL_PREFIX=/path/to/virtualenv/ to install into it.
We have a pretty nice anaconda packager, so installing GNU Radio into a Python prefix using conda might be the easiest alternative to that.
Alternatively:
Ubuntu 20.04.4 LTS
There's a new Ubuntu LTS version out! If you go for a system upgrade to Ubuntu 22.04 LTS, you get Python 3.10, and a current GNU Radio 3.10.1 "for free".

Can't import pymatgen.core "No module named 'pymatgen.core'"

I've used pip install pymatgen with Python 3.9.1 on Windows 10 to install pymatgen, but I'm getting the following error:
Traceback (most recent call last):
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
ModuleNotFoundError: No module named 'pymatgen.core'; 'pymatgen' is not a package
I have also tried to install the previous 2 versions but still getting the same error though I can already see it in the pip list
pymatgen 2022.3.22
What am I missing?
Maybe try using conda ? if this doesn't work then there is definitely some dependencies issue
https://pymatgen.org/installation.html

Unable to install packages PyCharm

I am trying to install packages with PyCharm but each time I try to do so it gives me an error:
The full command output:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.2\helpers\packaging_tool.py", line 2, in <module>
import traceback
ModuleNotFoundError: No module named 'traceback'
What would be a way to fix this?
Edit: I am trying to install the "Python packaging tools" which results in that error.
Try to reset from the right hand side at the top of the window of the Interpreter and try to install again

ImportError ropevim using ropevim plugin in vim

According to the documentation of rope-vim plugin I install python-rope and python-ropemode mode packages. However when I try to open some file using vim I get following ImportError:
Error detected while processing function LoadRope:
line 4:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ropevim
I have found the ropevim module is already in plugin's directory but when I had tried to import it:
python -c "import ropevim"
I get another ImportError:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "ropevim.py", line 10, in <module>
import vim
ImportError: No module named vim
Have I miss any package? Some ideas? Thank you for your help.
Install ropevim using pip install ropevim
ropevim is currently a Python 2 project.
pip2 install --user --update ropevim
I know it might not be the answer you're looking for, but I'm using klen/python-mode plugin with rope included and it's working like a charm.
I'm also using Vim-Plug to manage my plugins and it's as easy as:
Plug 'klen/python-mode', { 'for': ['python'] }
Here is my .vimrc
Hope this helps! :)

ATpy ImportError: No module named astropy.io

I tried to get atpy on python 2.7. I downloaded ATpy0.9.6 from
https://pypi.python.org/pypi/ATpy/0.9.6
then tar it, and run:
cd ATpy0.9.6
sudo python setup.py install
things seemed to work well.
But when I tried to import atpy on python, I got always this error message:
ImportError: No module named astropy.io
More precisely,
>>> import atpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 15, in <module>
from . import registry
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/registry.py", line 164, in <module>
from . import fitstable
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/fitstable.py", line 8, in <module>
from astropy.io import fits
ImportError: No module named astropy.io
>>>
Could anyone help me to figure out the problem?
Perhaps the 'atpy' package depends on another package called 'astropy.io' that you are missing? Yes here it is https://astropy.readthedocs.org/en/v0.1/index.html
It happens that downloading the tar balls from pypi.python.org is the wrong way to install Python packages. The right way (though the Python docs explain poorly), is to run a command like
pip install atpy
This command will install your package and all its dependencies.
If the command pip is missing, you have to install it, which is ironically really complicated.
In my case the solution was to install astropy
pip install --no-deps astropy

Categories

Resources