No python at '\python.exe' - python

No Python at 'C:\Users\~~~~\python.exe' error keeps coming out..
Even if I deleted my previous python and path, the file location is where I installed my previous python...
I want to use python in VS code and cmd on windows 10.
What I tried to fix it
deleted python 3.7 version and reinstalled python 3.6 version.
removed previous python 3.7 path and added python 3.6 version reinstalled to the Windows Path variable.
remove ';' on windows path variable.
put ';' on windows path variable.
delete and reinstall python on vscode Extensions

If you use venv, then look in that file:
pyvenv.cfg

The reason this happened to me was because I updated my python version. Therefore, the existing venv config was looking for an older python version. What I did was simply delete the existing virtual environment folder and created a new one.
To save all dependencies installed and transfer it into the new virtual environment, you can do the following:
pip freeze > requirements.txt to save dependencies into a text file
delete old venv folder
create new venv folder
pip install requirements.txt

First of all, make sure you have installed correct bit version for your version 32/64 bit...I would prefer to install python from Microsoft store...And restart VS Code...
If the error still exists try uninstalling and again installing Python extension for VS Code and restart VS Code...
And you can even try to install python in the path it is searching for... And also add the path to the environmental variable...
Hope this might solve your problem...as it has done mine.

I ran into this issue when having done the following:
I had Python 3.8 and 3.9 installed.
Installed Python 3.10.
Removed Python 3.9 and 3.9.
Set PATH property to contain the paths to Python 10 installation folder and its Scripts folder.
After this, Python stopped working from console and in IDE. When trying to add the Python interpreter to the IDE (Intellij IDEA) I realised there was no python.exe in Python 10 folder.
To fix this, I uninstalled Python 10 altogether and installed it again. It started to work.

Okay this should cover your issue. Firstly check whether it is installed
$ $(npm config get python)
or
npm --add-python-to-path='true' --debug install --global windows-build-tool
Moreover, do not forget to run your client interface as administrator.
More on this topic https://github.com/felixrieseberg/windows-build-tools/issues/56

Related

problem with pycharm interperter and installing packages

I have a problem with installing packages in my pycharm project.
Until today everything worked perfectly, I could install packages and everything worked.
I didn't change anything but now everytime I try to install new package I get an error
pycharm message 1
pycharm message 2
But I do have pip installed in python interpreter
interpreter packages
I'm trying to understand what is the problem and how to fix it.
I'm not sure if this is the problem, but the interpreter is python 3.7 and the weird thing is when I'm checking the version on my cmd it's 3.8.3 but when I checked on Windows's apps it showed python 3.7.3
python version from cmd
Is there a reason it happened just randomly after it worked perfectly in the last couple of weeks I worked on the program?
Maybe it's because i updated the pip?
You can try few things
Running same command in terminal. If it doesn't work then please locate your pip.exe which is generally in the Scripts folder right next to python.exe. Make sure the path/to/folder is in environment variables
Reset project settings. Try deleting .idea directory in your project. This folder is created by pycharm to save settings. Open the project folder again in pycharm and set the interpreter.
Did you try to install directly with pip in the terminal ? If it doesn't work maybe you should reinstall it

How to install Python, VSCode, and flake8 correctly on Win10

