I've been programming with Python for a few months now but I'm having trouble figuring out the Python-Twitch library for the Twitch API. I've installed version 1.2 and it gives instructions here: http://ingwinlu.github.io/python-twitch/quickstart.html#dependencies
However, I'm completely inexperienced with doing this type of thing. Even just using their example of
from twitch.api import v3
returns a "no module named twitch" error..
Where would I get started with this? Any help would be greatly appreciated, sorry for my lack of knowledge.
If calling from twitch.api import v3 returns the following error:
no module named twitch
Then you do not have the python-twitch module properly installed.
First make sure you have an up to date version of Python, such as 3.5.1 from https://www.python.org/downloads/
Then install it (if not already installed) using the recommended options including PIP
Then go to the Python\Scripts directory, such as:
C:\Users\me\AppData\Local\Programs\Python\Python35-32\Scripts>
Then run the following:
pip install python-twitch
Now you should see something like this:
Collecting python-twitch
Downloading python-twitch-1.2.0.tar.gz
Collecting six>=1.9.0 (from python-twitch)
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-twitch
Running setup.py install for python-twitch
Successfully installed python-twitch-1.2.0 six-1.10.0\
Now re-run your test python file:
from twitch.api import v3
Related
I successfully installed the module geocoder:
Requirement already satisfied: chardet<5,>=3.0.2 in
c:\users\myname\appdata\roaming\python\python39\site-packages (from
requests->geocoder) (4.0.0) Installing collected packages: ratelim,
geocoder Successfully installed geocoder-1.38.1 ratelim-0.1.6
When I try to create a Python file that includes import geocoder, I get the error Import "geocoder" could not be resolved.
The relevant path is included in sys.path:
C:\Users\myname\Downloads
C:\Users\myname\AppData\Local\Programs\Python\Python39\python39.zip
C:\Users\myname\AppData\Local\Programs\Python\Python39\DLLs
C:\Users\myname\AppData\Local\Programs\Python\Python39\lib
C:\Users\myname\AppData\Local\Programs\Python\Python39
C:\Users\myname\AppData\Roaming\Python\Python39\site-packages
C:\Users\myname\AppData\Roaming\Python\Python39\site-packages\win32
C:\Users\myname\AppData\Roaming\Python\Python39\site-packages\win32\lib
C:\Users\myname\AppData\Roaming\Python\Python39\site-packages\Pythonwin
C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages
C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\win32
C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\win32\lib
C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\Pythonwin
Why isn't Python able to resolve this module?
Thanks
Either geocoder is installed to other than Python3.9 version installation (e.g. python 3.7) or geocoder is not in the path of your python module.
Try to install the library using specific Python pip package manager (e.g. pip3.9) and run the module you develop using specific Python version (e.g. Python3.9)
I installed tkcalendar as normal through pip and all installed fine:
C:\Users\Pavel>python -m pip install tkcalendar
Collecting tkcalendar
Downloading https://files.pythonhosted.org/packages/44/18/2d6a50fd9703a4cf96a24d12aee5a21b33e75d0b3e6b25fa4dcd7d06efc1/tkcalendar-1.5.1-py3-none-any.whl
Collecting babel (from tkcalendar)
Downloading https://files.pythonhosted.org/packages/2c/60/f2af68eb046c5de5b1fe6dd4743bf42c074f7141fe7b2737d3061533b093/Babel-2.7.0-py2.py3-none-any.whl (8.4MB)
|████████████████████████████████| 8.4MB 6.4MB/s
Requirement already satisfied: pytz>=2015.7 in c:\users\pavel\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from babel->tkcalendar) (2019.3)
Installing collected packages: babel, tkcalendar
Successfully installed babel-2.7.0 tkcalendar-1.5.1
Yet when I try to run my script I get an error that module not found:
File "C:/Python_working/exercies/tkinter.py", line 7, in <module>
from tkcalendar import Calendar, DateEntry
ModuleNotFoundError: No module named 'tkcalendar'
I tried restarting Spyder, tried re-installing with pip but I only get a message that package already installed.
Finally, I tried installing the package with conda but here I get the following error:
PackagesNotFoundError: The following packages are not available from current channels:
- tkcalendar
Not sure what else to do to solve this issue.
Using Python 3.7 and Spyder 3.3.6.
Update:
Running python from command prompt and then running import tkcalendar works fine.
I found this guide to working with virtual environments in Spyder on github, but it seems a bit over my head...
Okay-dokay... found the answer in this post.
Basically, the idea is that for packages that are not a part of normal Spyder/Anaconda installation you need to go to Tools -> PYTHONPATH and add a new folder for each and every module. Then restart Spyder and all works all right.
I am working on a raspberry pi python project and every time I import a package I get the same error ModuleNotFoundError: No module named ''. for example I am trying to add the ambient_api package
I followed the steps in their set up:
pip install ambient_api
Added the imports at the top of my file:
from ambient_api.ambientapi import AmbientAPI
api = AmbientAPI()
but I am getting the error:
ModuleNotFoundError: No module named 'ambient_api'
This is happening with all the imports I am trying to add and I cant figure out what I am missing.
when I was looking on google I came across __init__.py might be a solution but I am not sure how this works?
edit:
here is what was output when I installed:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: ambient_api in /home/pi/.local/lib/python2.7/site-packages (1.5.2)
Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from ambient_api) (2.21.0)
Requirement already satisfied: urllib3 in /usr/lib/python2.7/dist-packages (from ambient_api) (1.24.1)
version in my terminal:
pi#raspberrypi:~/Raspberry-Pi-Greenhouse $ python --version
Python 2.7.16
but it looks like the version in the shell in the ide when I run the program is saying:
Python 3.7.3 (/usr/bin/python3)
As explained by #JaFizz in Pytorch is installed but do not working ubuntu 18.04 it solved by giving an alias and installing correctly to desired python version (there were two pythons installed on the same machine)
First it was necessary to specify the location of the python, example:
alias python=/usr/local/bin/python3.6
Then install it:
python pip install <package name>
I have installed webkit-server and dryscrape - but when I run a script I get an error when using a dryscrape function. The error is as follows:
"No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/webkit_server'"
However, when trying to install webkit_server, I get:
Requirement already satisfied: webkit_server in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (1.0)
To show I already installed it, see link image.
Suggestions from my side are:
There is a difference between webkit_server and webkit-server?
Webkit_server is in the wrong place and can't be found by dryscrape?
I tried to install both using gitclone - same error
Any suggestions would be useful.
List of pip3 installed packages includes webkit-server
I get this error when I run a program:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-10-b045b37982bc> in <module>()
4 #speech recognition
5 import speech_recognition as sr
----> 6 import win32com.client
7 import comtypes.client
8 #speech synthesis
ModuleNotFoundError: No module named 'win32com'
---------------------------------------------------
When I tried to install the pypiwin32 module, I got this error:
Collecting pypiwin32
Using cached pypiwin32-223-py3-none-any.whl
Collecting pywin32>=223 (from pypiwin32)
Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: )
No matching distribution found for pywin32>=223 (from pypiwin32)
The problem is that pypiwin32 depends on pywin32, and, as the README says:
Note that PIP support is experimental.
Even if pip installs pywin32, you still have to manually run the post-install script with elevated privileges. So, rather than debugging why the experimental pip support isn't working for you, it's probably better to manually download the appropriate installer from the Releases page and run it.
Once that completes, pip should know that you now have pywin32 version 223 installed, so pip install pypiwin32 should hopefully work.
You might want to look through the pywin32 issues to see if anyone has reported this problem (it may only be mentioned in some issue about completing pip support, not a separate one) and, if not, file a bug report. That way, the next time someone wants to use pypiwin32, they may not even need this answer. (Since Mark Hammond, the main author of pywin32, is also listed as a maintainer of pypiwin32, I'm guessing he already knows about it—but it can't hurt to check.)