I'm trying to use the shooting_game package that comes with PyGaze. While running the code it asks me my name (Player name) and as soon as I enter it, an error pops up:
Traceback (most recent call last):
File "<ipython-input-1-03fc3ba04ddb>", line 4, in <module>
from pygaze import libtime
File "C:\Program Files\Anaconda3\lib\site-packages\pygaze\libtime.py", line
25, in <module>
from pygaze._time.psychopytime import PsychoPyTime as Time
File "C:\Program Files\Anaconda3\lib\site-
packages\pygaze\_time\psychopytime.py", line 22, in <module>
import psychopy.core
ImportError: No module named 'psychopy'
Before this problem arose, there were other modules which weren't working. As far as I remember I had copy pasted the pygaze script file (names of which are imported in the program) to the my path location. This worked as many modules could be imported and it even asked me for a playername input. The next thing though, is why I'm here.
import highscores
from constants import *
from pygaze import libtime
from pygaze.libscreen import Display, Screen
from pygaze.libinput import Keyboard
from pygaze.eyetracker import EyeTracker
import random
I expect it to track my eyeball movements and according to that provide me with a game to shoot at targets. It only asks me for the name initially and then breaks down saying module not found. For more on PyGaze and where to install, check: http://www.pygaze.org/
Edit: I did try pip install psychopy, but this was the result from cmd:
from setuptools.config import read_configuration
ImportError: No module named 'setuptools.config
And then I tried pip install setuptools and turns out I already had it. Still this pops up.
Edit 2: Latest update, I followed the comments below and installed setuptools, but while installing I hit another roadblock. Check my comment(s) on this post from 12-02-19.
Related
So I have a hobby I like to do where I program automated systems that upload things to social media with no human input (and make a little side cash). But anyways, I've been trying to crack YouTube recently. YouTube has their own little way to upload videos automatically, but they watch over it INTENSELY. So, I found a work around using youtube_uploader_selenium, a cool little github project that allows you to upload as many videos as you want to YouTube through selenium firefox.
I know if I can get it to work, I can have a fully automated YouTube channel, however one single, important line of code doesn't work properly.
So the module is accessed via an import command in my main script
from youtube_uploader_selenium import YouTubeUploader
I was able to get that working, however when I did I got an error within the module from this line of code saying that selenium_firefox wasn't a valid pip/module.
from selenium_firefox.firefox import Firefox, By, Keys
So, I did some digging and found a PipInstaller script I could use.
import subprocess
import sys
py_exec = sys.executable
# ensure pip is installed & update
subprocess.call([str(py_exec), "-m", "ensurepip", "--user"])
# install dependencies using pip
subprocess.call([str(py_exec),"-m", "pip", "install", "selenium_firefox"])
That had some odd error involving Rust and the Cryptography pip so I decided to take a different approach. I tracked down the selenium_firefox github then downloaded the module from there. In the script I added a line which made it look for the module selenium_firefox in a certain folder where it was downloaded.
from typing import DefaultDict, Optional
from selenium_firefox.firefox import Firefox, By, Keys # problem code
from collections import defaultdict
import json
import time
from .Constant import *
from pathlib import Path
import logging
import platform
selenium_firefox.path.append(
"C:\\Program Files\\Blender Foundation\\Blender2.92\\2.92\\python\\PythonModules\\modules\\")
That <kinda???> worked. This is the error I currently have,
Traceback (most recent call last):
File "C:\Users\CLASSIFIED\Downloads\ASAS\zxxxs.blend\CLASSIFIEDSCRIPTNAME", line 5, in <module>
File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\python\PythonModules\modules\youtube_uploader_selenium\__init__.py", line 2, in <module>
from selenium_firefox.firefox import Firefox, By, Keys
File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\python\PythonModules\modules\selenium_firefox\__init__.py", line 1, in <module>
from .firefox import Firefox
ModuleNotFoundError: No module named 'selenium_firefox.firefox'
Error: Python script failed, check the message in the system console
I don't know where to go from here. The module within the module within the module has errored. This is what the script for the script that's currently producing this error.
from .firefox import Firefox
from .models import *
from .firefox_addons import *
from selenium_browser import *
My code
import random
import time
import pynput
import pynput.keyboard as kb
import pynput.mouse as ms
mouse = ms.Controller()
keyboard = kb.Controller()
I keep getting the error message:
Traceback (most recent call last):
File "c:\Users\user\Documents\visual studio code\notepadtest.py", line 1, in <module>
from pynput import *
ModuleNotFoundError: No module named 'pynput'
When i try to pip3 install it shows that it is already installed
how do i fix this?
Every module you download saves in site_package folder of python's folder, (dir:Python\Python39\Lib\site-packages).First open the folder where your python is installed (default directory is shown in the Image_1),then go to site_packages folder and copy your module(i-e 'pynput') from there.
There is also a site_pakages folder in project you make,like I noramaly use pycharm,as you can see in Image_2, I made a project with a name 'Hangman Game' and pycharm automatically made a site_pakages folder inside venu folder.You just have to paste your module (i-e 'pynput') there, run your program again and you will not get any error after that.
import pyinputplus as pyip
while True:
prompt='Want to know how to keep an idiot busy for hours?\n'
response=pyip.inputYesNo(prompt)
if response=='no':
break
print('Thank you. Have a nice day.')
When I run my above code , I get this error:
Traceback (most recent call last):
File "c:\users\XXXXXX\mu_code\idiot.py", line 1, in <module>
import pyinputplus as pyip
File "c:\users\XXXXXX\mu_code\pyinputplus\__init__.py", line 15, in <module>
import pysimplevalidate as pysv # type: ignore
ModuleNotFoundError: No module named 'pysimplevalidate'
I cannot figure it out. The module is definitely installed. I've even moved it from the folder it was originally installed in to the mu folder where the py file is saved. Any help would be appreciated.
The ModuleError says that you do not have pysimplevalidate installed.
Using the same python executable as you are using to run your script (idiot.py), run
python -m pip install pysimplevalidate
or, even more bullet-proof:
<path_to_python.exe> -m pip install pysimplevalidate
If you are not sure what python executable the script is using, you can check it with
# put this on top of your script
import sys
print(sys.executable) # will print C:\path\to\python.exe
I am trying to running the Sahana Eden software from terminal, but I keep getting an import error.
Traceback (most recent call last):
File "web2py.py", line 18, in (module)
import gluon.weidget
File "C:\Eden\web2py\gluon\__init__.py", line 15, in (module)
ImportError: No module named 'globals'
The globals module is right in the file where it is supposed to be. Below init
So I went into init and I removed the import to see what would happend.
#from globals import current
from html import *
from validators import *
The next local import, html, works fine, but then the next local import, "validators"(which is also right where it should be) gives me an import error as well.
Running python -V should tell you which version of Python you're running. --version is also an option.
I'm using Tweepy to send some messages to Twitter. I'm getting a long traceback from the API. The traceback settles at:
ImportError: cannot import name Random
I used Pip to install the latest version of Tweepy:
Name: tweepy
Version: 2.3.0
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requires:
When I call
import tweepy
I get this traceback:
Traceback (most recent call last):
File "/Users/dromard/Projects/Drop Playlist/drop.py", line 4, in <module>
import tweepy
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/__init__.py", line 14, in <module>
from tweepy.api import API
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/api.py", line 8, in <module>
from tweepy.binder import bind_api
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/binder.py", line 5, in <module>
import httplib
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 79, in <module>
import mimetools
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
ImportError: cannot import name Random
Process finished with exit code 1
I'm working in PyCharm and confirmed the site package and Python paths are correct in settings. I manually checked in console that the paths are correct, and there are no duplicate locations.
I haven't made any changes to Tweepy. I let Pip install it where it is, as it is. Permissions look correct:
-rw-r--r-- 1 root wheel
If I check Python in console:
- I get the same traceback
- When I run the individual imports, they all execute without error
It all fails out at the random call. I think random is part of Python's core packages, and not part of Tweepy.
I handed this script off to a co-worker, who then used Pip to install tweepy and hit the same traceback. Makes me think Pip might be contributing.
I'm relatively new to Python (programming in general). I looked through other 'import error' articles, but didn't find this specific issue. Any help is appreciated.
I figured this out.
I had created a python file called 'random.py' during the course of experimenting with a random number generating script. My 'import random' call was grabbing this file, which lacked the library Random. It essentially created a conflict with the proper 'random.'
Make sure that you delete the random.py file or overwrite it with another name, then recheck "from random import random".
I could not comment due to low experience.
I also had a xyz.py in a directory and calling a module of same name (import xyz) causes this error.
Make sure you do not save any file xyz.py that also have a python module at the same name.
This is what I found from my newbie experiment.
This also happens with python 3.8.