I greatly apologize for the newbie question. I am trying to correctly download and integrate a Python 3.7 installation with VSCode and using flake8 as a linter. I want to get set up for developing custom scripts for Blender. I'm on Win10 x64.
I downloaded the "python-3.7.8-amd64.exe" installation package, and installed it.
I made sure to select the checkbox that adds python to the PATH environment variable in the installer.
I pointed VSCode to the newly installed interpreter and was then prompted to install a linter.
Someone recommended flake8, so I selected that in VSCode and installed.
During the installation I get the following warnings:
WARNING: The script pyflakes.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pycodestyle.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script flake8.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed flake8-3.8.3 importlib-metadata-1.7.0 mccabe-0.6.1 pycodestyle-2.6.0 pyflakes-2.2.0 zipp-3.1.0
I checked my environment variables and this is what shows up:
What I don't understand is why I have two Python directories in %APPDATA%. There is:
C:\Users\futur\AppData\Local\Programs\Python\Python37\Scripts
As well as:
C:\Users\futur\AppData\Roaming\Python\Python37\Scripts
flake8 installed in the Roaming folder, while my main Python installation is in
C:\Users\futur\AppData\Local\Programs\Python\Python37
So to conclude, these are my questions:
Did flake8 install in the wrong directory?
Should I add C:\Users\futur\AppData\Roaming\Python\Python37\Scripts to my USER PATH environment variable, or to my SYSTEM PATH environment variable?
Why are there two Python directories in %appdata%? (Roaming and Local)
Any guidance on how to properly set everything up correctly would be an ENORMOUS help and greatly appreciated.
Edit 1
Thank so much for all the answers. I want to emphasize that I would prefer to get this issue sorted out without just installing Anaconda.
Edit 2
I made some progress here. Instead of installing flake8 through VSCode, I just ran python -m pip install flake8 and everything seems good now.
According to your description, I successfully installed flake8.
I think there is a problem with your installation path of flake8.
Its default path will not be in roaming.
The default path will only have: C:\Users\futur\AppData\Local\Programs\Python\Python37\Scripts and C:\Users\futur\AppData\Local\Programs\Python\Python37;
The default is local, which usually stores executable programs and other large capacity files;
It is recommended that you could install python again and check the version and location of the pip (use "pip -- version").
You could use an environment tool to resolve all these.
Download anaconda and create a environment with your intended python version and install flake8 inside your conda env. VScode works well with anaconda env.
Download Anaconda it will auto-resolve all the problems which you are facing related to environment setup.
I don't think it is wrong. My new modules are also installed at same directory as yours.
For me, it only works when I add to SYSTEM PATH.
I also have Python in both Roaming and Local. But after checking my folders, it seem Local one is from my previous installation of Python.
As a side note, I also have to add env path for Python after installing Python installer. But, I remember clearly that in previous Python installers, I didn't have to add path manually. I wonder if there is any changes regarding path in new Python installer.
What I think happened is you used a global install of Python to install flake8 and the Python extension does a user install to help prevent you from breaking your Python installation (python -m pip install -u). So one path is to Python itself and the other is your user install of packages for a specific version of Python. That's why there's two separate locations.
The best way to manage this is to create a virtual environment and install into that (you don't need to switch to conda for isolation). That global install you did using python -m pip install flake8 is a bit risky as that could clash with other things you install in the future.

pipenv search python in old directory do not exist

I would to create new Python project which include pipenv for manage my packages.
But when I try to install package with it, it throw me I exception :
ValueError: Not a valid python path:
'C:/dev/Anaconda3/Scripts/python.exe'
I try pipenv command with 2 differents emulation terminal (Cmder and Terminus) which produce same result.
In old time a try Anaconda solutions for work with Python. But now I don't want use this and I uninstall Anaconda in my OS.
It seems that my OS keep old reference to this python executable into Anaconda in your PATH... But I display my 2 PATH variables OS (PATH system OS and PATH user) and nothing has this location path into your string.
The directory c:\dev\Anaconda3 doesn't exist !
I try to search uninstall Anaconda program in my tool application manager Windows but Anaconda is not diplayed in that listing. It seems to be good uninstalled.
I install correctly pipenv executable : pipenv --version
pipenv, version 2020.6.2
I install correctly python executable : python --version
Python 3.8.3
I added 3 differents PATH python for my OS PATH (system PATH and user PATH) :
C:\dev\python\Python38
C:\dev\python\Python38\Scripts\
C:\dev\python\Python38\Scripts\bin
Why I keep old reference to Anaconda program ?
Why many program search python in same old deleted path and PATH variable do not included this ?
How pipenv created his PATH environment variable ?
I had a Python2.7 instance giving me the same problem. I copy/pasted its python.exe into the Scripts folder. So it now found a real python.exe there. Once I did this it continued on happily. And now I was able to use the Python3.9 version i wanted it to use anyways.
It seems like the python searcher should be a little more tolerant and just ignore poorly formed python releases. There is an open ticket for this: https://github.com/pypa/pipenv/issues/4334
I had a similar error because of an incorrectly uninstalled Anaconda. To see if you have the same problem, go to System Settings > Add or remove programs, and check for anything unexpected matching "conda". Trying to uninstall it results in an error because the uninstall.exe file cannot be found.
Searching around, I saw a few posts that said to mess with regedit, but that's scary. Instead, I re-installed the version of Anaconda that I needed to uninstall (you can do that with https://repo.anaconda.com/archive/Anaconda3-2020.02-Windows-x86_64.exe, replacing 2020.02 with your Anaconda version), and then uninstalling it via the proper uninstaller via "Add or remove programs". After a restart, the phantom Anaconda python was gone
You need to delete the old path in the Windows Registry.
Hit win + r
regedit
find folders with (Anaconda3 or Miniconda3).
Probably two folders. Do not delete folders with the new path to Python.

PTVS cant find Python interpreter?

I just copied my Flask project from one machine to another. I have same version of Python installed on both the machines. When I loaded the project in the new machine, it said my virtual environment is unavailable. So I initially tried to install it from requirements.txt file but it failed without any helpful error message.
So I deleted the virtual env in Visual Studio and tried to create another one. Now it complains that it cannot find any Python interpreters on my machine. I tried uninstall/reinstall Python but it didn't work. Also, the Python location is added in the PATH environment variable and all the modules in the requirements.txt file are downloaded from pip individually.
So the modules are installed, python is installed and the project is there but the virtual env won't setup because of the below reason. Any way that I can fix this ? This is PTVS15 and Python 3.6.1
Fixed it myself. I went ahead and added the environment manually by specifying the Python installation paths in the Add Environment tab. It took a while to detect the interpreter even in this way but it finally worked. I am now able to build my app.

Invalid Python SDK Error while using Python 3.4 on PyCharm

When I switch my PyCharm to use Python 3.4.3 and I am getting the error:
Invalid Python SDK
Also PyCharm does not automatically find the Python 3.4 interpreter for me, even though it is on the desired path /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4. See the screenshot:
Despite this the interpreter does work. I am able to get correct output as expected, but code completion related to Python 3.4 is not working.
E.g. print("hello world!) still shows an error on the editor, but the console shows the correct output.
This also happened to me. I renamed a repository and then my virtual environment got stuck in the old path.
I grepped all configuration files and could not find any reference to the old one.
What finally solved the problem was to clear caches with the option File > Invalidate Caches / Restart...:
I had the same issue.
Try to comment/remove the PYTHONPATH variable in your ~/.bash_profile
#export PYTHONPATH=/usr/local/lib/python2.7/site-packages/
If it does not help it also may be useful to look in the idea.log for the errors:
/Users/username/Library/Logs/PyCharm40/idea.log
I had the following errors:
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
PYTHONPATH is currently: "/usr/local/lib/python2.7/site-packages/"
You should `unset PYTHONPATH` to fix this.
I go the same error message in Windows version of PyCharm after I re-installed Python (3.5) on a different location. The problem was that most of my existing virtual environments registered in PyCharm were still referencing the old installation of Python.
I resolved it by deleting these existing virtual environments and creating a new one. If deleting existing interpreters (in virtual environment) is not an option, you should be able to modify them instead in File | Settings | Project Interpreter
I got the same issue, when I updated Python (3.x) version via Home brew in MacOS.
Above answers didn't work for me. But with those, I realize that, it's an issue with linking the directories. I deleted ~/.virtualenvs folder and recreated all virtual envs.
$ ls -a ~/.virtualenvs
local-dev wdias-dev
$ rm -rf ~/.virtualenvs
$ which python3
/usr/local/bin/python3
$ mkvirtualenv local-dev --python=/usr/local/bin/python3
$ mkvirtualenv wdias-dev --python=/usr/local/bin/python3
Open the PyCharm again, and it works fine.
I couldn't get anything to work, so I cloned my conda env (see how), called it something else, and then set it in PyCharm to the new one.
For me, changing the paths in ~\venv\pyvenv.cfg made PyCharm recognize the new environment after bringing my projects to a new PC.
I had the same issue in Windows10. I was so frustrated, beacause everything seems looked OK. I've added PYTHONPATH, I've restarted Pycharm and deleted old virtualenv folders and created new... It did't work.
And at the end I have just opened Pycharm in an administrator mode and it works!
When creating a new project my interpreter was set to python 2.7 so I had to change that to python3 and everything works like a charm
I got the same problem with Pop OS 21.04 and Pycharm installed via Flatpack. So i remove it and installed via Snap and started working again.
I ended up having to install Python as an admin and make sure it installed to the C:\Program Files\Python310 folder. I think The option was to make sure it installed for all users. If I installed it under for user's appdata it wouldn't work.
Once I did that I was able to point pycharm to the C:\Program Files\Python310\ for the interpreter. Pretty annoying but finally got it working
I've solved it too. Uninstalled python 3.10, installed python 3.9. Changed the python interpreter to 3.9 through pycharm setting. Created a new virtual environment.

Categories