This question already has answers here:
How to deal with Kivy installing error in Python 3.8?
(5 answers)
Closed 2 years ago.
I installed kivy using the command line as instructed in the kivy.. except for last part which says "python -m pip install kivy==1.11.1" which i tried to install according to the instruction from the site...but its giving me error messages so after some research it seems like python 3.8 does no support kivy..but i did install it manually..the main issue now is that i can't import kivy to pycharm it gives me error message "ModuleNotFoundError: No module named 'kivy'"
please what is the correct way to import kivy to pycharm?
Ok, I just solved Your problem. Use this:
python -m pip install kivy[base] kivy_examples --pre --extra-index-url https://kivy.org/downloads/simple/
Write this on PyCharm terminal and you are done!
Related
This question already has answers here:
Installing python module within code
(12 answers)
How to install and import Python modules at runtime
(5 answers)
have python script check for missing modules and install if missing
(3 answers)
Closed 25 days ago.
I am currently finishing a school project making a game of Blackjack. I was using Replit to code and everything was fine. I recently tried to run it at home on Visual Studio Code but it said a module named "matplotlyb.pyplot" wasn't installed. I seem to understand now that you have to install it manually. When my project is done, it will be sent to an external examiner who will review it. Is there anyway to automatically download the module when the code is ran so the examiner won't have to?
Here's what I'm looking for:
import matplotlib.pyplot as plt
#something that installs it if not already installed
Best practice would be to include a requirements.txt file along with your project. The file should contain all the required packages in the format
packagename==version
You could also use the below to generate the requriements.txt
pip freeze > requirements.txt
pip freeze gives you the list of all installed Python modules along with the versions
To run your install all the dependencies, you could just use:
pip install -r requirements.txt
Hope this helps!
Simply wrap things in a try.. except and don't forget to use sys.executable to ensure that you will call the same pip associated with the current runtime.
import subprocess
import sys
# lazy import + install
try:
import matplotlib.pyplot as plt
except ModuleNotFoundError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "matplotlib"])
This question already has answers here:
Unable to install Pygame using pip
(27 answers)
Python pygame not installing
(3 answers)
Closed last month.
I've tried to use my installed pygame module in a script, but got an error "No module named 'pygame.base'". I am using a Mac. My Python version is 3.10.9.
I have searched for solutions available and tried to run pip3 uninstall pygame, pip cache purge, and pip3 install pygame to resolve this issue, but this did not help.
Thank you!
I am a beginner and I want to work with the pygame module. I have already used pip install to install pygame and it says so on my command prompt. On my command prompt it says:
Requirement already satisfied: pygame in c:\users\35192\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (2.1.2)
However, when I try to import pygame in vscode, the module won't import and it says: "ModuleNotFoundError: No module named 'pygame'"
Does anyone know how to fix this?
I solved the problem. I basically just used Ctrl+Shift+P to open up the command palette. From there, I opened "Python: Select interpreter" and then I just changed the python interpreter to be the global one (which I assume is the one used by the command prompt)
As seen here: https://stackoverflow.com/questions/15185827/can-pip-be-used-with-python-tools-in-visual-studio#:~:text=Go%20to%20Tools%20-%3E%20Python%20Tools%20-%3E%20Python,enter%20your%20module%20and%20double%20click%20to%20install.
You have to go to Tools -> Python Tools -> Python Environments in vs code. Then click on your python installation, then pip, and install pygame.
Or you can find where your vs code python installation is, and run this: "directory to vs code python.exe" -m pip install pygame
If you would like to use one python installation everywhere, you can change your vs code interpreter/environment to the python you already have installed on your system. As seen here: https://code.visualstudio.com/docs/languages/python
This question already has answers here:
ImportError: No module named requests
(33 answers)
Closed 4 months ago.
I'm using Spyder with Python 3.9 and Python 3.7 respectively on Mac and Windows and I got the same issue.
I'm trying to import some packages like:
import pythonnet as clr
or
import yfinance as yf
but I get this message:
File "/var/folders/xs/1_m665393ql86dptnsrft5j80000gn/T/ipykernel_2232/2746914347.py", line 1, in <cell line: 1>
import pythonnet as clr
ModuleNotFoundError: No module named 'pythonnet'
I'm sure that I already installed these packages from the prompt. I'm facing the following issue with many packages so I suppose is it related to the working directory. This is the directory where -pip installs the package by default:
/Users/user_folder/opt/miniconda3/lib/python3.9/site-packages
I'd to understand if the issue is related to the directory and how to efficiently setup it.
Thank you in advance.
It may be that when you are running the script you are trying to run a different version of python.
When you run the pip install try python3 -m pip install instead.
If this doesn't work and you are using vscode you can simply click in the bottom right where it states the python interpreter and change what you are using.
If all of that fails to work, then sorry but that's all I can suggest with my current knowledge.
This question already has answers here:
How to use pip with Python 3.x alongside Python 2.x
(11 answers)
Closed 6 years ago.
I have installed qrcode package as pip install pyqrcode
Then when I open a python2.x shell and import it there, no errors are given. But when I open a python3 shell and try to import it there it says
ImportError: No module named 'qrcode'
I import it as import qrcode
When I installed the package with pip it says Downloading PyQRCode-1.2.tar.gz, meaning that it is installing the last version. But in pypi
it says that it also support python3.
What's the correct way to import it?
You need to download a separate package for python 3. pip3 install pyqrcode
Then you can access it. Of course you will need to install pip3 first if you don't have it.