For class I am using python arcade. I installed it with pip install arcade. When I attempt to import it with import arcade it pops up ModuleNotFoundError: No module named 'arcade'.
Ive uninstalled and reinstalled arcade. It shows up when I enter pip freeze. I am using VS Code on windows 10.
When I look in the 'errors' tab in VS Code it says "Unable to import 'arcade' pylint(import-error)[3,1]"
I used to have the same problem.
The solution in my case was installing modules by running
python -m pip install <module> instead of pip install <module>
I have the same problem in the jupyter notebook and I have solved it as follow:
pip install notebook
Related
After I install pyautogui through pip using py -m pip install pyautogui. I try to import it into Pycharm using import pyautogui but it just says "No module named pyautogui". I have tried uninstalling python and pyautogui and reinstalling them. I am very new to python so sorry if this makes no sense or is really easy to fix, thanks :)
Check this answer i believe it is what u need
It's some other guy asking same thing
how to install packaging
If you already have another Python installed try view the version of your Python
python -V
ex.: Python 3.90
try :
pip3.9 install pyautogui
Currently I'm trying to install tensorflow with pip, I've used the following command to install it with:
pip3 install --user --upgrade tensorflow which after installing returns Successfully installed tensorflow-2.5.0. But when I install I get a lot of notices "Requirement already satisfied" but I'm unsure if this is normal or not.
I have a following local python file on my Windows 10 computer called test.py and inside is a simple import
test.py
import tensorflow as tf
When I run python I get the following error:
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
When I run pip3 list I can see that the module tensorflow is there, but importing it does give the error. It seems to happen with other modules too, as I've tried installing pymongo and it gave me the same error.
What I've tried
Uninstalling, re-installing python
Uninstalling and re-installing tensorflow
Python3 version: 3.9.5
Pip3 version: 21.1.1
I would try python3 -m pip install tensorflow. Running pip as a module ensures the versions are the same and can help with compatibility.
Most probably you have installed tensorflow on python3(guessing after seeing pip3 command) but you are running script on python2 (guessing after seeing "When I run python").
Assuming you aren't using virtualenv
Try running
python3 test.py
If this didnt help then try below command.
python3.x test.py # where x could be your minor version Ex: python3.6/python3.7
I'm using Python 3.6 on Windows 7.
I have a script that uses standard python packages.
The script run fine from IDLE.
It used to run fine from Windows command too, but not anymore.
I don't know why. It complains about missing package like:
, line 4, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
The path looks ok (I've added all path found from IDLE / Path Browser):
PATH=C:\Users\olivier\AppData\Local\Programs\Python\Python36\lib\site-packages;C:\Users\olivier\AppData\Local\Programs\Python\Python36\Lib;C:\Users\olivier\AppData\Local\Programs\Python\Python36\DLLs;C:\Users\olivier\AppData\Local\Programs\Python\Python36\python36.zip;C:\Users\olivier\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\olivier\AppData\Local\Programs\Python\Python36\;C:\Users\olivier\AppData\Local\GitHubDesktop\bin
Any idea?
Thanks
I had the same problems. Did you try to install it through pip and did you try to install on the strict path by using pip install --target="..." for e.g "pip install --target=C:\U2\UV\python\Lib\site-packages geopy" and pasting it in python console?
Also look at this post: Install a module using pip for specific python version
These two points can help you to solve the problem as per my knowledge.
Are you using two Python versions?
Check the Environmental Variables and if everything is fine there, it's better to uninstall and reinstall it again. use pip for installing and uninstalling
I am working with python flask's requests module. I have installed requests module using :
pip install requests
And verified that requests module exists when I run :
pip list
But when I run my python application , I receive import Error for requests module.
I noticed that pip is installing the module in C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\ folder BUT the interpreter is looking for the module in C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\flask\ folder.
I have tried running the command :
pip install --install-option="Path to install in" requests
But threw some other error.
The import error I am getting states :
ImportError: cannot import name 'requests' from 'flask'
(C:\Users\xx\Documents\Projects\Python\Python3REST\lib\site-packages\flask\__init__.py)
I am working in virtualenv in Windows 10.
I recently had the same problem installing a self made package. I installed it with pip install <package> and checked it was actually installed with pip list but running the script with import <package> returned a ModuleNotFoundError: No module named <package>.
I solved the problem creating an empty file called __init__.py in the package directory.
Check https://pythontips.com/2013/07/28/what-is-init-py/ and https://docs.python.org/3/tutorial/modules.html#packages for better understanding.
what if you add that folder to your path? using sys.path.extend?
I solved it using python3 -m pip install <package name>. In the OP's case, it should be python3 -m pip install requests.
Note that I'm using python 3.10.
My OS is Ubuntu, and I've followed the official installation guide to install lightgbm. However, when I import it, this error is raised:
ImportError: No module named lightgbm
How can I solve this?
Do I also need to go to /python-package folder to run setup.py after running those linux commandlines?
I had the same problem, and solved running the installation directly on the notebook
!pip install lightgbm
Besides running those linux command lines. I also need to go to /python-package then run 'python setup.py install'.
conda install -c conda-forge lightgbm solved the problem for me
you need just run in a notebook cell before importing
For Windows users, VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572> is needed if Visual Studio (2015 or 2017) is not installed.
Install wheel <http://pythonwheels.com> via pip install wheel first. After that download the wheel file and install from it:
pip install lightgbm
The following should do the trick:
export PATH=/usr/local/bin/anaconda3/bin${PATH:+:${PATH}}
PYTHONPATH=$PYTHONPATH:/usr/local/bin/anaconda3/lib/python3.6/site-packages
Note that you might need to change the paths if you are using a different Python version.
Thank you for above question and answers, had a similar issue.
Problem:
After successfull install of lightgbm, I was getting the error ImportError: No module named 'lightgbm' (in Jupyter Notebook on Google Cloud's Notebook Instance in AI Platform project).
Issue:
Realized that the install of lightgbm was in Python 2.7 even when the notebook was running in Python 3 (path: './.local/lib/python2.7/site-packages').
Solution:
The error was gone after the Jupyter Notebook was set to run on Python 2 instead of Python 3.
within Jupyter Notebook cell is: try running
import sys
!{sys.executable} -m pip install lightgbm
With python try, from pypi.org, this line
pip install lightgbm
or
pip3 install lightgbm
Also, you can try this one if you use anaconda
conda install lightgbm