No module requests found - Visual Studio code - python

I cannot run a code in Visual Studio Code with import requests. I installed requests with pip install requests and it still doesn't work. I tried uninstalling it and installing it again but this didn't work either.
Traceback (most recent call last):
File "d:\code\Projects\Project\project.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Tried doing it via the terminal which didn't work either.

After selecting python interpreter, open a new integrated terminal then run
pip show requests
If you can get detailed information, reload window should solve no module found error;
If it shows WARNING: Package(s) not found: requests, please reinstall it.

Related

Firebase in Python venv not working due to 'No module named 'Crypto'

I am trying to use Firebase in my python web app, but when I installed firebase in my venv, everytime I run the python file I get a dependency error. I just kept pip installing them until I got to "No module named 'Crypto'."
I have tried doing:
pip install pycrypto
pip install pycryptodome
Both install successfully, but when I rerun the app I still get "ModuleNotFoundError: No module named 'Crypto'."
I am using visual studio code if that matters. I am installing them to my venv with the visual studio code terminal.
Full error:
Traceback (most recent call last):
File "/Users/dylan/Desktop/Web App/main.py", line 8, in <module>
from firebase import firebase
File "/Users/dylan/Desktop/Web App/venv/lib/python3.8/site-packages/firebase/__init__.py", line 20, in <module>
from Crypto.PublicKey import RSA
ModuleNotFoundError: No module named 'Crypto'

Installed package Python not recognizing it

I recently tried to create my own pip package. I followed this guide, uploaded to pip. And after I install it python just returns error that module is not found, even if I type pip freeze, the module is installed there.
Also I tried to install it on my Windows pc (prev. machine is Ubuntu) and it doest't work there as well. Any tips?
EDIT:
https://pypi.org/project/PyColours/
The output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyColours'
You named main directory PyColours_pkg so you need to
import PyColours_pkg
Or rename the directory to PyColours, increase version, recreate and reupload the package.

CNTK Crashes Python when imported : Fatal Python error: Py_Initialize: can't initialize sys standard streams

I have installed CNTK CPU only version module using pip
pip3 install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.3.1-cp36-cp36m-win_amd64.whl
When i imported in spyder IDE, it was working fine. But when i tried to install other modules likes pandas, numpy using pip it crashes Python and says stopped working.
C:\Program Files\Python36\Scripts>pip3 install pandas
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "C:\Program Files\Python36\Lib\site-packages\cntk\io\__init__.py", line 1
3, in <module>
ModuleNotFoundError: No module named 'cntk'
It says There is no module names CNTK and crashes Python. I am unable to open Python IDE after this.
Any idea why this happens? I uninstalled and installed for nearly 4 times. It still a problem.

Python Anaconda ImportError No module named menuinst.knownfolders

I am just starting to learn Python. Having used R Studio and Matlab, I was looking for a similar IDE.
I downloaded Python 2.7 and then downloaded Anaconda IDE. However, when I try to open Python using either Spyder/iPython/ Jupyter NB under the Anaconda folder, a command window flashes open and then closes. Below is the error I captured from the cmd window:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\cwp.py", line 9, in <module>
from menuinst.knownfolders import FOLDERID, get_folder_path, PathNotFoundException
ImportError: No module named menuinst.knownfolders
I am using Windows10 64bit.
Could someone kindly help?
Have you tried the following command in the cmd:
conda install menuinst
This should install the menuinst package, as you appear to not have it installed.

Error message when trying to import installed python package

I have python2.7 and python 2.6 installed in my VM and I pip install some libraries such as:
sudo pip install gsconfig
The installation is successful and I can see that the package is installed by:
pip list
My default system's python is 2.6. In the terminal I enter python and try to import the library as:
python
import gsconfig
And then I get an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gsconfig
I also tried with python2.7 as:
python2.7
import gsconfig
I get the same error message. I can not understand why this is happening as I don't have with other packages this issue (e.g. simplejson).
Can it be that the location of the package is different?
When I try this:
which gsconfig
I get:
/usr/bin/which: no gsconfig in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
EDITED
Also when I go to the site-packages folder of python2.7 I can see that the package is installed.
It looks like the package name is not gsconfig, but is something else.
Looking at the documentation, I think it's geoserver.

Categories

Resources