Trying to import "libgen_api" module but get "Module not found" error.
Pip install libgen-api shows "requirement already satisfied" and the module exists in the python folder as well.
The documentation of the module says that it has to be called with libgen_api.
Other modules work fine. I am using VScode but the problem persists in the python terminal as well. I apologize if this question is redundant but so far I have not been able to find a solution anywhere.
The problem was that VScode sys.path showed python38-32 but the module was installed in python39. To fix the issue go to View -> Command pallete -> select interpreter and make sure to use the version under which pip installed the module.
This answered my question.
How can I change python version in Visual Studio Code?
Related
I am getting error for module dynamodb2 in boto but the module exists in my venv. Other modules in venv are recognized without any issues, only boto/dynamodb2 appears to have problem. I looked at similar issues posted on Stackoverflow such as this one python is not finding my installed modules in venv but none matched my situation. Any ideas what may be wrong?
It turned out to be an issue with Pycharm version I was using. I encountered above problem while using PyCharm community version 2022.2.2. I had an older PC where I did not get the library import error above. The version used was community 2020.2.4. So I installed the same on my new PC the error went away. Still don't quite understand why newer Pycharm would give the error and older version will not.
I got the P4 python module for win10 via the installer on their page: https://www.perforce.com/downloads/helix-core-api-python
Its for python 3.9, though I have tested it with both Python 3.10 and 3.9 and it always throws the error: No module named 'P4' when I try to use it inside visual code.
Interpreter is set up correctly (tried 310 and 39).
Im a bit lost here and would love some help.
The installer package installed the following files into site-packages:
P4.py
P4API.cp39-win_amd64.pyd
and a folder with 4 metadata files in it
P4.py on itself looks good, no errors.
Edit: Im trying to use it with Blender. Currently shipped python version within that is 3.10.2. Also tried a older blender version which uses 3.9.7.
Both wont work.
Visual studio code is known for it's bugs with python. You could try using "PyCharm". Make sure to install the modules from Pycharm's settings instead of terminal.
(I'm not sure if this is the reason, but it's worth the try. Had the same issue and the mentioned way solved it.)
this might be a very stupid question but I'm a beginner.
I want to use this package called colorgram, it's a module that extracts colours from images, and I installed it using pip via the CMD. but when I try to import it in VS code it can't find it and I don't know what to do, please help
#Andrii Zadaianchuk
sorry, I'm using windows 10. I tried to import it in python in the CMD but nothing either, just the same ModuleNotFoundError: No module named 'colorgram' error.
I did just notice that the modules python version is 3.5 and VS code is running 3.9.2. I think that might be the problem
I'm trying to run a script in python 3.9.1, on mac os, and several modules show a message of unresolved import 'aioboto3'Python(unresolved-import)
I ran pip3 in order to install them, it seems to have installed them but the messages still appear.
vscode does display correct version on the lower left bar.
Please advise on how can I resolve this? or even if this is an issue?
Based on the information you provided, I reproduced the problem:
Please check whether the module "aioboto3" has been installed in the python environment you are using: (pip show aioboto3)
(If it does not display the module installation information, it means that the module is not available in this environment. Please open a new VS Code terminal and make sure that the terminal is using the expected python environment (python --version).)
Please reload VS Code to let it recognize that the module has been installed.
Run:
Reference: Python Environments in VS Code.
So I know this is nearly a duplicate of this ImportError question, but I'm not sure how to use those answers to fix this problem. I installed yahoo-fin package using my conda prompt:
pip install yahoo-fin
So clearly it is installed as Eclipse seems to recognize the package and I can even use cntl-space to autocomplete and F3 to explore the package. However, when I try to run
from yahoo_fin.stock_info import get_data
I get "ImportError: No module named stock_info".
From the SE question above I checked the init.py in the directory and it definitely has the CRLF problem, but even when I use notepad++ to replace "\r\n" with "\n" I still get the same error.
What am I missing?
Are you able to load the package without using Eclipse? I would try running Python from the command line, and then typing:
from yahoo_fin.stock_info import get_data
to see if that still gives you an error. If it still gives you an error, then we know it's not an Eclipse issue. However, if it does work, then it's probably an issue with Eclipse. In that case, I would maybe look at this other post: How To Make Eclipse Pydev Plugin Recognize Newly Installed Python Modules?.
Please let me know if that helps.