I have been using python in VS Code for a while, everything was smooth. But yesterday I accidentally pressed "Run CC Cleaner" on my PC. This, among other things must have cleared some VS Code cache and I no longer can run scripts.
In cmd for example it says that "pandas can not be found" while pip says that it definitely is installed.
Running !python - m pip install pandas in VS Code just does not do anything.
Something must have severed the connection between python and VS Code.
The Python and the Python Extension do not have some connections, the Python Extension just needs to find the path of the Python.
It looks like an environment problem. Could you check which pip you are using with the command of pip --version?
But I was confusing of python - m pip install pandas in VS Code just does not do anything, could you explain it clearly?
Related
I start on Python, I try to use mathplotlib on my code but I have an error "ModuleNotFoundError: No module named 'matplotlib'" on my cmd. So I have tried to use pip on the cmd: pip install mathplotlib.
But I have an other error "No python at 'C:\...\Microsoft Visual Studio\...".
Actually I don't use Microsoft Studio anymore so I uninstall it but I think I have to change the path for the pip module but I don't know how... I add the link of the script of the Python folder on the variables environment but it doesn't change anything. How can I use pip ?
Your setup seems messed up. A couple of ideas:
long term solution: Uninstall everything related to Python, make sure your PATH environment variables are clean, and reinstall Python from scratch.
short term solution: Since py seems to work, you could go along with it: py, py -3 -m pip install <something>, and so on.
If you feel comfortable enough you could try to salvage what works by looking at the output of py -0p, this should tell you where are the Python installations that are potentially functional, and you could get rid of the rest.
I recently installed the opencv package using pip install and I wrote a small code to test it (cvtest.py). The code runs through the python idle shell but running it though the command prompt gives the error
Error while finding module specification for 'cvtest.py' (ModuleNotFoundError: __path__ attribute not found on 'cvtest' while trying to find 'cvtest.py')
I tried uninstalling and reinstalling both python and the package. looking up the system path using python -m site gives these results. I am the only user of my laptop.
sys.path = [
'C:\\Users\\Kareem Mostafa\\Desktop\\Assignments\\computer vision',
'G:\\Python37\\python37.zip',
'G:\\Python37\\DLLs',
'G:\\Python37\\lib',
'G:\\Python37',
'G:\\Python37\\lib\\site-packages',
This is the code I am using
import cv2
x=cv2.imread('backpack for sale.jpg',0)
cv2.imshow('x',x)
update: the problem is happening with all the py files I am having whether they require imports or not. apparently python is looking for _init_.py for all the files as if they are packages. Any idea what is going on?
For anyone else that had this problem (assuming kareemostafa has fixed it now!)
Removing the .py suffix on the python -m command fixes this problem, it appears -m only requires module names whereas running it directly as a python file (no -m option) requires the .py suffix
In your case python -m cvtest should be sufficient.
I received an error on atom, it asked to install ipkernal using pip.
Not sure what to do. I have Anaconda on my system and not pip. Can someone explains whats the error about and how can I solve it in using anaconda.
I was running a python code and saved the file as .py.
import pandas as pd
wd = pd.read_csv("winequality-red", sep = ";")
five = wd.head()
print ("five")
Error message:
No kernel for grammar Python found <br>
Check that the language for this file is set in Atom and that you have a Jupyter kernel installed for it.<br>
To detect your current Python install you will need to run:<br>
python -m pip install ipykernel<br>
python -m ipykernel install --user
This isn't really an answer, but you might have better luck on the dedicated Atom forums.
In your case though, it looks like you haven't installed the proper kernels Hydrogen needs to run Python with. (Of course, I'm just assuming you're using Hydrogen. You haven't actually provided any details about how you are trying to run it).
From the Hydrogen documentation, it takes you to this page for Python kernels.
https://nteract.io/kernels/python
In particular, I think you want to run the command conda install ipykernel
I'm using Python 3 on windows I'm trying to install a package from within a script.
The purpose is that I don't want to explain to the person I'm sending the script how to install the packages he needs, so I'm hoping to do it on the fly from within the script.
Here's my code:
import pip
pip.main(["install", 'pyetrade'])
import pyetrade
Everything installs correctly with pip.main, however it doesn't move on to "import pyetrade" or the rest of the code. It just hangs there.
Any ideas how to get around this? This also seems to happen when I use the command propt -- it seems to just hang after installation.
I have pretty low experience with Python, but I'm tasked with creating an installation package so that I can distribute a GUI that messes with Time Series of Stocks taken from online. Based on what I've seen online, Python 3.4.1 has a built in module called ensurepip and pip, but for some reason I try and execute " python -m ensurepip" on the Python Shell, I get "Invalid Syntax"
I'm hoping to use pip to install all the dependencies for Pandas myself, but this is just one problem of many I suppose.
Edit: Slight update I suppose. I've checked my files and I know ensurepip is in the library of modules, and I've tried going through https://docs.python.org/3.4/installing/index.html and can't make heads or tails of it from my issues. Thanks in advance.
Edit2:http://puu.sh/azkqQ/4a5606a1f5.jpg
Picture indicating what I get. I've tried on the Command Prompt without the py and within the py
you're calling that command from the python shell. but it should be called from the command line. so just open up cmd or terminal and run that there, you should be fine.
and in the future, you should show the entire error. you probably got something like:
python -m ensurepip
^
SyntaxError: invalid syntax