Python newbie here. I am on windows. I installed anaconda a while back for my own user account (not for all users on windows). It installed into c:\users...\local..anaconda and all is good. I might have recently updated anaconda and installed VS 2017.
Now I seem to have 4 python environments.
I tried uninstalling from add-remove programs but some how the environments did not go away.
My questions:
1. Where does Visual Studio get the list of environment names?
2. How do I delete these environments? I just want to keep one and delete all the others
I deleted the unwanted registry keys from (what solved the problem for me):
HKEY_CURRENT_USER\Software\Python\PythonCore\
The source mentions also the following keys, but they did not exist in my computer:
HKEY_LOCAL_MACHINE\Software\Python\PythonCore\
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Python\PythonCore\
Source: https://github.com/Microsoft/PTVS/issues/18
I found my answer to this question here : https://learn.microsoft.com/en-us/visualstudio/python/managing-python-environments-in-visual-studio?view=vs-2019#fix-or-delete-invalid-environments
First click this button
You will then see this kind of screen
Then click the dropdown menu where it shows - packages. Then click the overview tab.
Click the delete/remove the enviroment.
Your enviroment should now be removed.
This is the link to read
I'll quote you what I think is relevant for your case, but if it's not, just read it all and find what you need
Any global environment can be added as a project environment by
right-clicking Python Environments and selecting Add/Remove Python
Environments.... From the displayed list you can select or deselect
those environments that are available in your project.+
And...
Once a virtual environment is added to your project, it appears in the
Python Environments window, you can activate it like any other
environment, and you can manage its packages. Right-clicking it and
selecting Remove either removes the reference to the environment, or
deletes the environment and all its files on disk (but not the base
interpreter).
to Question 1:
Visual Studio searches the registry to detect global installed python environments by following PEP 514 as described in Install Python interpreters.
to Question 2:
Open the Visual Studio Installer again and change the current installation by selecting only the python interpreters you need (you will find they in the Components tab).
Related
My issue requires some backstory.
I was having some troubles with pip, so I reinstalled Python. After the reinstall pip began to work, but Pycharm, my IDE, could no longer find Python. When I reinstalled Python it created a new folder for itself (Python310), but Pycharm kept looking in the old folder (Python39). I couldn't figure out how to get Pycharm to look in the new folder. Even deleting and reinstalling it did nothing.
So, I renamed Python310 to Python39 and changed the PATH. Now Pycharm can find Python. But pip has developed a new and exciting error. When I try to use it I get the following message:
Fatal error in launcher: Unable to create process using '"C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" install numpy': The system cannot find the file specified.
If I read this correctly pip is still trying to look in Python310. Would you please tell me what I need to do to get pip to looking in the right place?
So, to start. You don't fix this by renaming the folder where the interpreter resides. Even if that worked, it's not a fix. The name will say one thing, but it's actual version, compatible libraries, and anything else tied to the version number would be incorrect.
If you take a close look at the error message from pip, it tells us what's wrong.
Fatal error in launcher: Unable to create process using '"C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" install numpy': The system cannot find the file specified.
You renamed the directory, so your IDE can find it, but pip and everything else using the Python interpreter is still configured to look in the Python39 directory to find it.
The problem you are having is that your IDE, PyCharm, needs to be configured for your project. You have to tell it where the Python interpreter is. The simple solution, you can rename your your Python folder back to it's original state, and add it to your project.
Press Ctrl+Alt+S to open the project Settings/Preferences and go to Project | Python Interpreter. Click the Add Interpreter link next to the list of the available interpreters.
Expand the list of the available interpreters and click the Show All link.
Select the target interpreter.
In your case, look for the one with this file path: "C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe"
I would recommend going one step futher and create an interpreter in a virtual environment. Especially if you are interested in Python beyond a very casual hobby. They are unavoidable.
This link is a good source and can help you with this:
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#interpreter
There, you will find screenshots that follow the steps I listed above. There are also detailed instructions on how to create and add a new interpreter in a virtual environment. The relevant headings are as follows:
Configure a Python interpreter
Python interpreters in PyCharm
Setting an existing Python interpreter
Creating a new Python interpreter
The rest of the content is great as well, and may help answer questions you didn't know you had.
try to uninstall all of the existing python versions. and install it again. using any of application allow you to delete most of files, so to prevent error when re-install .
Option 1:
delete and reinstall again. and then when creating a project it should prompt you to pick a basic interpreter, choose python310 or whatever version you're using.
Option 2:
use a different IDE.
I'm making an installer for Windows 10 that installs some files within Anaconda's installation path. For this, I'm using Visual Studio (2019 -- version 16.9.4) and the Setup Project plugin (version 0.9.9). I have added a "Registry Launch Condition" following the instructions explained here (that I found after reading this post) so that the installer finds Anaconda's directory automatically, without having to assume the Anaconda's default installation path (given here).
For the installer, I have managed to create a registry search condition and link it to the files that are to be installed in such a way that if the search fails then the installer prompts an error message (that I know how to edit).
I haven't managed, however, to introduce a proper "RegKey" to find anaconda in the registry. As a matter of fact, I don't even know how to find Anaconda in the Windows' Registry Editor app.
Question 1: What is (are) the registry key (keys) related to Anaconda?
I can't find this answer anywhere. I need a registry key that gives me Anaconda's root directory,
C:\...\Anaconda3
or any other of these paths
C:\...\Anaconda3\Lib
C:\...\Anaconda3\Lib\site-packages
Question 2: If the only registry key entry available does not give any of these three paths (listed above) but rather some other path within Anaconda's root directory, then how can such a path be modified to get one of those three listed above?
Thank you all! :)
I'll answer this question so that others have the chance to solve, if not the same, similar issues. I managed to find what I was looking for by searching folder by folder the registry via the registry editor app. The registry key that I need is displayed on the bar below the dropdown menus "File", "Edit", .... You just need to remove the Computer\HKEY_CURRENT_USER\ and keep the rest SOFTWARE\Python\ContinuumAnalytics\Anaconda38-64\InstallPath. This, I believe, if anaconda was installed with python 3.8.
In VS Code, many extensions, such as Tab Nine and Lint, rely on specific Python packages to function. On the other hand, the code I develop may need a different set of packages. Because there is the potential for package conflict and because we want the environment that we develop code to mimic the production environment, it is convenient to have the dev environment/extensions use one Anaconda Environment and the code I develop to use a different Anaconda Environment. But I am not sure how to configure this. Can someone help?
Down in the bottom left corner of VS code you can manually select the python environment depending on which codebase you are working with. The selection can be saved in the settings.json file so you don't have to manually reselect each time.
I'm new to programming and just started a course on Python. I want to use PyCharm, so I downloaded and intalled it (v. 4.5, community edition). I had previously installed Python 3.5 64-bit from python.org (I'm using Windows 10).
To start using PyCharm, I need a project interpreter, which I can select in the settings. As far as I'm concerned, the interpreter is "py.exe", but when I select it, I get this error message: "The selected file is not a valid home for Python SDK". I also tried to use every file whose name contained "python" or "py", and failed.
On every website and video I see, they select a file called "python.exe", but they're using Python 3.4 or a previous version. I checked that PyCharm supports 3.5 ("Initial support for Python 3.5").
Is there anything I'm doing wrong? What should I do to be able to use PyCharm?
All replies are appreciated. Thanks in advance.
file > new project settings > project Interpreter > click in the drop down and select 'show all' > click the '+' button >
Now, in the Virtualenv Environment tab under the New environment radio button, check the path in the 'Base interpreter:' field. For me, mine was set to an invalid path. Once I had corrected the path to point to python.exe I recreated my new project and PyCharm built the virtualenv.
For me there was a bit more too.... When creating the new project I expanded the drop down and had to verify the directory where the venv directory was being created. Once I had corrected the path here I had to click around a bit to get it to let me create the project.
I'm going to chaulk this up to a bug. I'm using Community edition.
When creating a project in PyCharm, if the interpret is not already selected, in the drop down menu under the projects "Location:", you can click the gear-looking icon to the right of the interpreter option, and click "Add Local"; then select the file location of the python.exe file that you have installed. It will probably be C:\Python35\Python.exe
I faced a Similar issue and was not able to find Python interpreter anywhere on the system.
The problem with it was that python was installed directly with default settings and there was no exe found in
C:\Python35\
and to solve this i tried uninstalling and reinstalling with custom settings and selecting allow for all users as well which did the trick and path was set correctly to
C:\Python35\python.exe.
After whichPycharm was able to detect the interpreter on this path.
PyCharm project interpreter problem Resolved
I installed anaconda python distribution (Anaconda3-5.0.1-Windows-x86_64.exe) from the anaconda website. https://anaconda.org/anaconda/python
What it actually did was it re-installed my Python3.6.3 (pertinent to mention I have windows10, with pyCharm community & python 3.5 already but with the interpreter problem and while installing anaconda I chose the following settings and disabled my antivirus before my anaconda installation):
selecting allow for all users
installation path was set correctly and (stored safely for future)
restart my Computer after installation.(not essential-but I did)
opened Anaconda & Jet brian pycharm
selected new project in PyCharm screen shot of my New project default Python interpreter location = C:\Users\Skboy\PycharmProjects\dani Interpreter = C:\Users\Skboy\AppData\Local\Programs\Python\Python36-32\python.exe
Wow! my pyCharm started working for me,
Resolution : Python6.3 re-installation with proper custom setting
make a python test test1.py program file to print "hello python test world"
Run
now my Python Interpreter(automatically -by default select) Python 3.6.3
edit configuration & check for interpreter
(C:\Users\user1\AppData\Local\Programs\Python\Python36-32\python.exe)
Run
success test Run
worth to mention Anaconda Jupyter is a web based can also be used in case novice user are still having problems
I have had the exact same problem and was unable to find the solution until just now. Hopefully this works for anyone that was struggling with it.
I went to the location of the Python 3.5 (32-Bit) in my C: Drive which it turns out is just a shortcut to the actual Python application, right click on it and select Open file location which should direct you to the application version of python - simply called 'python'. This is the .exe file that PyCharm was looking for to use as the interpreter.
Now go to the configure interpreter menu in Pycharm and type in the file location of the actual python application. To get to mine I had to go to AppData/Local/Programs/Python/Python35-32. Click on the python.exe file and it should work.
This is my first post here so if its formatted incorrectly or doesn't use the conventional terms - sorry. Let me know if the solution worked for anyone else with the problem or if I fluked it.
If you kept the default settings while installing python, Your project interpreter for PyCharm will be:
C:\Users\yourUserName\AppData\Local\Programs\Python\Python36\python.exe
Chose the above location as your project interpreter inside PyCharm.
Depending on which python version you have, it could be either Python36\python.exe or Python35\python.exe.
For me the following solution it worked:
My configuration:
Pycharm Community edition 2019.1.1
Anaconda distribution with python 3.7. Interpreter in standard location.
Problem:
Pycharm was not able to find python interpreter after reinstallation of anaconda distribution.
Solution:
- Make sure you run pycharm as admin (right click and run as admin). This was actually the critical step.
- Create new project (or open an existing one)
- Depending on the choice choose interpter or go to file > settings > project interpreter > choose small gear on rights side > add > on base interpreter choose the 3 dots > paste the location of the interpreter in the anaconda distribution.
Hope it helped someone. For me the blocking point was that for some reason pycharm was not launching with admin rights.
Blockquote
I'm trying to add external libraries to my project, but there seems no way to do so in PyCharm 4 (Professional). I found several similar questions with accepted answers, however those seem only work on older PyCharm versions.
This is one example: PyCharm and external libraries
Does anyone know how to add paths for external Python packages and modules in PyCharm 4 Professional?
With the latest PyCharm version (2018.1) under File -> Default Settings -> Project Interpreter you can select which interpreter to use (OS default or any other distribution you may have manually installed).
The box in the middle lists all the packages currently installed, while the + button at the bottom allow to install packages from public repositories.
If you want to add custom packages you have to manually specify the path:
Select the interpreter and click on "Show paths for the selected interpreter"
Add the path of the new module
If you want to install a pip package, the install button is still there, on the right hand side of the Project Interpreter configuration pane.
If you want to change the list of paths for an interpreter, press the "gear" button in the Project Interpreter configuration pane, then click on "More...", and then press "Show paths for the selected interpreter". In the dialog that appears, you can add or remove paths as needed.