it’s a package called ‘polybeat’ and it says when I reinstall it that it’s already installed. And Idk what to do to get it working again. It has worked before. Could someone please help me? Thanks!
Hey there! I've been getting so frustrated trying to figure this out. I keep getting ModuleNotFound errors for modules that I most definitely have installed, this case requests. I tried moving the install around and making sure it was in the same folder I'm working on my python file from but to no avail. I'm sure I'm missing something stupid. The traceback error is as follows:
Traceback (most recent call last):
File "/Users/redacted/Desktop/cxt_copy/zd_test.py", line 5, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I'm relying on this for work so any help is much appreciated!
EDIT: I'm on a Mac, using Sublime Text Editor to run Python, have Python3 installed and I installed requests using pip install via the terminal.
Hey everyone, I'm a beginner and could use some help. I installed a library, but Python isn't recognizing it. I've already tried using the pip install command in the terminal, but I still get the 'Module not found' error. What's weird is that other libraries like numpy and pandas work just fine. Does anyone know what could be wrong?
I'm trying to import/use an ETL package, PETL, withimport petl as etl
I did
pip install petl
from my project's root library; it appeared to install fine but VSCode is telling me it can't find the module; and when I try to run it from the terminal there it gives syntax error
I'm using python 3.7; I don't think I have multiple versions of python installed, but not sure how to check that
this seems to be a relatively common problem; a quick google answer says it's not looking where pip installed it
6 months ago I installed pymssql, am using that in the same script, and am able to find that fine (I'm just now getting back into a small python project)
says it's not looking where pip installed it
If you run "pip -V" in the cli it will display where pip will install.
If you run 'import sysconfig; print(sysconfig.get_paths()["purelib"])' it will show where python looks for packages.
If you know which interpreter you want to use, you can ensure an install will be going to the right place by running "python3 -m pip install mymodule" .
I know this has already been answered, but just to throw it out here:
You can also type "pip list -v" in CMD to list locations of all installed packages
I pip installed netifaces, and made sure it was the right python path. I then proceeded to use all python versions I had and it still said module was not found. How do I fix this ?
I'm on a new desktop, but the code I was running worked perfectly fine before. Now when I'm on this new computer, its giving me errors. I made sure all files/folder exist and in the right spot, however I'm still getting module not found error?
import sys
sys.path.append('D:\Refresh') from AllModules import FileLocator
I have been assigned a project and I need to do it using python. Now lately, I have been running into an error, "No module X found" in my VS code while I have already installed the modules via pip both using cmd and the terminal within VSC. I am running Python 3.12.2 (64-bit) interpreter. I have also edited the user/system paths to Scripts/ and Python312/ yet I still don't know what's causing the problem.
Also for some reason when I type: "python --version" In my cmd, I get a reply as "Python 3.9.13" which is a 2022 version and it's not even installed on my system so theres that.
Any help would be appreciated, thanks!
Hey Guys,
I get a weird ModuleNotFoundError in one of my projects and i do not really understand why. So here is my Folder Structure:
Project\
| main.py
| packageabc\
| | __init__.py
| | abc.py
| | packagexyz\
| | | xyz.py
In every .py file is an abc/xyz or main class. Now the interesting part. Inside the abc.py I do an import like this:
from packagexyz.xyz import xyz
This works perfectly fine!
Inside the main.py I do an import like this:
from packageabc.abcimport abc
Now I get an ModuleNotFoundError. Error Code looks like this:
from packagexyz.xyz import xyz ModuleNotFoundError: no module named packagexyz.
So the import in the abc.py File that works perfectly when tested inside the file does not work if the abc.py file is imported. So why is that?
Hello,
Sorry to ask so many questions, but I've come across another problem with my password generator that even after research is proving to be more difficult than I expected. There's a module called "clipboard" that I am trying to use to get the password that is generated copied to the clipboard so the user can just paste it where its needed. I recently built a new computer that didn't have it installed and so when I got to the point of checking for errors, I get this:
Traceback (most recent call last):
File "C:\***\***\******\Programming\Python\python_work\test.py", line 2, in <module>
import clipboard as cb
ModuleNotFoundError: No module named 'clipboard'
[Finished in 84ms]Initially I needed to install it, so I went through my cmd prompt and did the whole "pip install clipboard" and it went through and installed the module. I then tried to reuse the program and it still says its not found. pip also needed an update, so I also updated that after installing clipboard.
I'm not sure why its not working. I haven't had this issue before and I'm not sure where I'd need to put it if it was installed to the wrong path.
EDIT: "clipboard" hasn't been updated since python 3.3 and I have the most recent (3.10) installed. Could it potentially be a compatibility issue?
EDIT2: after some more research I was directed to "py -3.(python version) -m pip install clipboard"
It ended up installing pyperclip and now both "clipboard" and "pyperclip" work. My guess is a compatibility issue and needing something with pyperclip. But I'm still not sure what the initial issue was or how what I did fixed it besides having pyperclip fill in whatever blanks there were.
Even though i pip installed I get:
from bs4 import BeautifulSoup as BS ModuleNotFoundError: No module named 'bs4'
is it something with the paths?
I am facing this issue for 2 days but still have no chance to fix it.
I’m trying to organize my .py files in the local packages folder but got the mentioned errors that my modules were not found
IDE: PyCharm
Tried solutions with no chance:
-
I have added
__init__.pyempty file in each directory -
I have marked the directory as a resource
I am trying to import some functions like:
import function_name from direction.file
Please help
I've got two scripts in my directory. Normally I would be able to import modules from one to another, but I'm suddenly getting this error:
ModuleNotFoundError: No module named modulename in Python
I've searched and tried solutions, but I don't think I properly understand how to solve it.
I'm not sure what's happened. When I check my working directory, os.getcwd() it spits out the correct one. All modules are in the same folder, and I used to be able to import them, until I added a new .py file. My original modules still work, even though they get the same error when i do:
import modulename
I can't tell if there's some structure I've missed, nor do I know how to check it, something like this
└── test
├── demoA
├── __init__.py
│ ├── test1.py
└── demoB
├── __init__.py
├── test2.pyI should mention that the original directory (call it A) is forked, I haven't made or changed anything in it. So I must have messed something up. Should I delete my file and put it in a different directory (call it B)? If so, how do I call a specific .py file from A in my new B? It's my understanding that it needs to be in the same one, but I'm completely new to this, and basically know nothing. I just know that import module name should normally work :(
Been using VSCode and Python for a while but today all my files which use import of a module that is not built-in just don't work, like the modules don't exist. They are there in site-packages, and I can see them with pip, but where previously module names and attributes would appear in aurocomplete they suddenly don't, and debugging gives (as an example) "module pyinputplus has no attribute InputMenu". I know it does, because it did yesterday and for weeks prior. Something's borked.
I've uninstalled and re-installed the modules, the Python and Pylance extensions in VSCode, and VScode itself to no avail. Very confused as to how or why this could happen. Has anyone else had this problem?
Edit: virtual environments seem like a no-brainer now, thanks everyone.
Hi. Total noob here.
I have one Python installed, 3.9. I’m using Windows 10.
I am trying to install my first module, so that I can code in a file and run the code in the interpreter, rather than having to code right in the interpreter.
I made a new folder called “py” in my C:\ directory, and saved my module as a text file with a .py extension. It’s called “A3.py” and when I open the folder I can see it’s there, and it’s classified as a text file by Windows Explorer.
I open the interpreter and enter “import sys”. When I enter “print(sys.path)” there are six paths. I enter “sys.path.append(‘C:\\py’), enter “print(sys.path)” again and see that ‘C:\\py’ is now there, formatted the same correct way as the other paths, so it appears that the interpreter knows to look in this folder.
I enter “import A3”, and it raises the following exception:
“ModuleNotFoundError: No module named 'A3'”
Thoughts? I’m wondering if it being classified as a text file is my problem?
Thanks!
I'm using Python 3.6.5 on Windows 10.
When I try to run a script from the command line which imports certain modules, like praw, I get ModuleNotFoundError: No module named 'praw'. However, doing pip install praw or python -m pip install praw gives me a list of Requirement already satisfieds. And when I run the script from IDLE, it goes without a hitch.
This doesn't happen for all modules. I tested a bunch, and the following modules throw an error: praw, gspread, prawcore, openpyxl. These are fine: datetime, sqlite3, time, logging, sys, re, glob, collections. So it looks like the problem is limited to modules outside the standard library.
The problem started after installing PyCharm. A year ago, the same thing happened - I installed PyCharm and couldn't run scripts from the command line anymore. I didn't troubleshoot, just uninstalled PyCharm and that resolved everything. This week, I thought that the program was worth another try and installed it again, but the command line issue came up again and I couldn't fix it. Unfortunately, last year's strategy didn't work: I've removed PyCharm from my laptop, and I rebooted - but the problem persists.
I've googled myself silly, and I can't figure out what's going on. Hope someone can help!
I have experience coding in python. Pip works as expected. I have installed modules through pip before and they were quickly usable. When trying to install modules now they are not recognized by ides or terminals.
I was trying to install Scrapy via pip at first: “pip install scrapy”. CMD and vs code, and vs community say it installs successfully with no errors or warnings.
However, if I try to use the module via a terminal or import it in an ide it says module not used and gives me:
'Scrapy' is not recognized as an internal or external command, operable program or batch file.
So, I used the anaconda prompt: conda install -c anaconda scrapy
It installs successfully and returns the expected output:
Scrapy --help Scrapy 2.6.1 - no active projectUsage: scrapy <command> [options] [args]Available commands: bench Run quick benchmark test commands fetch Fetch a URL using the Scrapy downloader genspider Generate new spider using pre-defined templates runspider Run a self-contained spider (without creating a project) settings Get settings values shell Interactive scraping console startproject Create new project version Print Scrapy version view Open URL in browser, as seen by Scrapy [ more ] More commands available when run from project directory Use "scrapy <command> -h" to see more info about a command
I can switch the interpreter in vs code and community and then the yellow squiggles go away but hovering over the import still says unused import. I also cannot use the modules in vscode terminal:
scrapy --help scrapy : The term 'scrapy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + scrapy --help + ~~~~~~ + CategoryInfo : ObjectNotFound: (scrapy:String) [], CommandNotFoundException PS C:\Users\UserName> Scrapy --help Scrapy: The term 'Scrapy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Scrapy --help + ~~~~~~ + CategoryInfo : ObjectNotFound: (Scrapy:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
I tried to use other modules such as pandas, which I have coded with before. I can’t use any of them the way I’m supposed to. I tried:
-
uninstalling and reinstalling python, scrapy, pandas via pip, anaconda, and the regular exe for python from python.org.
-
I’ve tried adding python to the path.
-
I’ve tried to see if I can change the interpreter for my os? But I can’t find anything clear on how to do that.
-
I’ve restarted my computer many times.
Searching this Subreddit’s FAQ:
-
The link to “List of popular modules that do/don't support python” returns a 500 internal error.
-
I added python to the path under the fix for “python/pip is not recognized as an internal or external command, operable program or batch file.”
Searching this Subreddits Index:
There isn’t anything searchable for “module” or “Modules” here.
-
“installation” gave me a hitchhiker’s guide to python. The modules section is helpful but doesn’t solve my problem.
Books Sections have more excellent explanations but no solutions.
-
Python version: 3.10.4
-
Path: C:\Users\UserName\AppData\Local\Microsoft\WindowsApps\python3.exe
-
OS: Windows 10 Home 64-bit build 19044.1645
I am so confused. I do not know how to fix this. Is there something you can see that I can’t? I am completely unable to code. Please help me, I will provide any information needed to do so. I just wanted to learn web scraping.
in my project I have this structure:
project/
├── utils/
│ └── dal.py
└── test/
│ └── test.py
in test.py I want to import dal module, I did from utils.dal import * but it didn't work. it keeps returning this error: ModuleNotFoundError: No module named 'utils'
but when I move the test.py file out of the test folder and place it directly under the project folder it resolves the issue.
-
I tired relative import
from ..utils.dal import *also didn't work. -
I tired creating __init__.py files in both folders (suggested by chatgpt) also didn't work.
also maybe it's worth mentioning that I have a virtual environment activated too (idk if it's relevant).
anyone has as idea how to solve this problem?