Pyinstaller cannot import pynput module [duplicate] - python

This question already has answers here:
Getting error when using pynput with pyinstaller
(2 answers)
Closed 8 months ago.
Hey ive tried coding a script in which i use pynput to detect keybinds being pressed. It works fine itself but sadly once i try to use pyinstaller to make it into an exe file the following error pops up once i try to run it.
I have tried looking up the problem but have not found any working solutions.
I have also read through pyinstaller's documentation but I didn't find anything.

#use this pip install pynput==1.6.8

Related

I got this error on Google Colab: couldn't connect to display ":1.0" [duplicate]

This question already has answers here:
Is there any way to use Tkinter with Google Colaboratory?
(2 answers)
How to use GUI in Google Colab?
(1 answer)
Closed 9 months ago.
This post was edited and submitted for review 9 months ago and failed to reopen the post:
Original close reason(s) were not resolved
I tried to use tkinter on Google Colab. And I got the error:
TclError: no display name and no $DISPLAY environment variable
And I tried this method in this answer: Is there any way to use Tkinter with Google Colaboratory?
But still I got an error:
TclError: couldn't connect to display ":1.0"
Here is my code:
import random
import os
from tkinter import *
import numpy as np
!apt-get install -y xvfb # Install X Virtual Frame Buffer
os.system('Xvfb :1 -screen 0 1600x1200x16 &')
os.environ['DISPLAY']=':1.0'
You guys didn't understand what is going on here...
I read the answers from How to use GUI in Google Colab? and Is there any way to use Tkinter with Google Colaboratory? and I think they are not answering my question.
Somebody asked if it is possible to use Tkinter in Google Colab in this question: Is there any way to use Tkinter with Google Colaboratory?, and the first answer asserted that adding these lines of code into the very beginning would be helpful.
!apt-get install -y xvfb
os.system('Xvfb :1 -screen 0 1600x1200x16 &')
os.environ['DISPLAY']=':1.0'
It says this will create a virtual display so that we can use Tkinter in Google Colab. I tried this and it failed. So now I am asking why it failed.
I know some answers stated that you cannot use a GUI on Google Colab. BUT there are answers saying that it is possible to create a virtual display. However after doing what they said, I still got the error I posted. So I am wondering is it really impossible to use tkinter in Colab or it is that whatever code from other answers that I used has something wrong with them and that can be fixed.
Please consider reopening this question as I think this is not a duplicated question.

Installing python on sublime text [duplicate]

This question already has answers here:
Set up Python 3 build system with Sublime Text 3
(10 answers)
Closed 11 months ago.
Need help installing python on the sublime text on a windows laptop. I am new to this and spent hours online looking but nothing worked.
I tried
tools>build system>new build system and entered
"cmd":["python3","-u","$file"],
but it does not work, it shows this message
C:\Users\john\AppData\Local\Programs\Python\Python310\python.exe: can't find '__main__' module in ''
[Finished in 12.3s]
Try to go to Tools > Build System and select Python. That should work.
You can just do CTRL + B to run the file.

"ModuleNotFound: no module named pynput" when running PyCharm project from CMD? [duplicate]

This question already has answers here:
Activate venv (Python 3.7.2) for Windows [duplicate]
(2 answers)
Closed 1 year ago.
I installed the pyinput package through the package manager(file>settings>project>project interpreter) in PyCharm and it seems to be working fine from inside the IDE, but when I try to run the program from the CMD, I am getting the
"ModuleNotFoundError: No module named 'pynput'" error.
I tried adding it's parent folder in the path like that
parent_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.path.pardir)
sys.path.append((parent_dir+"/venv/Lib/site_packages").replace("\\", "/"))`
but it doesn't seem to work. What should I be doing in this case?
It looks from your question, as written so far, like you're trying to use a module named pyinput but your code is calling it pynput, which is missing an i. Did you make a typo in your code, or in your question? :)

Python Numpy installation sanity check error [duplicate]

This question already has answers here:
How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas?
(9 answers)
Closed 2 years ago.
I was trying to run a block of python codes but I got this error. I installed all the necessary packages.
RuntimeError: The current Numpy installation ('D:\Program Files\Python38\lib\site-packages\numpy\init.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
Does anyone know what is the problem?
This did the job:
pip install numpy==1.19.3
I can see it's a new error I also had it a couple of minutes ago when I just installed numpy and tensorflow through console.
https://developercommunity.visualstudio.com/solutions/1241964/view.html
Here the link, the link given actually worked. :)

How to solve Html module not found error in Python? [duplicate]

This question already has answers here:
How to solve "Unresolved import: HTML" in Python Development?
(2 answers)
Closed 4 years ago.
I am running python 3.7 version and using Pycharm edu. I tried to import the 'html' module. But I am getting the following error,
ImportError: No module named html
Any idea why this happens?
Any idea why this happens?
python throws this error when it can't find tye requested module, make sure that the module correctly installed and you have installed it for python 3.7.

Categories