Trouble importing simplegui - python

I installed PyDev in Eclipse to run Python programs, but I’m facing trouble importing simplegui. It is showing me this error:
import simplegui
ImportError: No module named simplegui
My installed PyDev version is 2.7.1.

You can use SimpleGUICS2Pygame.
Just change
import simplegui
by
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
in your CodeSkulptor program and run it in standard Python

Did you learn Python using CodeSkulptor?
simplegui is a custom module for CodeSkulptor, meaning that it is only available in CodeSkulptor.
More information here.

I am using a Mac, when I installed simplegui off of the Python website, I had to import it as:
import simpleguitk
I also downloaded it through terminal with the command:
sudo pip install SimpleGUITk

Simple, download simplegui.zip form http://florian-berger.de/en/software/simplegui.
unzip simplegui-x.x.x.zip
cd simplegui-x.x.x
python setup.py install
Replace x.x.x with version number. You might want to run the last step with sudo rights.

Related

How to install ctypes module for python 3.7 to be used with VSCode debugger

I have multiple python interperters in my computer 3.7 and 3.8. When I debug using with python 3.8 I do not face any issues using VSCode. My VScode python debugger fails when trying to debug with python 3.7. How do I install ctypes for python 3.7?
File "/home/kumar/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 8, in <module>
import ctypes
File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Try pip uninstall ctypes, and then uninstall and reinstall ur python 3.7 and then try again pip install ctypes and then import ctypes in python interpreter.
ctypes is a built in library (I think from python2.5)
This means you dont need to install it, it is coming built in when you install python.
As far as using the correct version, see the pyenv module - it will make sure you are running the correct python version, and IMO makes life much easier
Have you checked which pip you are using? Make sure you have taken the right pip to install the package in the right place.
You can take pip --version command to check which pip you are using.

'No module named google.auth.transport.grpc' even though google-auth has been installed with pip

On my raspberry pi 3, I am trying to run this code, but I get this error:
No module named google.auth.transport.grpc
I have installed all packages listed in the requirements.txt (on the same github page above), and installed grpcio. I have installed google-auth. I have installed google-assistant-sdk. I have no clue why this module is not working correctly. If I open up python and try: import google.auth it gives the same error of "No module named google.auth"
Any ideas as to how I can fix this?
Try to verify the version of Python that you are using to run this code. If you installed the module in Python 2.x and try to run it with Python 3.x it will not work, because modules installed on Python 2 are not usable in Python 3 and vise versa.
I was trying to run the program with python -m textinput.py, which used python 2.x
Using python3 -m textinput.py fixed my issue by using python 3.x

ImportError: No module named scenedetect on Linux Ubuntu

I'm trying to use pyscenedetect library on python for videos but I get this error when using the python interface and when I use the command line interface I get the error "ModuleNotFoundError: No module named 'cv2'"
even though I believe I installed both correctly according to the documentations.
I have trying to look for different ways to import opencv for the second error but to no avail. As for the first error i can't find any answers to my problem.
import cv2
import numpy as numpy
import os
import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetect.stats_manager import StatsManager
from scenedetect.detectors import ContentDetector
If you have pip you can try
pip install opencv-python
If you have anaconoda, you can try
conda install -c conda-forge opencv
it's probable that you installed it on a different python installation in your PC.
To know where your python installation is you can launch python and:
import sys
sys.path
To get the list of everything you have installed you can:
pip freeze > installed_modules.txt
Try only running
import cv2
So that you can test it
I found the problem. As Ivan was pointing out, the problem was with openCV.
I used the following command:
sudo apt install python3-opencv

Python: ModuleNotFound Error

I downloaded multiple modules (Discord API, cx_Freeze) (pip download, Windows 10) and now I wanted to use them.
But when I want to import them, it says there isn’t any module.
From my former Python using (before resetting computer) I‘ve added a pycache folder and it worked for one module. I‘m not able to reproduce it for other modules. What to do?
I‘ve only one Python version (3.6.5) on PC.
I‘ve checked the \site-packages folder and they‘re there.
If you are using python3 then try downloading the library using
pip3 install libname
but if you are using python2 then install the library using
pip2 install libname or just pip install libname
try with these command and reply
try installing your library using the command prompt in normal user and with the admin user so that you will get to know that what is happening and also if it is still not working then try installing the library into the same folder of your project using pip custom install command
pip install -t <direct directory> <package>
then use the import statement
For Example I used
pip2 install -t c:\Users\Nav\Desktop\projectss cx_freeze
then i imported the library using
#from cx_Freeze import setup, Executable
import cx_Freeze
from cx_Freeze import *
it worked.
Previously i was getting error like :
File "C:\Python27\lib\site-packages\cx_Freeze\__init__.py", line 10, in <module>
from cx_Freeze.finder import *
ImportError: No module named finder
After custom install it is working

Cannot import FactorAnalyzer from module factor-analyzer-0.2.2

I installed the module factor-analyzer-0.2.2 but cannot import the function. My code is from factor_analyzer import FactorAnalyzer. I'm getting an error ModuleNotFoundError: No module named 'factor_analyzer'.
I'm using Python 3.6 and Jupyter notebook. Do you know why this does not work?
Thank you!!
I had the same problem on Mac (python3). I launch Spyder 3.3.3 via Anaconda.
In response to the following code:
from factor_analyzer import FactorAnalyzer
I received the following error:
ModuleNotFoundError: No module named 'factor_analyzer'
So, I opened Terminal (equivalent of Command Prompt on windows) and typed:
pip install factor_analyzer
Then, the problem was resolved.
Use the anaconda prompt to run the pip install factor-analyzer rather than termainal or powershell. I had the same problem and doing that solved it for me.
Can you try to run the import command on your Python Shell and let us know if you are able to import it successfully?

Categories